From 140373ac16d3c5a26ea331df1827189ea4880f6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Bedna=C5=99=C3=ADk?= <jan.bednarik@gmail.com> Date: Thu, 26 Nov 2020 15:27:32 +0100 Subject: [PATCH] uniweb: Narrow layout --- uniweb/migrations/0009_auto_20201126_1505.py | 783 ++++++++++++++++++ uniweb/models.py | 13 +- uniweb/templates/uniweb/base.html | 4 +- uniweb/templates/uniweb/blocks/gallery.html | 2 +- .../uniweb/blocks/picture_title.html | 2 +- 5 files changed, 799 insertions(+), 5 deletions(-) create mode 100644 uniweb/migrations/0009_auto_20201126_1505.py diff --git a/uniweb/migrations/0009_auto_20201126_1505.py b/uniweb/migrations/0009_auto_20201126_1505.py new file mode 100644 index 00000000..067d2aa1 --- /dev/null +++ b/uniweb/migrations/0009_auto_20201126_1505.py @@ -0,0 +1,783 @@ +# Generated by Django 3.1.3 on 2020-11-26 14:05 + +import wagtail.contrib.table_block.blocks +import wagtail.core.blocks +import wagtail.core.fields +import wagtail.documents.blocks +import wagtail.images.blocks +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("uniweb", "0008_auto_20200916_1151"), + ] + + operations = [ + migrations.AddField( + model_name="uniwebhomepage", + name="narrow_layout", + field=models.BooleanField( + default=False, + help_text="užšà stránka je vhodná pro lepšà čitelnost textĹŻ", + verbose_name="zúženĂ˝ obsah stránky", + ), + ), + migrations.AlterField( + model_name="uniwebflexiblepage", + name="content", + field=wagtail.core.fields.StreamField( + [ + ( + "title", + wagtail.core.blocks.CharBlock( + group="nadpisy", + icon="title", + label="nadpis", + template="uniweb/blocks/title.html", + ), + ), + ( + "advanced_title", + wagtail.core.blocks.StructBlock( + [ + ( + "align", + wagtail.core.blocks.ChoiceBlock( + choices=[ + ("left", "vlevo"), + ("center", "uprostĹ™ed"), + ("right", "vpravo"), + ], + label="zarovnánĂ", + ), + ), + ( + "color", + wagtail.core.blocks.ChoiceBlock( + choices=[ + ("black_on_white", "ÄŤerná na bĂlĂ©"), + ("white_on_black", "bĂlá na ÄŤernĂ©"), + ("white_on_blue", "bĂlá na modrĂ©"), + ("white_on_cyan", "bĂlá na tyrkysovĂ©"), + ("white_on_violet", "bĂlá na fialovĂ©"), + ], + label="barva", + ), + ), + ( + "title", + wagtail.core.blocks.CharBlock(label="nadpis"), + ), + ] + ), + ), + ( + "picture_title", + wagtail.core.blocks.StructBlock( + [ + ( + "color", + wagtail.core.blocks.ChoiceBlock( + choices=[ + ("black_on_white", "ÄŤerná na bĂlĂ©"), + ("white_on_black", "bĂlá na ÄŤernĂ©"), + ("white_on_blue", "bĂlá na modrĂ©"), + ("white_on_cyan", "bĂlá na tyrkysovĂ©"), + ("white_on_violet", "bĂlá na fialovĂ©"), + ], + label="barva", + ), + ), + ( + "title", + wagtail.core.blocks.CharBlock(label="nadpis"), + ), + ( + "picture", + wagtail.images.blocks.ImageChooserBlock( + help_text="rozmÄ›r na výšku 75px nebo vĂce (obrázek bude zmenšen na výšku 75px)", + label="obrázek", + ), + ), + ] + ), + ), + ( + "text", + wagtail.core.blocks.RichTextBlock( + features=[ + "h2", + "h3", + "h4", + "h5", + "bold", + "italic", + "ol", + "ul", + "hr", + "link", + "document-link", + "image", + "superscript", + "subscript", + "strikethrough", + "blockquote", + ], + group="texty", + label="text", + template="uniweb/blocks/text.html", + ), + ), + ( + "advanced_text", + wagtail.core.blocks.StructBlock( + [ + ( + "align", + wagtail.core.blocks.ChoiceBlock( + choices=[ + ("left", "vlevo"), + ("center", "uprostĹ™ed"), + ("right", "vpravo"), + ], + label="zarovnánĂ", + ), + ), + ( + "color", + wagtail.core.blocks.ChoiceBlock( + choices=[ + ("black_on_white", "ÄŤerná na bĂlĂ©"), + ("white_on_black", "bĂlá na ÄŤernĂ©"), + ("white_on_blue", "bĂlá na modrĂ©"), + ("white_on_cyan", "bĂlá na tyrkysovĂ©"), + ("white_on_violet", "bĂlá na fialovĂ©"), + ], + label="barva", + ), + ), + ( + "text", + wagtail.core.blocks.RichTextBlock( + features=[ + "h2", + "h3", + "h4", + "h5", + "bold", + "italic", + "ol", + "ul", + "hr", + "link", + "document-link", + "image", + "superscript", + "subscript", + "strikethrough", + "blockquote", + ], + label="text", + ), + ), + ] + ), + ), + ( + "text_columns", + wagtail.core.blocks.StructBlock( + [ + ( + "left_text", + wagtail.core.blocks.RichTextBlock( + features=[ + "h2", + "h3", + "h4", + "h5", + "bold", + "italic", + "ol", + "ul", + "hr", + "link", + "document-link", + "image", + "superscript", + "subscript", + "strikethrough", + "blockquote", + ], + label="levĂ˝ sloupec", + ), + ), + ( + "right_text", + wagtail.core.blocks.RichTextBlock( + features=[ + "h2", + "h3", + "h4", + "h5", + "bold", + "italic", + "ol", + "ul", + "hr", + "link", + "document-link", + "image", + "superscript", + "subscript", + "strikethrough", + "blockquote", + ], + label="pravĂ˝ sloupec", + ), + ), + ] + ), + ), + ( + "advanced_text_columns", + wagtail.core.blocks.StructBlock( + [ + ( + "align", + wagtail.core.blocks.ChoiceBlock( + choices=[ + ("left", "vlevo"), + ("center", "uprostĹ™ed"), + ("right", "vpravo"), + ], + label="zarovnánĂ", + ), + ), + ( + "color", + wagtail.core.blocks.ChoiceBlock( + choices=[ + ("black_on_white", "ÄŤerná na bĂlĂ©"), + ("white_on_black", "bĂlá na ÄŤernĂ©"), + ("white_on_blue", "bĂlá na modrĂ©"), + ("white_on_cyan", "bĂlá na tyrkysovĂ©"), + ("white_on_violet", "bĂlá na fialovĂ©"), + ], + label="barva", + ), + ), + ( + "left_text", + wagtail.core.blocks.RichTextBlock( + features=[ + "h2", + "h3", + "h4", + "h5", + "bold", + "italic", + "ol", + "ul", + "hr", + "link", + "document-link", + "image", + "superscript", + "subscript", + "strikethrough", + "blockquote", + ], + label="levĂ˝ sloupec", + ), + ), + ( + "right_text", + wagtail.core.blocks.RichTextBlock( + features=[ + "h2", + "h3", + "h4", + "h5", + "bold", + "italic", + "ol", + "ul", + "hr", + "link", + "document-link", + "image", + "superscript", + "subscript", + "strikethrough", + "blockquote", + ], + label="pravĂ˝ sloupec", + ), + ), + ] + ), + ), + ( + "gallery", + wagtail.core.blocks.ListBlock( + wagtail.images.blocks.ImageChooserBlock(label="obrázek"), + group="ostatnĂ", + icon="image", + label="galerie", + template="uniweb/blocks/gallery.html", + ), + ), + ( + "picture_list", + wagtail.core.blocks.StructBlock( + [ + ( + "color", + wagtail.core.blocks.ChoiceBlock( + choices=[ + ("black_on_white", "ÄŤerná na bĂlĂ©"), + ("white_on_black", "bĂlá na ÄŤernĂ©"), + ("white_on_blue", "bĂlá na modrĂ©"), + ("white_on_cyan", "bĂlá na tyrkysovĂ©"), + ("white_on_violet", "bĂlá na fialovĂ©"), + ], + label="barva", + ), + ), + ( + "items", + wagtail.core.blocks.ListBlock( + wagtail.core.blocks.RichTextBlock( + features=[ + "h2", + "h3", + "h4", + "h5", + "bold", + "italic", + "ol", + "ul", + "hr", + "link", + "document-link", + "image", + "superscript", + "subscript", + "strikethrough", + "blockquote", + ], + label="odstavec", + ), + label="odstavce", + ), + ), + ( + "picture", + wagtail.images.blocks.ImageChooserBlock( + help_text="rozmÄ›r 25x25px nebo vĂce (obrázek bude zmenšen na 25x25px)", + label="obrázek", + ), + ), + ] + ), + ), + ( + "table", + wagtail.contrib.table_block.blocks.TableBlock( + group="ostatnĂ", + label="tabulka", + template="uniweb/blocks/table.html", + ), + ), + ( + "jupyter", + wagtail.documents.blocks.DocumentChooserBlock( + group="ostatnĂ", label="Jupyter notebook" + ), + ), + ], + blank=True, + verbose_name="obsah stránky", + ), + ), + migrations.AlterField( + model_name="uniwebhomepage", + name="content", + field=wagtail.core.fields.StreamField( + [ + ( + "title", + wagtail.core.blocks.CharBlock( + group="nadpisy", + icon="title", + label="nadpis", + template="uniweb/blocks/title.html", + ), + ), + ( + "advanced_title", + wagtail.core.blocks.StructBlock( + [ + ( + "align", + wagtail.core.blocks.ChoiceBlock( + choices=[ + ("left", "vlevo"), + ("center", "uprostĹ™ed"), + ("right", "vpravo"), + ], + label="zarovnánĂ", + ), + ), + ( + "color", + wagtail.core.blocks.ChoiceBlock( + choices=[ + ("black_on_white", "ÄŤerná na bĂlĂ©"), + ("white_on_black", "bĂlá na ÄŤernĂ©"), + ("white_on_blue", "bĂlá na modrĂ©"), + ("white_on_cyan", "bĂlá na tyrkysovĂ©"), + ("white_on_violet", "bĂlá na fialovĂ©"), + ], + label="barva", + ), + ), + ( + "title", + wagtail.core.blocks.CharBlock(label="nadpis"), + ), + ] + ), + ), + ( + "picture_title", + wagtail.core.blocks.StructBlock( + [ + ( + "color", + wagtail.core.blocks.ChoiceBlock( + choices=[ + ("black_on_white", "ÄŤerná na bĂlĂ©"), + ("white_on_black", "bĂlá na ÄŤernĂ©"), + ("white_on_blue", "bĂlá na modrĂ©"), + ("white_on_cyan", "bĂlá na tyrkysovĂ©"), + ("white_on_violet", "bĂlá na fialovĂ©"), + ], + label="barva", + ), + ), + ( + "title", + wagtail.core.blocks.CharBlock(label="nadpis"), + ), + ( + "picture", + wagtail.images.blocks.ImageChooserBlock( + help_text="rozmÄ›r na výšku 75px nebo vĂce (obrázek bude zmenšen na výšku 75px)", + label="obrázek", + ), + ), + ] + ), + ), + ( + "text", + wagtail.core.blocks.RichTextBlock( + features=[ + "h2", + "h3", + "h4", + "h5", + "bold", + "italic", + "ol", + "ul", + "hr", + "link", + "document-link", + "image", + "superscript", + "subscript", + "strikethrough", + "blockquote", + ], + group="texty", + label="text", + template="uniweb/blocks/text.html", + ), + ), + ( + "advanced_text", + wagtail.core.blocks.StructBlock( + [ + ( + "align", + wagtail.core.blocks.ChoiceBlock( + choices=[ + ("left", "vlevo"), + ("center", "uprostĹ™ed"), + ("right", "vpravo"), + ], + label="zarovnánĂ", + ), + ), + ( + "color", + wagtail.core.blocks.ChoiceBlock( + choices=[ + ("black_on_white", "ÄŤerná na bĂlĂ©"), + ("white_on_black", "bĂlá na ÄŤernĂ©"), + ("white_on_blue", "bĂlá na modrĂ©"), + ("white_on_cyan", "bĂlá na tyrkysovĂ©"), + ("white_on_violet", "bĂlá na fialovĂ©"), + ], + label="barva", + ), + ), + ( + "text", + wagtail.core.blocks.RichTextBlock( + features=[ + "h2", + "h3", + "h4", + "h5", + "bold", + "italic", + "ol", + "ul", + "hr", + "link", + "document-link", + "image", + "superscript", + "subscript", + "strikethrough", + "blockquote", + ], + label="text", + ), + ), + ] + ), + ), + ( + "text_columns", + wagtail.core.blocks.StructBlock( + [ + ( + "left_text", + wagtail.core.blocks.RichTextBlock( + features=[ + "h2", + "h3", + "h4", + "h5", + "bold", + "italic", + "ol", + "ul", + "hr", + "link", + "document-link", + "image", + "superscript", + "subscript", + "strikethrough", + "blockquote", + ], + label="levĂ˝ sloupec", + ), + ), + ( + "right_text", + wagtail.core.blocks.RichTextBlock( + features=[ + "h2", + "h3", + "h4", + "h5", + "bold", + "italic", + "ol", + "ul", + "hr", + "link", + "document-link", + "image", + "superscript", + "subscript", + "strikethrough", + "blockquote", + ], + label="pravĂ˝ sloupec", + ), + ), + ] + ), + ), + ( + "advanced_text_columns", + wagtail.core.blocks.StructBlock( + [ + ( + "align", + wagtail.core.blocks.ChoiceBlock( + choices=[ + ("left", "vlevo"), + ("center", "uprostĹ™ed"), + ("right", "vpravo"), + ], + label="zarovnánĂ", + ), + ), + ( + "color", + wagtail.core.blocks.ChoiceBlock( + choices=[ + ("black_on_white", "ÄŤerná na bĂlĂ©"), + ("white_on_black", "bĂlá na ÄŤernĂ©"), + ("white_on_blue", "bĂlá na modrĂ©"), + ("white_on_cyan", "bĂlá na tyrkysovĂ©"), + ("white_on_violet", "bĂlá na fialovĂ©"), + ], + label="barva", + ), + ), + ( + "left_text", + wagtail.core.blocks.RichTextBlock( + features=[ + "h2", + "h3", + "h4", + "h5", + "bold", + "italic", + "ol", + "ul", + "hr", + "link", + "document-link", + "image", + "superscript", + "subscript", + "strikethrough", + "blockquote", + ], + label="levĂ˝ sloupec", + ), + ), + ( + "right_text", + wagtail.core.blocks.RichTextBlock( + features=[ + "h2", + "h3", + "h4", + "h5", + "bold", + "italic", + "ol", + "ul", + "hr", + "link", + "document-link", + "image", + "superscript", + "subscript", + "strikethrough", + "blockquote", + ], + label="pravĂ˝ sloupec", + ), + ), + ] + ), + ), + ( + "gallery", + wagtail.core.blocks.ListBlock( + wagtail.images.blocks.ImageChooserBlock(label="obrázek"), + group="ostatnĂ", + icon="image", + label="galerie", + template="uniweb/blocks/gallery.html", + ), + ), + ( + "picture_list", + wagtail.core.blocks.StructBlock( + [ + ( + "color", + wagtail.core.blocks.ChoiceBlock( + choices=[ + ("black_on_white", "ÄŤerná na bĂlĂ©"), + ("white_on_black", "bĂlá na ÄŤernĂ©"), + ("white_on_blue", "bĂlá na modrĂ©"), + ("white_on_cyan", "bĂlá na tyrkysovĂ©"), + ("white_on_violet", "bĂlá na fialovĂ©"), + ], + label="barva", + ), + ), + ( + "items", + wagtail.core.blocks.ListBlock( + wagtail.core.blocks.RichTextBlock( + features=[ + "h2", + "h3", + "h4", + "h5", + "bold", + "italic", + "ol", + "ul", + "hr", + "link", + "document-link", + "image", + "superscript", + "subscript", + "strikethrough", + "blockquote", + ], + label="odstavec", + ), + label="odstavce", + ), + ), + ( + "picture", + wagtail.images.blocks.ImageChooserBlock( + help_text="rozmÄ›r 25x25px nebo vĂce (obrázek bude zmenšen na 25x25px)", + label="obrázek", + ), + ), + ] + ), + ), + ( + "table", + wagtail.contrib.table_block.blocks.TableBlock( + group="ostatnĂ", + label="tabulka", + template="uniweb/blocks/table.html", + ), + ), + ( + "jupyter", + wagtail.documents.blocks.DocumentChooserBlock( + group="ostatnĂ", label="Jupyter notebook" + ), + ), + ], + blank=True, + verbose_name="obsah stránky", + ), + ), + ] diff --git a/uniweb/models.py b/uniweb/models.py index 267201a2..73e9f53c 100644 --- a/uniweb/models.py +++ b/uniweb/models.py @@ -233,6 +233,11 @@ class UniwebHomePage(Page, UniwebContentMixin, MetadataPageMixin): verbose_name="hornĂ menu", blank=True, ) + narrow_layout = models.BooleanField( + "zúženĂ˝ obsah stránky", + default=False, + help_text="užšà stránka je vhodná pro lepšà čitelnost textĹŻ", + ) ### PANELS @@ -253,7 +258,13 @@ class UniwebHomePage(Page, UniwebContentMixin, MetadataPageMixin): ] settings_panels = [ - FieldPanel("matomo_id"), + MultiFieldPanel( + [ + FieldPanel("matomo_id"), + FieldPanel("narrow_layout"), + ], + "nastavenĂ webu", + ), StreamFieldPanel("top_menu"), ] diff --git a/uniweb/templates/uniweb/base.html b/uniweb/templates/uniweb/base.html index e718e0e9..d8bd8508 100644 --- a/uniweb/templates/uniweb/base.html +++ b/uniweb/templates/uniweb/base.html @@ -47,7 +47,7 @@ <ui-app inline-template> <ui-navbar inline-template> <div> - <div class="container container--wide navbar__content max-w-screen-xl" :class="{'navbar__content--initialized': true}"> + <div class="container container--default navbar__content" :class="{'navbar__content--initialized': true}"> <div class="navbar__brand my-4 flex items-center lg:pr-8 lg:my-0"> <a href="/"> <img src="{% static "styleguide18/assets/images/logo-round-white.svg" %}" class="w-8" /> @@ -76,7 +76,7 @@ </ui-app> </nav> - <div class="container container--default lg:py-4"> + <div class="container container--default {% if page.root_page.narrow_layout %}max-w-screen-lg{% endif%} lg:py-4"> {% block content %}{% endblock %} </div> diff --git a/uniweb/templates/uniweb/blocks/gallery.html b/uniweb/templates/uniweb/blocks/gallery.html index 3cf2f1ac..84fe4d69 100644 --- a/uniweb/templates/uniweb/blocks/gallery.html +++ b/uniweb/templates/uniweb/blocks/gallery.html @@ -1,5 +1,5 @@ {% load wagtailimages_tags %} -<div class="content-block w-full my-6 grid grid-cols-4 gap-4{% if first %} mt-8 lg:mt-12{% endif %}"> +<div class="content-block w-full px-4 my-6 grid grid-cols-4 gap-4{% if first %} mt-8 lg:mt-12{% endif %}"> {% for picture in block.value %} {% image picture width-2000 as img %} {% image picture fill-300x200 as thumb %} diff --git a/uniweb/templates/uniweb/blocks/picture_title.html b/uniweb/templates/uniweb/blocks/picture_title.html index 863e5ef8..ef3b4f63 100644 --- a/uniweb/templates/uniweb/blocks/picture_title.html +++ b/uniweb/templates/uniweb/blocks/picture_title.html @@ -1,5 +1,5 @@ {% load wagtailimages_tags %} <h1 class="head-alt-md md:head-alt-lg px-4 pt-4 pb-2 lg:mt-16 clearfix {{ css_class|join:" " }}"> - {% image block.value.picture height-75 class="float-right mb-2" %} + {% image block.value.picture height-75 class="float-right mb-2 ml-2" %} {{ block.value.title }} </h1> -- GitLab