diff --git a/main/blocks.py b/main/blocks.py index 539ab8e558f4c14f11a322f5acb650bc66ad7c23..1203b03910d24e2788f70c560a01d3dc780b9b0e 100644 --- a/main/blocks.py +++ b/main/blocks.py @@ -18,8 +18,8 @@ class CTAMixin(StructBlock): class BoxBlock(CTAMixin, StructBlock): - image = ImageChooserBlock(label="Logo/obrázek") title = CharBlock(label="Nadpis") + image = ImageChooserBlock(label="Logo/obrázek") class BoxesBlock(StructBlock): @@ -71,8 +71,9 @@ class PeopleGroupBlock(StructBlock): return value -class PeopleOverviewBlock(StructBlock): # TODO asi jako BoxesBlock - title = CharBlock(label="Titulek") +class PeopleOverviewBlock(StructBlock): + title = CharBlock(label="Hlavní titulek") + list = ListBlock(BoxBlock, label="Boxíky") class Meta: template = "main/blocks/people_overview_block.html" diff --git a/main/migrations/0020_alter_mainhomepage_content.py b/main/migrations/0020_alter_mainhomepage_content.py new file mode 100644 index 0000000000000000000000000000000000000000..5c3ffe1d1b90fb715c32a24ed412c65b28e0174b --- /dev/null +++ b/main/migrations/0020_alter_mainhomepage_content.py @@ -0,0 +1,21 @@ +# Generated by Django 4.0.7 on 2022-08-25 04:46 + +from django.db import migrations +import main.blocks +import wagtail.blocks +import wagtail.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('main', '0019_alter_maincontactpage_text'), + ] + + operations = [ + migrations.AlterField( + model_name='mainhomepage', + name='content', + field=wagtail.fields.StreamField([('carousel', wagtail.blocks.StructBlock([('slides', wagtail.blocks.ListBlock(main.blocks.HomePageCarouseSlideBlock, label='Obrázky s nadpisy - carouselu'))])), ('news', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock(help_text='Nejnovější články se načtou automaticky', label='Titulek'))])), ('people', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock(label='Hlavní titulek')), ('list', wagtail.blocks.ListBlock(main.blocks.BoxBlock, label='Boxíky'))])), ('regions', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock(help_text='Články pro regiony se načtou automaticky', label='Titulek'))])), ('tweets', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock(help_text='Tweety budou načteny pro všchny profily uvedené v nastavení webu automaticky', label='Titulek'))])), ('boxes', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock(label='Nadpis')), ('list', wagtail.blocks.ListBlock(main.blocks.BoxBlock, label='Boxíky'))]))], blank=True, use_json_field=None, verbose_name='Hlavní obsah'), + ), + ] diff --git a/main/templates/main/blocks/people_overview_block.html b/main/templates/main/blocks/people_overview_block.html index 57ed0ac08e4a3edfa36ceb529e840ea87b657f86..0ff278e70339e8737f55adb8cfa16c97f113043b 100644 --- a/main/templates/main/blocks/people_overview_block.html +++ b/main/templates/main/blocks/people_overview_block.html @@ -1,15 +1,18 @@ +{% load wagtailimages_tags %} + <div class="container--medium mb-8 lg:mb-16"> <h2 class="head-7xl text-center mb-6 xl:mb-28"> {{ self.title }} </h2> <div class="flex flex-wrap space-x-1 justify-center items-center"> - {% for box in '1234' %}{# TODO #} + {% for box in self.list %} + {% image box.image fill-500x500 as box_image %} <div class="w-full max-w-xs mb-1 w-80 h-80 flex flex-col items-center justify-center" - style="background-image: url('https://i.picsum.photos/id/261/350/350.jpg?hmac=GOGR4Va2TTfzr3sxRHwTlAxqhpu4M_pl_oKex2O7fcQ')"> + style="background-image: url('{{ box_image.url }}')"> <h5 class="head-alt-md text-white mt-24 mb-8"> - poslanci za piráty + {{ box.title }} </h5> - {% include 'main/includes/button_animated.html' with btn_text="Poslanci" %} + {% include 'main/includes/button_animated.html' with btn_text=box.button_text btn_link=box.button_link %} </div> {% endfor %} </div>