diff --git a/district/blocks.py b/district/blocks.py index 950a948841ce8b581cfc187553e507d2c28fddb9..7be87e526faf9e92144ae9bbe7d464f66449f166 100644 --- a/district/blocks.py +++ b/district/blocks.py @@ -1,5 +1,4 @@ from django.forms import Select -from wagtail.contrib.table_block.blocks import TableBlock from wagtail.core.blocks import ( CharBlock, ChooserBlock, @@ -46,7 +45,7 @@ class ProgramItemBlock(StructBlock): class ProgramBlock(StructBlock): headline = CharBlock(label="Titulek bloku", required=True) perex = TextBlock(label="Krátký text pod nadpisem", required=True) - person = PersonChooserBlock(label="Osoba", required=True) + person = PersonChooserBlock(label="Osoba", required=True) # TODO Page chooser block should suffice completion_percentage = IntegerBlock(label="Procento dokončení", required=True) program_items = ListBlock(ProgramItemBlock()) # program_items = TableBlock(label="Tabulka plnění programu", required=True) diff --git a/district/templates/district/blocks/homepage_header_block.html b/district/templates/district/blocks/homepage_header_block.html index bf9c6076674ffa1f44808f4b924589f063af10e7..c6aed45f38f5b3ea728101a0f30f0c378972a8dc 100644 --- a/district/templates/district/blocks/homepage_header_block.html +++ b/district/templates/district/blocks/homepage_header_block.html @@ -1,13 +1,16 @@ +{% load wagtailimages_tags %} + +{% image self.image width-1920 as img %} <header class="hero hero--image py-16 " - style="--image-url: url(https://praha8.pirati.cz/assets/posts/libensky-zamek-c76ce3fd0a7d061e15025fbb7080f4dbd12fab3daebdcbd42d2ab6b1cdbaa2f0.jpg)" + style="--image-url: url({{ img.url }})" > <div class="container container--default"> <h1 class="head-alt-md md:head-alt-lg max-w-2xl "> - Piráti Praha 8 + {{ self.title }} </h1> <h2 class="head-xs mt-2 "> - Makáme v opozici. Držíme směr! + {{ self.subtitle }} </h2> </div> </header> diff --git a/region/blocks.py b/region/blocks.py new file mode 100644 index 0000000000000000000000000000000000000000..117fe9171ba5674babb82a731fad6babdc4ca44e --- /dev/null +++ b/region/blocks.py @@ -0,0 +1,18 @@ +from wagtail.core.blocks import ( + CharBlock, + StructBlock, + URLBlock, +) +from wagtail.images.blocks import ImageChooserBlock + + +class HomepageHeaderBlock(StructBlock): + title = CharBlock(label="Titulek", required=True) + image = ImageChooserBlock() + button_text = CharBlock(label="Titulek", required=False) + button_link = URLBlock(label="Odkaz tlačítka", required=False) + + class Meta: + template = "region/blocks/homepage_header_block.html" + icon = "image" + label = "Nadpis s obrázkem" diff --git a/region/models.py b/region/models.py index 81ed0d9f3e8a179250a568773b0025f3b98a02ff..e781bffd45d5b8049f70e5cefa918cbffa183d9e 100644 --- a/region/models.py +++ b/region/models.py @@ -182,6 +182,7 @@ class RegionArticlePage(ArticleMixin, SubpageMixin, MetadataPageMixin, Page): class RegionArticlesPage(SubpageMixin, MetadataPageMixin, Page): + # TODO this page is very similar to DistrictArticletPage and seem to remain so ### FIELDS max_items = models.IntegerField("Počet článků na stránce", default=12) @@ -214,6 +215,7 @@ class RegionArticlesPage(SubpageMixin, MetadataPageMixin, Page): class RegionContactPage(SubpageMixin, MetadataPageMixin, Page): + # TODO this page is exactly as DistrictContactPage and seem to remain so class ContactItemBlock(blocks.StructBlock): name = blocks.CharBlock(label="Role") person = blocks.PageChooserBlock( diff --git a/region/templates/region/blocks/homepage_header_block.html b/region/templates/region/blocks/homepage_header_block.html new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391