Skip to content
Snippets Groups Projects
Commit 412c7b58 authored by Tomáš Valenta's avatar Tomáš Valenta
Browse files

fix download block & RSS feeds

parent 9ad95bc2
Branches
No related tags found
2 merge requests!899Release,!885Fix download block & RSS feeds
Pipeline #16314 passed
...@@ -111,8 +111,14 @@ class ProgramCategoryBlock(StructBlock): ...@@ -111,8 +111,14 @@ class ProgramCategoryBlock(StructBlock):
class ProgramBlock(StructBlock): class ProgramBlock(StructBlock):
categories = ListBlock(ProgramCategoryBlock(), label="Kategorie") categories = ListBlock(ProgramCategoryBlock(), label="Kategorie")
long_version_url = URLBlock(label="Odkaz na celou verzi programu") long_version_url = URLBlock(
long_version_text = CharBlock(label="Nadpis odkazu na celou verzi programu") label="Odkaz na celou verzi programu",
help_text="Pro zobrazení odkazu na celou verzi programu musí být obě následující pole vyplněná.",
required=False,
)
long_version_text = CharBlock(
label="Nadpis odkazu na celou verzi programu", required=False
)
class Meta: class Meta:
icon = "form" icon = "form"
......
# Generated by Django 4.1.10 on 2024-01-18 08:36
import wagtail.blocks
import wagtail.fields
import wagtail.images.blocks
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("elections", "0007_alter_electionshomepage_content"),
]
operations = [
migrations.AlterField(
model_name="electionshomepage",
name="content",
field=wagtail.fields.StreamField(
[
(
"carousel",
wagtail.blocks.StructBlock(
[
(
"image",
wagtail.images.blocks.ImageChooserBlock(
label="Obrázek na pozadí"
),
)
]
),
),
(
"candidates",
wagtail.blocks.StructBlock(
[
(
"candidates",
wagtail.blocks.ListBlock(
wagtail.blocks.StructBlock(
[
(
"page",
wagtail.blocks.PageChooserBlock(
label="Stránka",
page_type=[
"elections.ElectionsCandidatePage"
],
),
),
(
"image",
wagtail.images.blocks.ImageChooserBlock(
help_text="Pokud není vybrán, použije se obrázek ze stránky kandidáta",
label="Obrázek",
required=False,
),
),
(
"description",
wagtail.blocks.TextBlock(
label="Popis"
),
),
]
),
label="Kandidáti",
),
)
]
),
),
(
"secondary_candidates",
wagtail.blocks.StructBlock(
[
("heading", wagtail.blocks.CharBlock(label="Nadpis")),
(
"candidates",
wagtail.blocks.ListBlock(
wagtail.blocks.StructBlock(
[
(
"number",
wagtail.blocks.CharBlock(
label="Číslo"
),
),
(
"page",
wagtail.blocks.PageChooserBlock(
label="Stránka",
page_type=[
"elections.ElectionsCandidatePage"
],
),
),
(
"image",
wagtail.images.blocks.ImageChooserBlock(
help_text="Pokud není vybrán, použije se obrázek ze stránky kandidáta",
label="Obrázek",
required=False,
),
),
]
),
label="Kandidáti",
),
),
]
),
),
(
"program",
wagtail.blocks.StructBlock(
[
(
"categories",
wagtail.blocks.ListBlock(
wagtail.blocks.StructBlock(
[
(
"number",
wagtail.blocks.IntegerBlock(
label="Číslo"
),
),
(
"name",
wagtail.blocks.CharBlock(
label="Název"
),
),
(
"points",
wagtail.blocks.ListBlock(
wagtail.blocks.StructBlock(
[
(
"number",
wagtail.blocks.IntegerBlock(
label="Číslo"
),
),
(
"content",
wagtail.blocks.TextBlock(
label="Obsah"
),
),
]
),
label="Body",
),
),
]
),
label="Kategorie",
),
),
(
"long_version_url",
wagtail.blocks.URLBlock(
label="Odkaz na celou verzi programu",
required=False,
),
),
(
"long_version_text",
wagtail.blocks.CharBlock(
label="Nadpis odkazu na celou verzi programu",
required=False,
),
),
]
),
),
(
"news",
wagtail.blocks.StructBlock(
[
(
"title",
wagtail.blocks.CharBlock(
help_text="Nejnovější články se načtou automaticky",
label="Titulek",
),
),
(
"description",
wagtail.blocks.TextBlock(label="Popis"),
),
],
template="styleguide2/includes/organisms/articles/elections/articles_section.html",
),
),
],
blank=True,
use_json_field=True,
verbose_name="Hlavní obsah",
),
),
]
...@@ -97,7 +97,7 @@ class ArticleDownloadBlock(StructBlock): ...@@ -97,7 +97,7 @@ class ArticleDownloadBlock(StructBlock):
class Meta: class Meta:
icon = "user" icon = "user"
label = "Blok stáhnutelného dokumentu" label = "Blok stáhnutelného dokumentu"
template = "styleguide2/includes/molecules/blocks/article_download_block.html" template = "styleguide2/includes/molecules/blocks/download_block.html"
# People # People
......
...@@ -27,9 +27,9 @@ class LatestArticlesFeed(Feed): ...@@ -27,9 +27,9 @@ class LatestArticlesFeed(Feed):
def items(self, obj) -> list: def items(self, obj) -> list:
return obj.materialize_shared_articles_query( return obj.materialize_shared_articles_query(
obj.append_all_shared_articles_query(MainArticlePage.objects.child_of(obj))[ obj.append_all_shared_articles_query(
:32 self.article_page_model.objects.child_of(obj)
] )[:32]
) )
def item_title(self, item) -> str: def item_title(self, item) -> str:
......
...@@ -365,7 +365,9 @@ class MainHomePageMixin( ...@@ -365,7 +365,9 @@ class MainHomePageMixin(
def view_feed(self, request): def view_feed(self, request):
from shared.feeds import LatestArticlesFeed # noqa from shared.feeds import LatestArticlesFeed # noqa
return LatestArticlesFeed()(request, self.articles_page.id) return LatestArticlesFeed(self.articles_page_model, self.article_page_model)(
request, self.articles_page.id
)
def _first_subpage_of_type(self, page_type) -> Page or None: def _first_subpage_of_type(self, page_type) -> Page or None:
try: try:
......
This diff is collapsed.
This diff is collapsed.
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
" "
></ui-card-program> ></ui-card-program>
{% if self.long_version_url and self.long_version_text %}
<!-- Make this accessible without JS, at least --> <!-- Make this accessible without JS, at least -->
<a <a
class="text-xl font-bold pl-4" class="text-xl font-bold pl-4"
...@@ -35,5 +36,6 @@ ...@@ -35,5 +36,6 @@
<i class="ico--chevron-right"></i> <i class="ico--chevron-right"></i>
{{ self.long_version_text }} {{ self.long_version_text }}
</a> </a>
{% endif %}
</div> </div>
</div> </div>
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
{% block position %} {% block position %}
<p <p
class=" class="
font-bold mt-[-0.5rem] mb-6 font-bold text-lg mt-[-0.5rem] mb-6
lg:mt-[-1rem] lg:mt-[-1rem]
" "
> >
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment