From 04fdbd15c99dfffeed9469af5614305dba6ed26d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Bedna=C5=99=C3=ADk?= <jan.bednarik@gmail.com> Date: Fri, 11 Sep 2020 00:22:59 +0200 Subject: [PATCH] uniweb: Text features --- uniweb/migrations/0005_auto_20200911_0050.py | 218 +++++++++++++++++++ uniweb/models.py | 40 +--- 2 files changed, 220 insertions(+), 38 deletions(-) create mode 100644 uniweb/migrations/0005_auto_20200911_0050.py diff --git a/uniweb/migrations/0005_auto_20200911_0050.py b/uniweb/migrations/0005_auto_20200911_0050.py new file mode 100644 index 00000000..48e35e75 --- /dev/null +++ b/uniweb/migrations/0005_auto_20200911_0050.py @@ -0,0 +1,218 @@ +# Generated by Django 3.1.1 on 2020-09-10 22:50 + +import wagtail.core.blocks +import wagtail.core.fields +import wagtail.images.blocks +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ("uniweb", "0004_auto_20200911_0022"), + ] + + operations = [ + migrations.AlterField( + model_name="uniwebflexiblepage", + name="content", + field=wagtail.core.fields.StreamField( + [ + ( + "title", + wagtail.core.blocks.CharBlock(icon="title", label="nadpis"), + ), + ( + "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", + ), + ), + ] + ), + ), + ( + "gallery", + wagtail.core.blocks.ListBlock( + wagtail.images.blocks.ImageChooserBlock(label="obrázek"), + icon="image", + label="galerie", + ), + ), + ], + blank=True, + verbose_name="obsah stránky", + ), + ), + migrations.AlterField( + model_name="uniwebhomepage", + name="content", + field=wagtail.core.fields.StreamField( + [ + ( + "title", + wagtail.core.blocks.CharBlock(icon="title", label="nadpis"), + ), + ( + "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", + ), + ), + ] + ), + ), + ( + "gallery", + wagtail.core.blocks.ListBlock( + wagtail.images.blocks.ImageChooserBlock(label="obrázek"), + icon="image", + label="galerie", + ), + ), + ], + blank=True, + verbose_name="obsah stránky", + ), + ), + ] diff --git a/uniweb/models.py b/uniweb/models.py index 32940e18..427aaacc 100644 --- a/uniweb/models.py +++ b/uniweb/models.py @@ -35,27 +35,6 @@ RICH_TEXT_FEATURES = [ ] -# TODO remove -class TextSectionBlock(blocks.StructBlock): - title = blocks.CharBlock(label="nadpis", required=False) - text = blocks.RichTextBlock(label="text", features=RICH_TEXT_FEATURES) - - class Meta: - label = "(deprecated) textová sekce" - - -# TODO remove -class ColumnsSectionBlock(blocks.StructBlock): - title = blocks.CharBlock(label="nadpis", required=False) - left_text = blocks.RichTextBlock(label="levý sloupec", features=RICH_TEXT_FEATURES) - right_text = blocks.RichTextBlock( - label="pravý sloupec", features=RICH_TEXT_FEATURES - ) - - class Meta: - label = "(deprecated) dvousloupcová textová sekce" - - class ColumnsTextBlock(blocks.StructBlock): left_text = blocks.RichTextBlock(label="levý sloupec", features=RICH_TEXT_FEATURES) right_text = blocks.RichTextBlock( @@ -67,15 +46,6 @@ class ColumnsTextBlock(blocks.StructBlock): icon = "doc-full" -# TODO remove -class GallerySectionBlock(blocks.StructBlock): - title = blocks.CharBlock(label="nadpis", required=False) - images = blocks.ListBlock(ImageChooserBlock(label="obrázek")) - - class Meta: - label = "(deprecated) galerie obrázků" - - class MenuItemBlock(blocks.StructBlock): name = blocks.CharBlock(label="název") page = blocks.PageChooserBlock( @@ -106,7 +76,7 @@ class UniwebHomePage(MetadataPageMixin, Page): content = StreamField( [ ("title", blocks.CharBlock(label="nadpis", icon="title")), - ("text", blocks.RichTextBlock(label="text")), + ("text", blocks.RichTextBlock(label="text", features=RICH_TEXT_FEATURES)), ("text_columns", ColumnsTextBlock()), ( "gallery", @@ -114,9 +84,6 @@ class UniwebHomePage(MetadataPageMixin, Page): ImageChooserBlock(label="obrázek"), label="galerie", icon="image" ), ), - ("text_section", TextSectionBlock()), - ("columns_section", ColumnsSectionBlock()), - ("gallery_section", GallerySectionBlock()), ], verbose_name="obsah stránky", blank=True, @@ -174,7 +141,7 @@ class UniwebFlexiblePage(Page, SubpageMixin, MetadataPageMixin): content = StreamField( [ ("title", blocks.CharBlock(label="nadpis", icon="title")), - ("text", blocks.RichTextBlock(label="text")), + ("text", blocks.RichTextBlock(label="text", features=RICH_TEXT_FEATURES)), ("text_columns", ColumnsTextBlock()), ( "gallery", @@ -182,9 +149,6 @@ class UniwebFlexiblePage(Page, SubpageMixin, MetadataPageMixin): ImageChooserBlock(label="obrázek"), label="galerie", icon="image" ), ), - ("text_section", TextSectionBlock()), - ("columns_section", ColumnsSectionBlock()), - ("gallery_section", GallerySectionBlock()), ], verbose_name="obsah stránky", blank=True, -- GitLab