From dbb11953017fdf2a2ea0e363a21e90c94cae1627 Mon Sep 17 00:00:00 2001 From: Rachell Calhoun Date: Wed, 3 Apr 2024 17:29:09 -0400 Subject: [PATCH] merge develop (#383) --- home/blocks.py | 37 +-- ...ter_generalpage_content_optional_fields.py | 260 ++++++++++++++++++ ...06_alter_entrypage_body_optional_fields.py | 259 +++++++++++++++++ .../templates/blocks/text-image-heading.html | 8 +- .../blocks/text-with-heading-left-image.html | 2 + .../blocks/text-with-heading-right-image.html | 2 + 6 files changed, 535 insertions(+), 33 deletions(-) create mode 100644 home/migrations/0027_alter_generalpage_content_optional_fields.py create mode 100644 home/puput_migrations/0006_alter_entrypage_body_optional_fields.py diff --git a/home/blocks.py b/home/blocks.py index 9fe4af2..a528f47 100644 --- a/home/blocks.py +++ b/home/blocks.py @@ -81,7 +81,9 @@ class Meta: class TextWithHeadingWithRightImageBlock(blocks.StructBlock): - heading = blocks.CharBlock(max_length=255, class_name="heading-blog") + heading = blocks.CharBlock( + max_length=255, class_name="heading-blog", required=False + ) text = blocks.TextBlock() image = ImageChooserBlock() @@ -94,7 +96,7 @@ class Meta: class TextWithHeadingWithLeftImageBlock(blocks.StructBlock): - heading = blocks.CharBlock(max_length=255, class_name="blog") + heading = blocks.CharBlock(max_length=255, class_name="blog", required=False) text = blocks.TextBlock() image = ImageChooserBlock() @@ -106,30 +108,6 @@ class Meta: template = "blocks/text-with-heading-left-image.html" -class RightImageLeftTextBlock(blocks.StructBlock): - image = ImageChooserBlock() - text = blocks.TextBlock() - - def __str__(self): - return self.text - - class Meta: - label = "Text Block: Right Image" - template = "blocks/right-image-left-text.html" - - -class LeftImageRightTextBlock(blocks.StructBlock): - image = ImageChooserBlock() - text = blocks.TextBlock() - - def __str__(self): - return self.text - - class Meta: - label = "Text Block: Left Image" - template = "blocks/left-image-right-text.html" - - class QuoteBlock(blocks.StructBlock): text = blocks.CharBlock(max_length=255) attribution = blocks.CharBlock(max_length=255) @@ -184,10 +162,9 @@ class Meta: class TextHeadingImageBlock(blocks.StructBlock): - heading = blocks.CharBlock(max_length=255) - text = blocks.TextBlock() + heading = blocks.CharBlock(max_length=255, required=False) + text = blocks.TextBlock(required=False) image = ImageChooserBlock() - # TODO: Add left or right side def __str__(self): return self.heading @@ -243,8 +220,6 @@ class BaseStreamBlock(blocks.StreamBlock): text_with_heading_and_image = TextHeadingImageBlock() text_with_heading_and_right_image = TextWithHeadingWithRightImageBlock() text_with_heading_and_left_image = TextWithHeadingWithLeftImageBlock() - right_image_left_text = RightImageLeftTextBlock() - left_image_right_text = LeftImageRightTextBlock() left_quote_right_image = QuoteLeftImageBlock(icon="openquote") video_embed = VideoEmbed() table = CustomTableBlock() diff --git a/home/migrations/0027_alter_generalpage_content_optional_fields.py b/home/migrations/0027_alter_generalpage_content_optional_fields.py new file mode 100644 index 0000000..792ac1d --- /dev/null +++ b/home/migrations/0027_alter_generalpage_content_optional_fields.py @@ -0,0 +1,260 @@ +# Generated by Django 4.1.13 on 2024-04-03 17:07 +from __future__ import annotations + +import wagtail.blocks +import wagtail.fields +import wagtail.images.blocks +from django.db import migrations + +import home.blocks + + +class Migration(migrations.Migration): + dependencies = [ + ("home", "0026_session_application_survey_and_more"), + ] + + operations = [ + migrations.AlterField( + model_name="generalpage", + name="content", + field=wagtail.fields.StreamField( + [ + ( + "heading", + wagtail.blocks.StructBlock( + [ + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("text-5xl", "h1"), + ("text-4xl", "h2"), + ("text-3xl", "h3"), + ("text-2xl", "h4"), + ("text-xl", "h5"), + ("text-lg", "h6"), + ], + icon="title", + ), + ), + ( + "heading", + wagtail.blocks.CharBlock( + class_name="heading-blog", max_length=255 + ), + ), + ], + icon="h1", + label="Heading", + ), + ), + ( + "rich_text", + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.RichTextBlock( + features=[ + "embed", + "bold", + "italic", + "link", + "superscript", + "subscript", + "strikethrough", + "code", + "hr", + ], + icon="title", + label="Rich Text", + max_length=10000, + ), + ) + ] + ), + ), + ( + "list", + wagtail.blocks.StructBlock( + [ + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("circle", "unordered list"), + ("decimal", "ordered list"), + ("none", "unstyled"), + ] + ), + ), + ( + "text", + wagtail.blocks.RichTextBlock( + features=["ul"], icon="list-ol" + ), + ), + ], + icon="list-ol", + label="List", + ), + ), + ("paragraph", wagtail.blocks.TextBlock(max_length=10000)), + ( + "html", + wagtail.blocks.RawHTMLBlock(icon="code", label="Raw HTML"), + ), + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "caption", + wagtail.blocks.StructBlock( + [("text", wagtail.blocks.TextBlock())] + ), + ), + ( + "text_with_heading", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + class_name="heading-blog", max_length=255 + ), + ), + ("text", wagtail.blocks.TextBlock()), + ] + ), + ), + ( + "text_with_heading_and_image", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=255, required=False + ), + ), + ("text", wagtail.blocks.TextBlock(required=False)), + ("image", wagtail.images.blocks.ImageChooserBlock()), + ] + ), + ), + ( + "text_with_heading_and_right_image", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + class_name="heading-blog", + max_length=255, + required=False, + ), + ), + ("text", wagtail.blocks.TextBlock()), + ("image", wagtail.images.blocks.ImageChooserBlock()), + ] + ), + ), + ( + "text_with_heading_and_left_image", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + class_name="blog", + max_length=255, + required=False, + ), + ), + ("text", wagtail.blocks.TextBlock()), + ("image", wagtail.images.blocks.ImageChooserBlock()), + ] + ), + ), + ( + "left_quote_right_image", + wagtail.blocks.StructBlock( + [ + ("quote", wagtail.blocks.TextBlock()), + ("byline", wagtail.blocks.CharBlock(max_length=255)), + ("image", wagtail.images.blocks.ImageChooserBlock()), + ], + icon="openquote", + ), + ), + ( + "video_embed", + wagtail.blocks.StructBlock( + [ + ("heading", wagtail.blocks.CharBlock(max_length=255)), + ("text", wagtail.blocks.TextBlock()), + ] + ), + ), + ("table", home.blocks.CustomTableBlock()), + ( + "code_block", + wagtail.blocks.StructBlock( + [ + ( + "language", + wagtail.blocks.ChoiceBlock( + choices=[ + ("Python", "python"), + ("Markup", "html"), + ("CSS", "css"), + ("Clojure", "clojure"), + ("Bash", "shell"), + ("Django", "django"), + ("Jinja2", "jinja2"), + ("Docker", "dockerfile"), + ("Git", "git"), + ("GraphQL", "graphql"), + ("Handlebars", "handlebars"), + (".ignore", "gitignore"), + ("JSON", "json"), + ("JSON5", "json5"), + ("Markdown", "md"), + ("Markdown", "md"), + ("React JSX", "jsx"), + ("React TSX", "tsx"), + ("SASS", "sass"), + ("SCSS", "scss"), + ("TypeScript", "ts"), + ("vim", "vim"), + ] + ), + ), + ( + "caption", + wagtail.blocks.CharBlock( + blank=True, max_length=255 + ), + ), + ( + "page", + wagtail.blocks.CharBlock( + blank=True, max_length=255 + ), + ), + ( + "code", + wagtail.blocks.TextBlock( + blank=True, max_length=1000 + ), + ), + ] + ), + ), + ], + blank=True, + null=True, + use_json_field=True, + verbose_name="StreamField Body", + ), + ), + ] diff --git a/home/puput_migrations/0006_alter_entrypage_body_optional_fields.py b/home/puput_migrations/0006_alter_entrypage_body_optional_fields.py new file mode 100644 index 0000000..a0e6cd2 --- /dev/null +++ b/home/puput_migrations/0006_alter_entrypage_body_optional_fields.py @@ -0,0 +1,259 @@ +# Generated by Django 4.1.13 on 2024-04-03 17:07 +from __future__ import annotations + +import wagtail.blocks +import wagtail.fields +import wagtail.images.blocks +from django.db import migrations + +import home.blocks + + +class Migration(migrations.Migration): + dependencies = [ + ("puput", "0005_alter_entrypage_body"), + ] + + operations = [ + migrations.AlterField( + model_name="entrypage", + name="body", + field=wagtail.fields.StreamField( + [ + ( + "heading", + wagtail.blocks.StructBlock( + [ + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("text-5xl", "h1"), + ("text-4xl", "h2"), + ("text-3xl", "h3"), + ("text-2xl", "h4"), + ("text-xl", "h5"), + ("text-lg", "h6"), + ], + icon="title", + ), + ), + ( + "heading", + wagtail.blocks.CharBlock( + class_name="heading-blog", max_length=255 + ), + ), + ], + icon="h1", + label="Heading", + ), + ), + ( + "rich_text", + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.RichTextBlock( + features=[ + "embed", + "bold", + "italic", + "link", + "superscript", + "subscript", + "strikethrough", + "code", + "hr", + ], + icon="title", + label="Rich Text", + max_length=10000, + ), + ) + ] + ), + ), + ( + "list", + wagtail.blocks.StructBlock( + [ + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("circle", "unordered list"), + ("decimal", "ordered list"), + ("none", "unstyled"), + ] + ), + ), + ( + "text", + wagtail.blocks.RichTextBlock( + features=["ul"], icon="list-ol" + ), + ), + ], + icon="list-ol", + label="List", + ), + ), + ("paragraph", wagtail.blocks.TextBlock(max_length=10000)), + ( + "html", + wagtail.blocks.RawHTMLBlock(icon="code", label="Raw HTML"), + ), + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "caption", + wagtail.blocks.StructBlock( + [("text", wagtail.blocks.TextBlock())] + ), + ), + ( + "text_with_heading", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + class_name="heading-blog", max_length=255 + ), + ), + ("text", wagtail.blocks.TextBlock()), + ] + ), + ), + ( + "text_with_heading_and_image", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=255, required=False + ), + ), + ("text", wagtail.blocks.TextBlock(required=False)), + ("image", wagtail.images.blocks.ImageChooserBlock()), + ] + ), + ), + ( + "text_with_heading_and_right_image", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + class_name="heading-blog", + max_length=255, + required=False, + ), + ), + ("text", wagtail.blocks.TextBlock()), + ("image", wagtail.images.blocks.ImageChooserBlock()), + ] + ), + ), + ( + "text_with_heading_and_left_image", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + class_name="blog", + max_length=255, + required=False, + ), + ), + ("text", wagtail.blocks.TextBlock()), + ("image", wagtail.images.blocks.ImageChooserBlock()), + ] + ), + ), + ( + "left_quote_right_image", + wagtail.blocks.StructBlock( + [ + ("quote", wagtail.blocks.TextBlock()), + ("byline", wagtail.blocks.CharBlock(max_length=255)), + ("image", wagtail.images.blocks.ImageChooserBlock()), + ], + icon="openquote", + ), + ), + ( + "video_embed", + wagtail.blocks.StructBlock( + [ + ("heading", wagtail.blocks.CharBlock(max_length=255)), + ("text", wagtail.blocks.TextBlock()), + ] + ), + ), + ("table", home.blocks.CustomTableBlock()), + ( + "code_block", + wagtail.blocks.StructBlock( + [ + ( + "language", + wagtail.blocks.ChoiceBlock( + choices=[ + ("Python", "python"), + ("Markup", "html"), + ("CSS", "css"), + ("Clojure", "clojure"), + ("Bash", "shell"), + ("Django", "django"), + ("Jinja2", "jinja2"), + ("Docker", "dockerfile"), + ("Git", "git"), + ("GraphQL", "graphql"), + ("Handlebars", "handlebars"), + (".ignore", "gitignore"), + ("JSON", "json"), + ("JSON5", "json5"), + ("Markdown", "md"), + ("Markdown", "md"), + ("React JSX", "jsx"), + ("React TSX", "tsx"), + ("SASS", "sass"), + ("SCSS", "scss"), + ("TypeScript", "ts"), + ("vim", "vim"), + ] + ), + ), + ( + "caption", + wagtail.blocks.CharBlock( + blank=True, max_length=255 + ), + ), + ( + "page", + wagtail.blocks.CharBlock( + blank=True, max_length=255 + ), + ), + ( + "code", + wagtail.blocks.TextBlock( + blank=True, max_length=1000 + ), + ), + ] + ), + ), + ], + null=True, + use_json_field=True, + verbose_name="StreamField Body", + ), + ), + ] diff --git a/indymeet/templates/blocks/text-image-heading.html b/indymeet/templates/blocks/text-image-heading.html index 6b5e30d..a7c4e26 100644 --- a/indymeet/templates/blocks/text-image-heading.html +++ b/indymeet/templates/blocks/text-image-heading.html @@ -1,13 +1,17 @@ {% load wagtailimages_tags %}
+ {% if value.heading %}

{{ value.heading|safe }}

+ {% endif %}
-
+
{% image value.image fill-900x700 %}
-
+ {% if value.text %} +

{{ value.text|safe|urlize|linebreaks }}

+ {% endif %}
diff --git a/indymeet/templates/blocks/text-with-heading-left-image.html b/indymeet/templates/blocks/text-with-heading-left-image.html index 6b5e30d..de174ec 100644 --- a/indymeet/templates/blocks/text-with-heading-left-image.html +++ b/indymeet/templates/blocks/text-with-heading-left-image.html @@ -1,7 +1,9 @@ {% load wagtailimages_tags %}
+ {% if value.heading %}

{{ value.heading|safe }}

+ {% endif %}
{% image value.image fill-900x700 %}
diff --git a/indymeet/templates/blocks/text-with-heading-right-image.html b/indymeet/templates/blocks/text-with-heading-right-image.html index 55a5d8d..01c7cea 100644 --- a/indymeet/templates/blocks/text-with-heading-right-image.html +++ b/indymeet/templates/blocks/text-with-heading-right-image.html @@ -1,7 +1,9 @@ {% load wagtailimages_tags %}
+ {% if value.heading %}

{{ value.heading|safe }}

+ {% endif %}