diff --git a/uniweb/models.py b/uniweb/models.py index 9d86e9c80428e28845e6cbac51a7b08bea1881f9..267201a2d7fc8ad73b2e49304864cece9348f723 100644 --- a/uniweb/models.py +++ b/uniweb/models.py @@ -121,6 +121,24 @@ class AdvancedTextBlock(ColorBlock, AlignBlock): template = "uniweb/blocks/advanced_text.html" +class PictureListBlock(ColorBlock): + items = blocks.ListBlock( + blocks.RichTextBlock(label="odstavec", features=RICH_TEXT_FEATURES), + label="odstavce", + ) + picture = ImageChooserBlock( + label="obrázek", + # TODO rozmÄ›ry v helpu + help_text="rozmÄ›r 25x25px nebo vĂce (obrázek bude zmenšen na 25x25px)", + ) + + class Meta: + label = "seznam z obrázkovĂ˝mi odrážkami" + icon = "list-ul" + group = "texty" + template = "uniweb/blocks/picture_list.html" + + class MenuItemBlock(blocks.StructBlock): name = blocks.CharBlock(label="název") page = blocks.PageChooserBlock( @@ -181,6 +199,7 @@ class UniwebContentMixin(models.Model): template="uniweb/blocks/gallery.html", ), ), + ("picture_list", PictureListBlock()), ( "table", TableBlock( diff --git a/uniweb/templates/uniweb/base.html b/uniweb/templates/uniweb/base.html index cdb254e7edca84518716c33adeb7744a19cbd37f..e718e0e9700188e091968723656d1a9443aa4ce0 100644 --- a/uniweb/templates/uniweb/base.html +++ b/uniweb/templates/uniweb/base.html @@ -25,6 +25,15 @@ .head-alt-md, .head-alt-lg { line-height: 1.25; } + .ul-picture li:before { + content: none !important; + } + .ul-picture li { + background-repeat: no-repeat; + background-position: 0 0; + padding: 0 0 1em 35px !important; + } + </style> {% if page.root_page.matomo_id %} diff --git a/uniweb/templates/uniweb/blocks/picture_list.html b/uniweb/templates/uniweb/blocks/picture_list.html new file mode 100644 index 0000000000000000000000000000000000000000..92b4102ee6e2cd827fcc8c0108e1a34bca86ea2d --- /dev/null +++ b/uniweb/templates/uniweb/blocks/picture_list.html @@ -0,0 +1,9 @@ +{% load wagtailcore_tags wagtailimages_tags %} +{% image block.value.picture max-25x25 as img %} +<div class="content-block px-4 py-2 clearfix{% if first %} mt-8 lg:mt-12{% endif %} {{ css_class|join:" " }}"> + <ul class="ul-picture"> + {% for text in block.value.items %} + <li style="background-image: url('{{ img.url }}');">{{ text|richtext }}</li> + {% endfor %} + </ul> +</div>