diff --git a/pages/custom_blocks.py b/pages/custom_blocks.py index 462da9ee4..62a082e0f 100644 --- a/pages/custom_blocks.py +++ b/pages/custom_blocks.py @@ -23,6 +23,7 @@ class LinkBlock(blocks.StreamBlock): external = blocks.URLBlock(required=False) internal = blocks.PageChooserBlock(required=False) document = DocumentChooserBlock(required=False) + anchor = blocks.CharBlock(required=False) class Meta: icon = 'link' @@ -46,26 +47,76 @@ def get_api_representation(self, value, context=None): 'value': child.value.url_path, 'type': child.block_type, } + elif child.block_type == 'anchor': + return { + 'value': "#{anchor}".format(anchor=child.value), + 'type': child.block_type, + } else: return None -class CTALinkBlock(blocks.StructBlock): +class LinkInfoBlock(blocks.StructBlock): text = blocks.CharBlock(required=True) aria_label = blocks.CharBlock(required=False) target = LinkBlock(required=True) + class Meta: + icon = 'placeholder' + label = "Link" + +class CTALinkBlock(LinkInfoBlock): + text = blocks.CharBlock(required=True) + aria_label = blocks.CharBlock(required=False) + target = LinkBlock(required=True) + config = blocks.StreamBlock([ + ('style', blocks.ChoiceBlock(choices=[ + ('orange', 'Orange'), + ('white', 'White'), + ('blue_outline', 'Blue Outline'), + ('deep_green_outline', 'Deep Green Outline'), + ], default='descending')), + ], block_counts={ + 'style': {'max_num': 1}, + }, required=False) + class Meta: icon = 'placeholder' label = "Call to Action" +class LinksGroupBlock(blocks.StructBlock): + links = blocks.ListBlock( + LinkInfoBlock(required=False, label="Link"), + default=[], label='Links' + ) + config = blocks.StreamBlock([ + ('color', blocks.ChoiceBlock(choices=[ + ('white', 'White'), + ('blue', 'Blue'), + ('deep-green', 'Deep Green'), + ], default='descending')), + ], block_counts={ + 'color': {'max_num': 1}, + }, required=False) + + class Meta: + icon = 'placeholder' + label = "Links Group" + class CTAButtonBarBlock(blocks.StructBlock): - actions = blocks.ListBlock(CTALinkBlock(required=False, label="Button"), - default=[], - max_num=2, - label='Actions' - ) + actions = blocks.ListBlock( + CTALinkBlock(required=False, label="Button"), + default=[], max_num=2, label='Actions' + ) + config = blocks.StreamBlock([ + ('priority', blocks.ChoiceBlock(choices=[ + ('descending', 'Descending'), + ('equal', 'Equal'), + ], default='descending')), + ], block_counts={ + 'priority': {'max_num': 1}, + }, required=False) class Meta: icon = 'placeholder' @@ -88,6 +139,11 @@ def get_api_representation(self, value, context=None): except AttributeError: return None +class QuoteBlock(StructBlock): + image = APIImageChooserBlock() + content = blocks.RichTextBlock() + name = blocks.CharBlock() + title = blocks.CharBlock(requred=False) class DividerBlock(StructBlock): image = APIImageChooserBlock() diff --git a/pages/migrations/0131_alter_impact_making_a_difference_squashed_0144_alter_rootpage_body_alter_rootpage_layout.py b/pages/migrations/0131_alter_impact_making_a_difference_squashed_0144_alter_rootpage_body_alter_rootpage_layout.py new file mode 100644 index 000000000..4d9ba6f15 --- /dev/null +++ b/pages/migrations/0131_alter_impact_making_a_difference_squashed_0144_alter_rootpage_body_alter_rootpage_layout.py @@ -0,0 +1,1042 @@ +# Generated by Django 5.0.7 on 2024-07-25 15:34 + +import pages.custom_blocks +import wagtail.blocks +import wagtail.documents.blocks +import wagtail.fields +from django.db import migrations + + +class Migration(migrations.Migration): + + replaces = [ + ("pages", "0131_alter_impact_making_a_difference"), + ("pages", "0132_remove_rootpage_layout"), + ("pages", "0133_rootpage_layout"), + ("pages", "0134_alter_rootpage_layout"), + ("pages", "0135_alter_rootpage_layout"), + ("pages", "0136_alter_rootpage_layout"), + ("pages", "0137_alter_rootpage_body_alter_rootpage_layout"), + ("pages", "0138_alter_rootpage_body"), + ("pages", "0139_alter_rootpage_body"), + ("pages", "0140_alter_rootpage_body"), + ("pages", "0141_alter_rootpage_body"), + ("pages", "0142_alter_rootpage_body"), + ("pages", "0143_alter_rootpage_body_alter_rootpage_layout"), + ("pages", "0144_alter_rootpage_body_alter_rootpage_layout"), + ] + + dependencies = [ + ("pages", "0111_alter_rootpage_body_squashed_0130_alter_rootpage_body"), + ] + + operations = [ + migrations.AlterField( + model_name="impact", + name="making_a_difference", + field=wagtail.fields.StreamField( + [ + ( + "content", + wagtail.blocks.StructBlock( + [ + ("heading", wagtail.blocks.CharBlock()), + ("description", wagtail.blocks.RichTextBlock()), + ( + "stories", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("image", pages.custom_blocks.APIImageChooserBlock(required=False)), + ("story_text", wagtail.blocks.TextBlock(required=False)), + ( + "linked_story", + wagtail.blocks.PageChooserBlock( + page_type=["pages.ImpactStory", "news.NewsArticle"] + ), + ), + ("embedded_video", wagtail.blocks.RawHTMLBlock(required=False)), + ] + ) + ), + ), + ] + ), + ) + ], + use_json_field=True, + ), + ), + migrations.RemoveField( + model_name="rootpage", + name="layout", + ), + migrations.AlterField( + model_name="rootpage", + name="body", + field=wagtail.fields.StreamField( + [ + ( + "hero", + wagtail.blocks.StructBlock( + [ + ( + "content", + wagtail.blocks.StreamBlock( + [ + ( + "cards_block", + wagtail.blocks.StructBlock( + [ + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + pages.custom_blocks.APIRichTextBlock(), + ), + ( + "cta_block", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock( + required=True + ), + ), + ( + "aria_label", + wagtail.blocks.CharBlock( + required=False + ), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "style", + wagtail.blocks.ChoiceBlock( + choices=[ + ( + "primary", + "Primary", + ), + ( + "white", + "White", + ), + ( + "blue_outline", + "Blue Outline", + ), + ( + "deep_green_outline", + "Deep Green Outline", + ), + ] + ), + ) + ], + block_counts={ + "style": { + "max_num": 1 + } + }, + required=False, + ), + ), + ], + label="Link", + required=False, + ), + default=[], + label="Call To Action", + max_num=1, + ), + ), + ] + ) + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "card_size", + wagtail.blocks.IntegerBlock( + help_text="Width multiplier. default 27.", + min_value=0, + ), + ), + ( + "card_style", + wagtail.blocks.ChoiceBlock( + choices=[ + ("rounded", "Rounded"), + ("square", "Square"), + ] + ), + ), + ], + block_counts={ + "card_size": {"max_num": 1}, + "card_style": {"max_num": 1}, + }, + required=False, + ), + ), + ], + label="Cards Block", + ), + ), + ("text", pages.custom_blocks.APIRichTextBlock()), + ("html", wagtail.blocks.RawHTMLBlock()), + ( + "cta_block", + wagtail.blocks.StructBlock( + [ + ( + "actions", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock(required=True), + ), + ( + "aria_label", + wagtail.blocks.CharBlock(required=False), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "style", + wagtail.blocks.ChoiceBlock( + choices=[ + ("primary", "Primary"), + ("white", "White"), + ( + "blue_outline", + "Blue Outline", + ), + ( + "deep_green_outline", + "Deep Green Outline", + ), + ] + ), + ) + ], + block_counts={"style": {"max_num": 1}}, + required=False, + ), + ), + ], + label="Button", + required=False, + ), + default=[], + label="Actions", + max_num=2, + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "priority", + wagtail.blocks.ChoiceBlock( + choices=[ + ("descending", "Descending"), + ("equal", "Equal"), + ] + ), + ) + ], + block_counts={"priority": {"max_num": 1}}, + required=False, + ), + ), + ] + ), + ), + ( + "links_group", + wagtail.blocks.StructBlock( + [ + ( + "links", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock(required=True), + ), + ( + "aria_label", + wagtail.blocks.CharBlock(required=False), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ], + label="Link", + required=False, + ), + default=[], + label="Links", + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "color", + wagtail.blocks.ChoiceBlock( + choices=[ + ("white", "White"), + ("blue", "Blue"), + ("deep_green", "Deep Green"), + ] + ), + ) + ], + block_counts={"color": {"max_num": 1}}, + required=False, + ), + ), + ] + ), + ), + ( + "quote", + wagtail.blocks.StructBlock( + [ + ("image", pages.custom_blocks.APIImageChooserBlock()), + ("content", wagtail.blocks.RichTextBlock()), + ] + ), + ), + ] + ), + ), + ("image", pages.custom_blocks.APIImageChooserBlock(required=False)), + ("image_alt", wagtail.blocks.CharBlock(required=False)), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "id", + wagtail.blocks.RegexBlock( + error_mssages={"invalid": "not a valid id."}, + help_text="html id of this element. eg: cool_section", + regex="[a-zA-Z0-9\\-_]", + ), + ), + ( + "image_alignment", + wagtail.blocks.ChoiceBlock( + choices=[ + ("left", "Left"), + ("right", "Right"), + ("topLeft", "Top Left"), + ("topRight", "Top Right"), + ("bottomLeft", "Bottom Left"), + ("bottomRight", "Bottom Right"), + ] + ), + ), + ( + "image_size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("auto", "Auto"), + ("contain", "Contain"), + ("cover", "Cover"), + ] + ), + ), + ( + "padding", + wagtail.blocks.IntegerBlock( + help_text="Padding multiplier. default 0.", min_value=0 + ), + ), + ( + "background_color", + wagtail.blocks.RegexBlock( + error_mssages={"invalid": "not a valid hex color."}, + help_text="eg: #ff0000", + regex="#[a-zA-Z0-9]{6}", + ), + ), + ], + block_counts={ + "background_color": {"max_num": 1}, + "id": {"max_num": 1}, + "image_alignment": {"max_num": 1}, + "image_size": {"max_num": 1}, + "padding": {"max_num": 1}, + }, + required=False, + ), + ), + ] + ), + ), + ( + "section", + wagtail.blocks.StructBlock( + [ + ( + "content", + wagtail.blocks.StreamBlock( + [ + ( + "cards_block", + wagtail.blocks.StructBlock( + [ + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + pages.custom_blocks.APIRichTextBlock(), + ), + ( + "cta_block", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock( + required=True + ), + ), + ( + "aria_label", + wagtail.blocks.CharBlock( + required=False + ), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "style", + wagtail.blocks.ChoiceBlock( + choices=[ + ( + "primary", + "Primary", + ), + ( + "white", + "White", + ), + ( + "blue_outline", + "Blue Outline", + ), + ( + "deep_green_outline", + "Deep Green Outline", + ), + ] + ), + ) + ], + block_counts={ + "style": { + "max_num": 1 + } + }, + required=False, + ), + ), + ], + label="Link", + required=False, + ), + default=[], + label="Call To Action", + max_num=1, + ), + ), + ] + ) + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "card_size", + wagtail.blocks.IntegerBlock( + help_text="Width multiplier. default 27.", + min_value=0, + ), + ), + ( + "card_style", + wagtail.blocks.ChoiceBlock( + choices=[ + ("rounded", "Rounded"), + ("square", "Square"), + ] + ), + ), + ], + block_counts={ + "card_size": {"max_num": 1}, + "card_style": {"max_num": 1}, + }, + required=False, + ), + ), + ], + label="Cards Block", + ), + ), + ("text", pages.custom_blocks.APIRichTextBlock()), + ("html", wagtail.blocks.RawHTMLBlock()), + ( + "cta_block", + wagtail.blocks.StructBlock( + [ + ( + "actions", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock(required=True), + ), + ( + "aria_label", + wagtail.blocks.CharBlock(required=False), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "style", + wagtail.blocks.ChoiceBlock( + choices=[ + ("primary", "Primary"), + ("white", "White"), + ( + "blue_outline", + "Blue Outline", + ), + ( + "deep_green_outline", + "Deep Green Outline", + ), + ] + ), + ) + ], + block_counts={"style": {"max_num": 1}}, + required=False, + ), + ), + ], + label="Button", + required=False, + ), + default=[], + label="Actions", + max_num=2, + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "priority", + wagtail.blocks.ChoiceBlock( + choices=[ + ("descending", "Descending"), + ("equal", "Equal"), + ] + ), + ) + ], + block_counts={"priority": {"max_num": 1}}, + required=False, + ), + ), + ] + ), + ), + ( + "links_group", + wagtail.blocks.StructBlock( + [ + ( + "links", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock(required=True), + ), + ( + "aria_label", + wagtail.blocks.CharBlock(required=False), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ], + label="Link", + required=False, + ), + default=[], + label="Links", + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "color", + wagtail.blocks.ChoiceBlock( + choices=[ + ("white", "White"), + ("blue", "Blue"), + ("deep_green", "Deep Green"), + ] + ), + ) + ], + block_counts={"color": {"max_num": 1}}, + required=False, + ), + ), + ] + ), + ), + ( + "quote", + wagtail.blocks.StructBlock( + [ + ("image", pages.custom_blocks.APIImageChooserBlock()), + ("content", wagtail.blocks.RichTextBlock()), + ] + ), + ), + ] + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "id", + wagtail.blocks.RegexBlock( + error_mssages={"invalid": "not a valid id."}, + help_text="html id of this element. eg: cool_section", + regex="[a-zA-Z0-9\\-_]", + ), + ), + ( + "background_color", + wagtail.blocks.RegexBlock( + error_mssages={"invalid": "not a valid hex color."}, + help_text="eg: #ff0000", + regex="#[a-zA-Z0-9]{6}", + ), + ), + ( + "padding", + wagtail.blocks.IntegerBlock( + help_text="Padding multiplier. default 0.", min_value=0 + ), + ), + ( + "text_alignment", + wagtail.blocks.ChoiceBlock( + choices=[("center", "Center"), ("left", "Left"), ("right", "Right")] + ), + ), + ], + block_counts={ + "background_color": {"max_num": 1}, + "id": {"max_num": 1}, + "padding": {"max_num": 1}, + "text_alignment": {"max_num": 1}, + }, + required=False, + ), + ), + ] + ), + ), + ( + "divider", + wagtail.blocks.StructBlock( + [ + ("image", pages.custom_blocks.APIImageChooserBlock()), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "alignment", + wagtail.blocks.ChoiceBlock( + choices=[ + ("center", "Center"), + ("content_left", "Left side of content."), + ("content_right", "Right side of content."), + ("body_left", "Left side of window."), + ("body_right", "Right side of window."), + ] + ), + ), + ( + "width", + wagtail.blocks.RegexBlock( + error_messages={ + "invalid": "must be valid css measurement. eg: 30px, 50%, 10rem" + }, + regex="^[0-9]+(px|%|rem)$", + required=False, + ), + ), + ( + "height", + wagtail.blocks.RegexBlock( + error_messages={ + "invalid": "must be valid css measurement. eg: 30px, 50%, 10rem" + }, + regex="^[0-9]+(px|%|rem)$", + required=False, + ), + ), + ( + "offset_vertical", + wagtail.blocks.RegexBlock( + error_messages={ + "invalid": "must be valid css measurement. eg: 30px, 50%, 10rem" + }, + regex="^\\-?[0-9]+(px|%|rem)$", + required=False, + ), + ), + ( + "offset_horizontal", + wagtail.blocks.RegexBlock( + error_messages={ + "invalid": "must be valid css measurement. eg: 30px, 50%, 10rem" + }, + regex="^\\-?[0-9]+(px|%|rem)$", + required=False, + ), + ), + ], + block_counts={ + "alignment": {"max_num": 1}, + "height": {"max_num": 1}, + "offset_horizontal": {"max_num": 1}, + "offset_vertical": {"max_num": 1}, + "width": {"max_num": 1}, + }, + required=False, + ), + ), + ] + ), + ), + ("html", wagtail.blocks.RawHTMLBlock()), + ], + use_json_field=True, + ), + ), + migrations.AddField( + model_name="rootpage", + name="layout", + field=wagtail.fields.StreamField( + [ + ("default", wagtail.blocks.StructBlock([])), + ( + "landing", + wagtail.blocks.StructBlock( + [ + ( + "nav_links", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("text", wagtail.blocks.CharBlock(required=True)), + ("aria_label", wagtail.blocks.CharBlock(required=False)), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ("external", wagtail.blocks.URLBlock(required=False)), + ( + "internal", + wagtail.blocks.PageChooserBlock(required=False), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ("anchor", wagtail.blocks.CharBlock(required=False)), + ], + required=True, + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "style", + wagtail.blocks.ChoiceBlock( + choices=[ + ("primary", "Primary"), + ("white", "White"), + ("blue_outline", "Blue Outline"), + ("deep_green_outline", "Deep Green Outline"), + ] + ), + ) + ], + block_counts={"style": {"max_num": 1}}, + required=False, + ), + ), + ], + label="Link", + required=False, + ), + default=[], + label="Nav Links", + ), + ) + ], + label="Landing Page", + ), + ), + ], + blank=True, + default=[], + use_json_field=True, + ), + ), + ] diff --git a/pages/migrations/0137_alter_rootpage_body_alter_rootpage_layout.py b/pages/migrations/0137_alter_rootpage_body_alter_rootpage_layout.py new file mode 100644 index 000000000..699ef6fb3 --- /dev/null +++ b/pages/migrations/0137_alter_rootpage_body_alter_rootpage_layout.py @@ -0,0 +1,611 @@ +# Generated by Django 5.0.7 on 2024-07-25 02:07 + +import pages.custom_blocks +import wagtail.blocks +import wagtail.documents.blocks +import wagtail.fields +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ("pages", "0136_alter_rootpage_layout"), + ] + + operations = [ + migrations.AlterField( + model_name="rootpage", + name="body", + field=wagtail.fields.StreamField( + [ + ( + "hero", + wagtail.blocks.StructBlock( + [ + ( + "content", + wagtail.blocks.StreamBlock( + [ + ( + "cards_block", + wagtail.blocks.StructBlock( + [ + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + pages.custom_blocks.APIRichTextBlock(), + ), + ( + "cta_block", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock( + required=True + ), + ), + ( + "aria_label", + wagtail.blocks.CharBlock( + required=False + ), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ], + label="Link", + required=False, + ), + default=[], + label="Call To Action", + max_num=1, + ), + ), + ] + ) + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "card_size", + wagtail.blocks.IntegerBlock( + help_text="Width multiplier. default 27.", + min_value=0, + ), + ), + ( + "card_style", + wagtail.blocks.ChoiceBlock( + choices=[ + ("rounded", "Rounded"), + ("square", "Square"), + ] + ), + ), + ], + block_counts={ + "card_size": {"max_num": 1}, + "card_style": {"max_num": 1}, + }, + required=False, + ), + ), + ], + label="Cards Block", + ), + ), + ("text", pages.custom_blocks.APIRichTextBlock()), + ("html", wagtail.blocks.RawHTMLBlock()), + ( + "cta_block", + wagtail.blocks.StructBlock( + [ + ( + "actions", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock(required=True), + ), + ( + "aria_label", + wagtail.blocks.CharBlock(required=False), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ], + label="Button", + required=False, + ), + default=[], + label="Actions", + max_num=2, + ), + ) + ] + ), + ), + ] + ), + ), + ("image", pages.custom_blocks.APIImageChooserBlock(required=False)), + ("image_alt", wagtail.blocks.CharBlock(required=False)), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "image_alignment", + wagtail.blocks.ChoiceBlock( + choices=[ + ("left", "Left"), + ("right", "Right"), + ("topLeft", "Top Left"), + ("topRight", "Top Right"), + ("bottomLeft", "Bottom Left"), + ("bottomRight", "Bottom Right"), + ] + ), + ), + ( + "image_size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("auto", "Auto"), + ("contain", "Contain"), + ("cover", "Cover"), + ] + ), + ), + ( + "padding", + wagtail.blocks.IntegerBlock( + help_text="Padding multiplier. default 0.", min_value=0 + ), + ), + ( + "background_color", + wagtail.blocks.RegexBlock( + error_mssages={"invalid": "not a valid hex color."}, + help_text="eg: #ff0000", + regex="#[a-zA-Z0-9]{6}", + ), + ), + ], + block_counts={ + "background_color": {"max_num": 1}, + "image_alignment": {"max_num": 1}, + "image_size": {"max_num": 1}, + "padding": {"max_num": 1}, + }, + required=False, + ), + ), + ] + ), + ), + ( + "section", + wagtail.blocks.StructBlock( + [ + ( + "content", + wagtail.blocks.StreamBlock( + [ + ( + "cards_block", + wagtail.blocks.StructBlock( + [ + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + pages.custom_blocks.APIRichTextBlock(), + ), + ( + "cta_block", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock( + required=True + ), + ), + ( + "aria_label", + wagtail.blocks.CharBlock( + required=False + ), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ], + label="Link", + required=False, + ), + default=[], + label="Call To Action", + max_num=1, + ), + ), + ] + ) + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "card_size", + wagtail.blocks.IntegerBlock( + help_text="Width multiplier. default 27.", + min_value=0, + ), + ), + ( + "card_style", + wagtail.blocks.ChoiceBlock( + choices=[ + ("rounded", "Rounded"), + ("square", "Square"), + ] + ), + ), + ], + block_counts={ + "card_size": {"max_num": 1}, + "card_style": {"max_num": 1}, + }, + required=False, + ), + ), + ], + label="Cards Block", + ), + ), + ("text", pages.custom_blocks.APIRichTextBlock()), + ("html", wagtail.blocks.RawHTMLBlock()), + ( + "cta_block", + wagtail.blocks.StructBlock( + [ + ( + "actions", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock(required=True), + ), + ( + "aria_label", + wagtail.blocks.CharBlock(required=False), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ], + label="Button", + required=False, + ), + default=[], + label="Actions", + max_num=2, + ), + ) + ] + ), + ), + ] + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "background_color", + wagtail.blocks.RegexBlock( + error_mssages={"invalid": "not a valid hex color."}, + help_text="eg: #ff0000", + regex="#[a-zA-Z0-9]{6}", + ), + ), + ( + "padding", + wagtail.blocks.IntegerBlock( + help_text="Padding multiplier. default 0.", min_value=0 + ), + ), + ( + "text_alignment", + wagtail.blocks.ChoiceBlock( + choices=[("center", "Center"), ("left", "Left"), ("right", "Right")] + ), + ), + ], + block_counts={ + "background_color": {"max_num": 1}, + "padding": {"max_num": 1}, + "text_alignment": {"max_num": 1}, + }, + required=False, + ), + ), + ] + ), + ), + ( + "divider", + wagtail.blocks.StructBlock( + [ + ("image", pages.custom_blocks.APIImageChooserBlock()), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "alignment", + wagtail.blocks.ChoiceBlock( + choices=[ + ("center", "Center"), + ("content_left", "Left side of content."), + ("content_right", "Right side of content."), + ("body_left", "Left side of window."), + ("body_right", "Right side of window."), + ] + ), + ), + ( + "width", + wagtail.blocks.RegexBlock( + error_messages={ + "invalid": "must be valid css measurement. eg: 30px, 50%, 10rem" + }, + regex="^[0-9]+(px|%|rem)$", + required=False, + ), + ), + ( + "height", + wagtail.blocks.RegexBlock( + error_messages={ + "invalid": "must be valid css measurement. eg: 30px, 50%, 10rem" + }, + regex="^[0-9]+(px|%|rem)$", + required=False, + ), + ), + ( + "offset_vertical", + wagtail.blocks.RegexBlock( + error_messages={ + "invalid": "must be valid css measurement. eg: 30px, 50%, 10rem" + }, + regex="^\\-?[0-9]+(px|%|rem)$", + required=False, + ), + ), + ( + "offset_horizontal", + wagtail.blocks.RegexBlock( + error_messages={ + "invalid": "must be valid css measurement. eg: 30px, 50%, 10rem" + }, + regex="^\\-?[0-9]+(px|%|rem)$", + required=False, + ), + ), + ], + block_counts={ + "alignment": {"max_num": 1}, + "height": {"max_num": 1}, + "offset_horizontal": {"max_num": 1}, + "offset_vertical": {"max_num": 1}, + "width": {"max_num": 1}, + }, + required=False, + ), + ), + ] + ), + ), + ("html", wagtail.blocks.RawHTMLBlock()), + ], + use_json_field=True, + ), + ), + migrations.AlterField( + model_name="rootpage", + name="layout", + field=wagtail.fields.StreamField( + [ + ("default", wagtail.blocks.StructBlock([])), + ( + "landing", + wagtail.blocks.StructBlock( + [ + ( + "nav_links", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("text", wagtail.blocks.CharBlock(required=True)), + ("aria_label", wagtail.blocks.CharBlock(required=False)), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ("external", wagtail.blocks.URLBlock(required=False)), + ( + "internal", + wagtail.blocks.PageChooserBlock(required=False), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ("anchor", wagtail.blocks.CharBlock(required=False)), + ], + required=True, + ), + ), + ], + label="Link", + required=False, + ), + default=[], + label="Nav Links", + ), + ) + ], + label="Landing Page", + ), + ), + ], + blank=True, + default=[], + use_json_field=True, + ), + ), + ] diff --git a/pages/migrations/0138_alter_rootpage_body.py b/pages/migrations/0138_alter_rootpage_body.py new file mode 100644 index 000000000..013f80f41 --- /dev/null +++ b/pages/migrations/0138_alter_rootpage_body.py @@ -0,0 +1,676 @@ +# Generated by Django 5.0.7 on 2024-07-25 03:03 + +import pages.custom_blocks +import wagtail.blocks +import wagtail.documents.blocks +import wagtail.fields +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ("pages", "0137_alter_rootpage_body_alter_rootpage_layout"), + ] + + operations = [ + migrations.AlterField( + model_name="rootpage", + name="body", + field=wagtail.fields.StreamField( + [ + ( + "hero", + wagtail.blocks.StructBlock( + [ + ( + "content", + wagtail.blocks.StreamBlock( + [ + ( + "cards_block", + wagtail.blocks.StructBlock( + [ + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + pages.custom_blocks.APIRichTextBlock(), + ), + ( + "cta_block", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock( + required=True + ), + ), + ( + "aria_label", + wagtail.blocks.CharBlock( + required=False + ), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ], + label="Link", + required=False, + ), + default=[], + label="Call To Action", + max_num=1, + ), + ), + ] + ) + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "card_size", + wagtail.blocks.IntegerBlock( + help_text="Width multiplier. default 27.", + min_value=0, + ), + ), + ( + "card_style", + wagtail.blocks.ChoiceBlock( + choices=[ + ("rounded", "Rounded"), + ("square", "Square"), + ] + ), + ), + ], + block_counts={ + "card_size": {"max_num": 1}, + "card_style": {"max_num": 1}, + }, + required=False, + ), + ), + ], + label="Cards Block", + ), + ), + ("text", pages.custom_blocks.APIRichTextBlock()), + ("html", wagtail.blocks.RawHTMLBlock()), + ( + "cta_block", + wagtail.blocks.StructBlock( + [ + ( + "actions", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock(required=True), + ), + ( + "aria_label", + wagtail.blocks.CharBlock(required=False), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ], + label="Button", + required=False, + ), + default=[], + label="Actions", + max_num=2, + ), + ) + ] + ), + ), + ( + "links_group", + wagtail.blocks.StructBlock( + [ + ( + "links", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock(required=True), + ), + ( + "aria_label", + wagtail.blocks.CharBlock(required=False), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ], + label="Link", + required=False, + ), + default=[], + label="Links", + ), + ) + ] + ), + ), + ] + ), + ), + ("image", pages.custom_blocks.APIImageChooserBlock(required=False)), + ("image_alt", wagtail.blocks.CharBlock(required=False)), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "image_alignment", + wagtail.blocks.ChoiceBlock( + choices=[ + ("left", "Left"), + ("right", "Right"), + ("topLeft", "Top Left"), + ("topRight", "Top Right"), + ("bottomLeft", "Bottom Left"), + ("bottomRight", "Bottom Right"), + ] + ), + ), + ( + "image_size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("auto", "Auto"), + ("contain", "Contain"), + ("cover", "Cover"), + ] + ), + ), + ( + "padding", + wagtail.blocks.IntegerBlock( + help_text="Padding multiplier. default 0.", min_value=0 + ), + ), + ( + "background_color", + wagtail.blocks.RegexBlock( + error_mssages={"invalid": "not a valid hex color."}, + help_text="eg: #ff0000", + regex="#[a-zA-Z0-9]{6}", + ), + ), + ], + block_counts={ + "background_color": {"max_num": 1}, + "image_alignment": {"max_num": 1}, + "image_size": {"max_num": 1}, + "padding": {"max_num": 1}, + }, + required=False, + ), + ), + ] + ), + ), + ( + "section", + wagtail.blocks.StructBlock( + [ + ( + "content", + wagtail.blocks.StreamBlock( + [ + ( + "cards_block", + wagtail.blocks.StructBlock( + [ + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + pages.custom_blocks.APIRichTextBlock(), + ), + ( + "cta_block", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock( + required=True + ), + ), + ( + "aria_label", + wagtail.blocks.CharBlock( + required=False + ), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ], + label="Link", + required=False, + ), + default=[], + label="Call To Action", + max_num=1, + ), + ), + ] + ) + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "card_size", + wagtail.blocks.IntegerBlock( + help_text="Width multiplier. default 27.", + min_value=0, + ), + ), + ( + "card_style", + wagtail.blocks.ChoiceBlock( + choices=[ + ("rounded", "Rounded"), + ("square", "Square"), + ] + ), + ), + ], + block_counts={ + "card_size": {"max_num": 1}, + "card_style": {"max_num": 1}, + }, + required=False, + ), + ), + ], + label="Cards Block", + ), + ), + ("text", pages.custom_blocks.APIRichTextBlock()), + ("html", wagtail.blocks.RawHTMLBlock()), + ( + "cta_block", + wagtail.blocks.StructBlock( + [ + ( + "actions", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock(required=True), + ), + ( + "aria_label", + wagtail.blocks.CharBlock(required=False), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ], + label="Button", + required=False, + ), + default=[], + label="Actions", + max_num=2, + ), + ) + ] + ), + ), + ( + "links_group", + wagtail.blocks.StructBlock( + [ + ( + "links", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock(required=True), + ), + ( + "aria_label", + wagtail.blocks.CharBlock(required=False), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ], + label="Link", + required=False, + ), + default=[], + label="Links", + ), + ) + ] + ), + ), + ] + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "background_color", + wagtail.blocks.RegexBlock( + error_mssages={"invalid": "not a valid hex color."}, + help_text="eg: #ff0000", + regex="#[a-zA-Z0-9]{6}", + ), + ), + ( + "padding", + wagtail.blocks.IntegerBlock( + help_text="Padding multiplier. default 0.", min_value=0 + ), + ), + ( + "text_alignment", + wagtail.blocks.ChoiceBlock( + choices=[("center", "Center"), ("left", "Left"), ("right", "Right")] + ), + ), + ], + block_counts={ + "background_color": {"max_num": 1}, + "padding": {"max_num": 1}, + "text_alignment": {"max_num": 1}, + }, + required=False, + ), + ), + ] + ), + ), + ( + "divider", + wagtail.blocks.StructBlock( + [ + ("image", pages.custom_blocks.APIImageChooserBlock()), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "alignment", + wagtail.blocks.ChoiceBlock( + choices=[ + ("center", "Center"), + ("content_left", "Left side of content."), + ("content_right", "Right side of content."), + ("body_left", "Left side of window."), + ("body_right", "Right side of window."), + ] + ), + ), + ( + "width", + wagtail.blocks.RegexBlock( + error_messages={ + "invalid": "must be valid css measurement. eg: 30px, 50%, 10rem" + }, + regex="^[0-9]+(px|%|rem)$", + required=False, + ), + ), + ( + "height", + wagtail.blocks.RegexBlock( + error_messages={ + "invalid": "must be valid css measurement. eg: 30px, 50%, 10rem" + }, + regex="^[0-9]+(px|%|rem)$", + required=False, + ), + ), + ( + "offset_vertical", + wagtail.blocks.RegexBlock( + error_messages={ + "invalid": "must be valid css measurement. eg: 30px, 50%, 10rem" + }, + regex="^\\-?[0-9]+(px|%|rem)$", + required=False, + ), + ), + ( + "offset_horizontal", + wagtail.blocks.RegexBlock( + error_messages={ + "invalid": "must be valid css measurement. eg: 30px, 50%, 10rem" + }, + regex="^\\-?[0-9]+(px|%|rem)$", + required=False, + ), + ), + ], + block_counts={ + "alignment": {"max_num": 1}, + "height": {"max_num": 1}, + "offset_horizontal": {"max_num": 1}, + "offset_vertical": {"max_num": 1}, + "width": {"max_num": 1}, + }, + required=False, + ), + ), + ] + ), + ), + ("html", wagtail.blocks.RawHTMLBlock()), + ], + use_json_field=True, + ), + ), + ] diff --git a/pages/migrations/0139_alter_rootpage_body.py b/pages/migrations/0139_alter_rootpage_body.py new file mode 100644 index 000000000..d6a5bf6d4 --- /dev/null +++ b/pages/migrations/0139_alter_rootpage_body.py @@ -0,0 +1,698 @@ +# Generated by Django 5.0.7 on 2024-07-25 03:05 + +import pages.custom_blocks +import wagtail.blocks +import wagtail.documents.blocks +import wagtail.fields +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ("pages", "0138_alter_rootpage_body"), + ] + + operations = [ + migrations.AlterField( + model_name="rootpage", + name="body", + field=wagtail.fields.StreamField( + [ + ( + "hero", + wagtail.blocks.StructBlock( + [ + ( + "content", + wagtail.blocks.StreamBlock( + [ + ( + "cards_block", + wagtail.blocks.StructBlock( + [ + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + pages.custom_blocks.APIRichTextBlock(), + ), + ( + "cta_block", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock( + required=True + ), + ), + ( + "aria_label", + wagtail.blocks.CharBlock( + required=False + ), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ], + label="Link", + required=False, + ), + default=[], + label="Call To Action", + max_num=1, + ), + ), + ] + ) + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "card_size", + wagtail.blocks.IntegerBlock( + help_text="Width multiplier. default 27.", + min_value=0, + ), + ), + ( + "card_style", + wagtail.blocks.ChoiceBlock( + choices=[ + ("rounded", "Rounded"), + ("square", "Square"), + ] + ), + ), + ], + block_counts={ + "card_size": {"max_num": 1}, + "card_style": {"max_num": 1}, + }, + required=False, + ), + ), + ], + label="Cards Block", + ), + ), + ("text", pages.custom_blocks.APIRichTextBlock()), + ("html", wagtail.blocks.RawHTMLBlock()), + ( + "cta_block", + wagtail.blocks.StructBlock( + [ + ( + "actions", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock(required=True), + ), + ( + "aria_label", + wagtail.blocks.CharBlock(required=False), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ], + label="Button", + required=False, + ), + default=[], + label="Actions", + max_num=2, + ), + ) + ] + ), + ), + ( + "links_group", + wagtail.blocks.StructBlock( + [ + ( + "style", + wagtail.blocks.ChoiceBlock( + choices=[ + ("rainbow", "Colored Outlines"), + ("blue", "Blue"), + ("deep-green", "Deep Green"), + ], + required=False, + ), + ), + ( + "links", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock(required=True), + ), + ( + "aria_label", + wagtail.blocks.CharBlock(required=False), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ], + label="Link", + required=False, + ), + default=[], + label="Links", + ), + ), + ] + ), + ), + ] + ), + ), + ("image", pages.custom_blocks.APIImageChooserBlock(required=False)), + ("image_alt", wagtail.blocks.CharBlock(required=False)), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "image_alignment", + wagtail.blocks.ChoiceBlock( + choices=[ + ("left", "Left"), + ("right", "Right"), + ("topLeft", "Top Left"), + ("topRight", "Top Right"), + ("bottomLeft", "Bottom Left"), + ("bottomRight", "Bottom Right"), + ] + ), + ), + ( + "image_size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("auto", "Auto"), + ("contain", "Contain"), + ("cover", "Cover"), + ] + ), + ), + ( + "padding", + wagtail.blocks.IntegerBlock( + help_text="Padding multiplier. default 0.", min_value=0 + ), + ), + ( + "background_color", + wagtail.blocks.RegexBlock( + error_mssages={"invalid": "not a valid hex color."}, + help_text="eg: #ff0000", + regex="#[a-zA-Z0-9]{6}", + ), + ), + ], + block_counts={ + "background_color": {"max_num": 1}, + "image_alignment": {"max_num": 1}, + "image_size": {"max_num": 1}, + "padding": {"max_num": 1}, + }, + required=False, + ), + ), + ] + ), + ), + ( + "section", + wagtail.blocks.StructBlock( + [ + ( + "content", + wagtail.blocks.StreamBlock( + [ + ( + "cards_block", + wagtail.blocks.StructBlock( + [ + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + pages.custom_blocks.APIRichTextBlock(), + ), + ( + "cta_block", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock( + required=True + ), + ), + ( + "aria_label", + wagtail.blocks.CharBlock( + required=False + ), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ], + label="Link", + required=False, + ), + default=[], + label="Call To Action", + max_num=1, + ), + ), + ] + ) + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "card_size", + wagtail.blocks.IntegerBlock( + help_text="Width multiplier. default 27.", + min_value=0, + ), + ), + ( + "card_style", + wagtail.blocks.ChoiceBlock( + choices=[ + ("rounded", "Rounded"), + ("square", "Square"), + ] + ), + ), + ], + block_counts={ + "card_size": {"max_num": 1}, + "card_style": {"max_num": 1}, + }, + required=False, + ), + ), + ], + label="Cards Block", + ), + ), + ("text", pages.custom_blocks.APIRichTextBlock()), + ("html", wagtail.blocks.RawHTMLBlock()), + ( + "cta_block", + wagtail.blocks.StructBlock( + [ + ( + "actions", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock(required=True), + ), + ( + "aria_label", + wagtail.blocks.CharBlock(required=False), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ], + label="Button", + required=False, + ), + default=[], + label="Actions", + max_num=2, + ), + ) + ] + ), + ), + ( + "links_group", + wagtail.blocks.StructBlock( + [ + ( + "style", + wagtail.blocks.ChoiceBlock( + choices=[ + ("rainbow", "Colored Outlines"), + ("blue", "Blue"), + ("deep-green", "Deep Green"), + ], + required=False, + ), + ), + ( + "links", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock(required=True), + ), + ( + "aria_label", + wagtail.blocks.CharBlock(required=False), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ], + label="Link", + required=False, + ), + default=[], + label="Links", + ), + ), + ] + ), + ), + ] + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "background_color", + wagtail.blocks.RegexBlock( + error_mssages={"invalid": "not a valid hex color."}, + help_text="eg: #ff0000", + regex="#[a-zA-Z0-9]{6}", + ), + ), + ( + "padding", + wagtail.blocks.IntegerBlock( + help_text="Padding multiplier. default 0.", min_value=0 + ), + ), + ( + "text_alignment", + wagtail.blocks.ChoiceBlock( + choices=[("center", "Center"), ("left", "Left"), ("right", "Right")] + ), + ), + ], + block_counts={ + "background_color": {"max_num": 1}, + "padding": {"max_num": 1}, + "text_alignment": {"max_num": 1}, + }, + required=False, + ), + ), + ] + ), + ), + ( + "divider", + wagtail.blocks.StructBlock( + [ + ("image", pages.custom_blocks.APIImageChooserBlock()), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "alignment", + wagtail.blocks.ChoiceBlock( + choices=[ + ("center", "Center"), + ("content_left", "Left side of content."), + ("content_right", "Right side of content."), + ("body_left", "Left side of window."), + ("body_right", "Right side of window."), + ] + ), + ), + ( + "width", + wagtail.blocks.RegexBlock( + error_messages={ + "invalid": "must be valid css measurement. eg: 30px, 50%, 10rem" + }, + regex="^[0-9]+(px|%|rem)$", + required=False, + ), + ), + ( + "height", + wagtail.blocks.RegexBlock( + error_messages={ + "invalid": "must be valid css measurement. eg: 30px, 50%, 10rem" + }, + regex="^[0-9]+(px|%|rem)$", + required=False, + ), + ), + ( + "offset_vertical", + wagtail.blocks.RegexBlock( + error_messages={ + "invalid": "must be valid css measurement. eg: 30px, 50%, 10rem" + }, + regex="^\\-?[0-9]+(px|%|rem)$", + required=False, + ), + ), + ( + "offset_horizontal", + wagtail.blocks.RegexBlock( + error_messages={ + "invalid": "must be valid css measurement. eg: 30px, 50%, 10rem" + }, + regex="^\\-?[0-9]+(px|%|rem)$", + required=False, + ), + ), + ], + block_counts={ + "alignment": {"max_num": 1}, + "height": {"max_num": 1}, + "offset_horizontal": {"max_num": 1}, + "offset_vertical": {"max_num": 1}, + "width": {"max_num": 1}, + }, + required=False, + ), + ), + ] + ), + ), + ("html", wagtail.blocks.RawHTMLBlock()), + ], + use_json_field=True, + ), + ), + ] diff --git a/pages/migrations/0140_alter_rootpage_body.py b/pages/migrations/0140_alter_rootpage_body.py new file mode 100644 index 000000000..64bef4072 --- /dev/null +++ b/pages/migrations/0140_alter_rootpage_body.py @@ -0,0 +1,716 @@ +# Generated by Django 5.0.7 on 2024-07-25 03:10 + +import pages.custom_blocks +import wagtail.blocks +import wagtail.documents.blocks +import wagtail.fields +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ("pages", "0139_alter_rootpage_body"), + ] + + operations = [ + migrations.AlterField( + model_name="rootpage", + name="body", + field=wagtail.fields.StreamField( + [ + ( + "hero", + wagtail.blocks.StructBlock( + [ + ( + "content", + wagtail.blocks.StreamBlock( + [ + ( + "cards_block", + wagtail.blocks.StructBlock( + [ + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + pages.custom_blocks.APIRichTextBlock(), + ), + ( + "cta_block", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock( + required=True + ), + ), + ( + "aria_label", + wagtail.blocks.CharBlock( + required=False + ), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ], + label="Link", + required=False, + ), + default=[], + label="Call To Action", + max_num=1, + ), + ), + ] + ) + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "card_size", + wagtail.blocks.IntegerBlock( + help_text="Width multiplier. default 27.", + min_value=0, + ), + ), + ( + "card_style", + wagtail.blocks.ChoiceBlock( + choices=[ + ("rounded", "Rounded"), + ("square", "Square"), + ] + ), + ), + ], + block_counts={ + "card_size": {"max_num": 1}, + "card_style": {"max_num": 1}, + }, + required=False, + ), + ), + ], + label="Cards Block", + ), + ), + ("text", pages.custom_blocks.APIRichTextBlock()), + ("html", wagtail.blocks.RawHTMLBlock()), + ( + "cta_block", + wagtail.blocks.StructBlock( + [ + ( + "actions", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock(required=True), + ), + ( + "aria_label", + wagtail.blocks.CharBlock(required=False), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ], + label="Button", + required=False, + ), + default=[], + label="Actions", + max_num=2, + ), + ) + ] + ), + ), + ( + "links_group", + wagtail.blocks.StructBlock( + [ + ( + "style", + wagtail.blocks.ChoiceBlock( + choices=[ + ("rainbow", "Colored Outlines"), + ("blue", "Blue"), + ("deep-green", "Deep Green"), + ], + required=False, + ), + ), + ( + "links", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock(required=True), + ), + ( + "aria_label", + wagtail.blocks.CharBlock(required=False), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ], + label="Link", + required=False, + ), + default=[], + label="Links", + ), + ), + ] + ), + ), + ] + ), + ), + ("image", pages.custom_blocks.APIImageChooserBlock(required=False)), + ("image_alt", wagtail.blocks.CharBlock(required=False)), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "id", + wagtail.blocks.RegexBlock( + error_mssages={"invalid": "not a valid id."}, + help_text="html id of this element. eg: cool_section", + regex="[a-zA-Z0-9\\-_]", + ), + ), + ( + "image_alignment", + wagtail.blocks.ChoiceBlock( + choices=[ + ("left", "Left"), + ("right", "Right"), + ("topLeft", "Top Left"), + ("topRight", "Top Right"), + ("bottomLeft", "Bottom Left"), + ("bottomRight", "Bottom Right"), + ] + ), + ), + ( + "image_size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("auto", "Auto"), + ("contain", "Contain"), + ("cover", "Cover"), + ] + ), + ), + ( + "padding", + wagtail.blocks.IntegerBlock( + help_text="Padding multiplier. default 0.", min_value=0 + ), + ), + ( + "background_color", + wagtail.blocks.RegexBlock( + error_mssages={"invalid": "not a valid hex color."}, + help_text="eg: #ff0000", + regex="#[a-zA-Z0-9]{6}", + ), + ), + ], + block_counts={ + "background_color": {"max_num": 1}, + "id": {"max_num": 1}, + "image_alignment": {"max_num": 1}, + "image_size": {"max_num": 1}, + "padding": {"max_num": 1}, + }, + required=False, + ), + ), + ] + ), + ), + ( + "section", + wagtail.blocks.StructBlock( + [ + ( + "content", + wagtail.blocks.StreamBlock( + [ + ( + "cards_block", + wagtail.blocks.StructBlock( + [ + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + pages.custom_blocks.APIRichTextBlock(), + ), + ( + "cta_block", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock( + required=True + ), + ), + ( + "aria_label", + wagtail.blocks.CharBlock( + required=False + ), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ], + label="Link", + required=False, + ), + default=[], + label="Call To Action", + max_num=1, + ), + ), + ] + ) + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "card_size", + wagtail.blocks.IntegerBlock( + help_text="Width multiplier. default 27.", + min_value=0, + ), + ), + ( + "card_style", + wagtail.blocks.ChoiceBlock( + choices=[ + ("rounded", "Rounded"), + ("square", "Square"), + ] + ), + ), + ], + block_counts={ + "card_size": {"max_num": 1}, + "card_style": {"max_num": 1}, + }, + required=False, + ), + ), + ], + label="Cards Block", + ), + ), + ("text", pages.custom_blocks.APIRichTextBlock()), + ("html", wagtail.blocks.RawHTMLBlock()), + ( + "cta_block", + wagtail.blocks.StructBlock( + [ + ( + "actions", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock(required=True), + ), + ( + "aria_label", + wagtail.blocks.CharBlock(required=False), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ], + label="Button", + required=False, + ), + default=[], + label="Actions", + max_num=2, + ), + ) + ] + ), + ), + ( + "links_group", + wagtail.blocks.StructBlock( + [ + ( + "style", + wagtail.blocks.ChoiceBlock( + choices=[ + ("rainbow", "Colored Outlines"), + ("blue", "Blue"), + ("deep-green", "Deep Green"), + ], + required=False, + ), + ), + ( + "links", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock(required=True), + ), + ( + "aria_label", + wagtail.blocks.CharBlock(required=False), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ], + label="Link", + required=False, + ), + default=[], + label="Links", + ), + ), + ] + ), + ), + ] + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "id", + wagtail.blocks.RegexBlock( + error_mssages={"invalid": "not a valid id."}, + help_text="html id of this element. eg: cool_section", + regex="[a-zA-Z0-9\\-_]", + ), + ), + ( + "background_color", + wagtail.blocks.RegexBlock( + error_mssages={"invalid": "not a valid hex color."}, + help_text="eg: #ff0000", + regex="#[a-zA-Z0-9]{6}", + ), + ), + ( + "padding", + wagtail.blocks.IntegerBlock( + help_text="Padding multiplier. default 0.", min_value=0 + ), + ), + ( + "text_alignment", + wagtail.blocks.ChoiceBlock( + choices=[("center", "Center"), ("left", "Left"), ("right", "Right")] + ), + ), + ], + block_counts={ + "background_color": {"max_num": 1}, + "id": {"max_num": 1}, + "padding": {"max_num": 1}, + "text_alignment": {"max_num": 1}, + }, + required=False, + ), + ), + ] + ), + ), + ( + "divider", + wagtail.blocks.StructBlock( + [ + ("image", pages.custom_blocks.APIImageChooserBlock()), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "alignment", + wagtail.blocks.ChoiceBlock( + choices=[ + ("center", "Center"), + ("content_left", "Left side of content."), + ("content_right", "Right side of content."), + ("body_left", "Left side of window."), + ("body_right", "Right side of window."), + ] + ), + ), + ( + "width", + wagtail.blocks.RegexBlock( + error_messages={ + "invalid": "must be valid css measurement. eg: 30px, 50%, 10rem" + }, + regex="^[0-9]+(px|%|rem)$", + required=False, + ), + ), + ( + "height", + wagtail.blocks.RegexBlock( + error_messages={ + "invalid": "must be valid css measurement. eg: 30px, 50%, 10rem" + }, + regex="^[0-9]+(px|%|rem)$", + required=False, + ), + ), + ( + "offset_vertical", + wagtail.blocks.RegexBlock( + error_messages={ + "invalid": "must be valid css measurement. eg: 30px, 50%, 10rem" + }, + regex="^\\-?[0-9]+(px|%|rem)$", + required=False, + ), + ), + ( + "offset_horizontal", + wagtail.blocks.RegexBlock( + error_messages={ + "invalid": "must be valid css measurement. eg: 30px, 50%, 10rem" + }, + regex="^\\-?[0-9]+(px|%|rem)$", + required=False, + ), + ), + ], + block_counts={ + "alignment": {"max_num": 1}, + "height": {"max_num": 1}, + "offset_horizontal": {"max_num": 1}, + "offset_vertical": {"max_num": 1}, + "width": {"max_num": 1}, + }, + required=False, + ), + ), + ] + ), + ), + ("html", wagtail.blocks.RawHTMLBlock()), + ], + use_json_field=True, + ), + ), + ] diff --git a/pages/migrations/0141_alter_rootpage_body.py b/pages/migrations/0141_alter_rootpage_body.py new file mode 100644 index 000000000..f8c50993b --- /dev/null +++ b/pages/migrations/0141_alter_rootpage_body.py @@ -0,0 +1,734 @@ +# Generated by Django 5.0.7 on 2024-07-25 03:14 + +import pages.custom_blocks +import wagtail.blocks +import wagtail.documents.blocks +import wagtail.fields +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ("pages", "0140_alter_rootpage_body"), + ] + + operations = [ + migrations.AlterField( + model_name="rootpage", + name="body", + field=wagtail.fields.StreamField( + [ + ( + "hero", + wagtail.blocks.StructBlock( + [ + ( + "content", + wagtail.blocks.StreamBlock( + [ + ( + "cards_block", + wagtail.blocks.StructBlock( + [ + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + pages.custom_blocks.APIRichTextBlock(), + ), + ( + "cta_block", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock( + required=True + ), + ), + ( + "aria_label", + wagtail.blocks.CharBlock( + required=False + ), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ], + label="Link", + required=False, + ), + default=[], + label="Call To Action", + max_num=1, + ), + ), + ] + ) + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "card_size", + wagtail.blocks.IntegerBlock( + help_text="Width multiplier. default 27.", + min_value=0, + ), + ), + ( + "card_style", + wagtail.blocks.ChoiceBlock( + choices=[ + ("rounded", "Rounded"), + ("square", "Square"), + ] + ), + ), + ], + block_counts={ + "card_size": {"max_num": 1}, + "card_style": {"max_num": 1}, + }, + required=False, + ), + ), + ], + label="Cards Block", + ), + ), + ("text", pages.custom_blocks.APIRichTextBlock()), + ("html", wagtail.blocks.RawHTMLBlock()), + ( + "cta_block", + wagtail.blocks.StructBlock( + [ + ( + "actions", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock(required=True), + ), + ( + "aria_label", + wagtail.blocks.CharBlock(required=False), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ], + label="Button", + required=False, + ), + default=[], + label="Actions", + max_num=2, + ), + ) + ] + ), + ), + ( + "links_group", + wagtail.blocks.StructBlock( + [ + ( + "style", + wagtail.blocks.ChoiceBlock( + choices=[ + ("rainbow", "Colored Outlines"), + ("blue", "Blue"), + ("deep-green", "Deep Green"), + ], + required=False, + ), + ), + ( + "links", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock(required=True), + ), + ( + "aria_label", + wagtail.blocks.CharBlock(required=False), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ], + label="Link", + required=False, + ), + default=[], + label="Links", + ), + ), + ] + ), + ), + ( + "quote", + wagtail.blocks.StructBlock( + [ + ("image", pages.custom_blocks.APIImageChooserBlock()), + ("content", wagtail.blocks.RichTextBlock()), + ] + ), + ), + ] + ), + ), + ("image", pages.custom_blocks.APIImageChooserBlock(required=False)), + ("image_alt", wagtail.blocks.CharBlock(required=False)), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "id", + wagtail.blocks.RegexBlock( + error_mssages={"invalid": "not a valid id."}, + help_text="html id of this element. eg: cool_section", + regex="[a-zA-Z0-9\\-_]", + ), + ), + ( + "image_alignment", + wagtail.blocks.ChoiceBlock( + choices=[ + ("left", "Left"), + ("right", "Right"), + ("topLeft", "Top Left"), + ("topRight", "Top Right"), + ("bottomLeft", "Bottom Left"), + ("bottomRight", "Bottom Right"), + ] + ), + ), + ( + "image_size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("auto", "Auto"), + ("contain", "Contain"), + ("cover", "Cover"), + ] + ), + ), + ( + "padding", + wagtail.blocks.IntegerBlock( + help_text="Padding multiplier. default 0.", min_value=0 + ), + ), + ( + "background_color", + wagtail.blocks.RegexBlock( + error_mssages={"invalid": "not a valid hex color."}, + help_text="eg: #ff0000", + regex="#[a-zA-Z0-9]{6}", + ), + ), + ], + block_counts={ + "background_color": {"max_num": 1}, + "id": {"max_num": 1}, + "image_alignment": {"max_num": 1}, + "image_size": {"max_num": 1}, + "padding": {"max_num": 1}, + }, + required=False, + ), + ), + ] + ), + ), + ( + "section", + wagtail.blocks.StructBlock( + [ + ( + "content", + wagtail.blocks.StreamBlock( + [ + ( + "cards_block", + wagtail.blocks.StructBlock( + [ + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + pages.custom_blocks.APIRichTextBlock(), + ), + ( + "cta_block", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock( + required=True + ), + ), + ( + "aria_label", + wagtail.blocks.CharBlock( + required=False + ), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ], + label="Link", + required=False, + ), + default=[], + label="Call To Action", + max_num=1, + ), + ), + ] + ) + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "card_size", + wagtail.blocks.IntegerBlock( + help_text="Width multiplier. default 27.", + min_value=0, + ), + ), + ( + "card_style", + wagtail.blocks.ChoiceBlock( + choices=[ + ("rounded", "Rounded"), + ("square", "Square"), + ] + ), + ), + ], + block_counts={ + "card_size": {"max_num": 1}, + "card_style": {"max_num": 1}, + }, + required=False, + ), + ), + ], + label="Cards Block", + ), + ), + ("text", pages.custom_blocks.APIRichTextBlock()), + ("html", wagtail.blocks.RawHTMLBlock()), + ( + "cta_block", + wagtail.blocks.StructBlock( + [ + ( + "actions", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock(required=True), + ), + ( + "aria_label", + wagtail.blocks.CharBlock(required=False), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ], + label="Button", + required=False, + ), + default=[], + label="Actions", + max_num=2, + ), + ) + ] + ), + ), + ( + "links_group", + wagtail.blocks.StructBlock( + [ + ( + "style", + wagtail.blocks.ChoiceBlock( + choices=[ + ("rainbow", "Colored Outlines"), + ("blue", "Blue"), + ("deep-green", "Deep Green"), + ], + required=False, + ), + ), + ( + "links", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock(required=True), + ), + ( + "aria_label", + wagtail.blocks.CharBlock(required=False), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ], + label="Link", + required=False, + ), + default=[], + label="Links", + ), + ), + ] + ), + ), + ( + "quote", + wagtail.blocks.StructBlock( + [ + ("image", pages.custom_blocks.APIImageChooserBlock()), + ("content", wagtail.blocks.RichTextBlock()), + ] + ), + ), + ] + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "id", + wagtail.blocks.RegexBlock( + error_mssages={"invalid": "not a valid id."}, + help_text="html id of this element. eg: cool_section", + regex="[a-zA-Z0-9\\-_]", + ), + ), + ( + "background_color", + wagtail.blocks.RegexBlock( + error_mssages={"invalid": "not a valid hex color."}, + help_text="eg: #ff0000", + regex="#[a-zA-Z0-9]{6}", + ), + ), + ( + "padding", + wagtail.blocks.IntegerBlock( + help_text="Padding multiplier. default 0.", min_value=0 + ), + ), + ( + "text_alignment", + wagtail.blocks.ChoiceBlock( + choices=[("center", "Center"), ("left", "Left"), ("right", "Right")] + ), + ), + ], + block_counts={ + "background_color": {"max_num": 1}, + "id": {"max_num": 1}, + "padding": {"max_num": 1}, + "text_alignment": {"max_num": 1}, + }, + required=False, + ), + ), + ] + ), + ), + ( + "divider", + wagtail.blocks.StructBlock( + [ + ("image", pages.custom_blocks.APIImageChooserBlock()), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "alignment", + wagtail.blocks.ChoiceBlock( + choices=[ + ("center", "Center"), + ("content_left", "Left side of content."), + ("content_right", "Right side of content."), + ("body_left", "Left side of window."), + ("body_right", "Right side of window."), + ] + ), + ), + ( + "width", + wagtail.blocks.RegexBlock( + error_messages={ + "invalid": "must be valid css measurement. eg: 30px, 50%, 10rem" + }, + regex="^[0-9]+(px|%|rem)$", + required=False, + ), + ), + ( + "height", + wagtail.blocks.RegexBlock( + error_messages={ + "invalid": "must be valid css measurement. eg: 30px, 50%, 10rem" + }, + regex="^[0-9]+(px|%|rem)$", + required=False, + ), + ), + ( + "offset_vertical", + wagtail.blocks.RegexBlock( + error_messages={ + "invalid": "must be valid css measurement. eg: 30px, 50%, 10rem" + }, + regex="^\\-?[0-9]+(px|%|rem)$", + required=False, + ), + ), + ( + "offset_horizontal", + wagtail.blocks.RegexBlock( + error_messages={ + "invalid": "must be valid css measurement. eg: 30px, 50%, 10rem" + }, + regex="^\\-?[0-9]+(px|%|rem)$", + required=False, + ), + ), + ], + block_counts={ + "alignment": {"max_num": 1}, + "height": {"max_num": 1}, + "offset_horizontal": {"max_num": 1}, + "offset_vertical": {"max_num": 1}, + "width": {"max_num": 1}, + }, + required=False, + ), + ), + ] + ), + ), + ("html", wagtail.blocks.RawHTMLBlock()), + ], + use_json_field=True, + ), + ), + ] diff --git a/pages/migrations/0142_alter_rootpage_body.py b/pages/migrations/0142_alter_rootpage_body.py new file mode 100644 index 000000000..665c10917 --- /dev/null +++ b/pages/migrations/0142_alter_rootpage_body.py @@ -0,0 +1,786 @@ +# Generated by Django 5.0.7 on 2024-07-25 11:40 + +import pages.custom_blocks +import wagtail.blocks +import wagtail.documents.blocks +import wagtail.fields +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ("pages", "0141_alter_rootpage_body"), + ] + + operations = [ + migrations.AlterField( + model_name="rootpage", + name="body", + field=wagtail.fields.StreamField( + [ + ( + "hero", + wagtail.blocks.StructBlock( + [ + ( + "content", + wagtail.blocks.StreamBlock( + [ + ( + "cards_block", + wagtail.blocks.StructBlock( + [ + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + pages.custom_blocks.APIRichTextBlock(), + ), + ( + "cta_block", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock( + required=True + ), + ), + ( + "aria_label", + wagtail.blocks.CharBlock( + required=False + ), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ], + label="Link", + required=False, + ), + default=[], + label="Call To Action", + max_num=1, + ), + ), + ] + ) + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "card_size", + wagtail.blocks.IntegerBlock( + help_text="Width multiplier. default 27.", + min_value=0, + ), + ), + ( + "card_style", + wagtail.blocks.ChoiceBlock( + choices=[ + ("rounded", "Rounded"), + ("square", "Square"), + ] + ), + ), + ], + block_counts={ + "card_size": {"max_num": 1}, + "card_style": {"max_num": 1}, + }, + required=False, + ), + ), + ], + label="Cards Block", + ), + ), + ("text", pages.custom_blocks.APIRichTextBlock()), + ("html", wagtail.blocks.RawHTMLBlock()), + ( + "cta_block", + wagtail.blocks.StructBlock( + [ + ( + "actions", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock(required=True), + ), + ( + "aria_label", + wagtail.blocks.CharBlock(required=False), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ], + label="Button", + required=False, + ), + default=[], + label="Actions", + max_num=2, + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "priority", + wagtail.blocks.ChoiceBlock( + choices=[ + ("descending", "Descending"), + ("equal", "Equal"), + ] + ), + ) + ], + block_counts={"priority": {"max_num": 1}}, + required=False, + ), + ), + ] + ), + ), + ( + "links_group", + wagtail.blocks.StructBlock( + [ + ( + "links", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock(required=True), + ), + ( + "aria_label", + wagtail.blocks.CharBlock(required=False), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ], + label="Link", + required=False, + ), + default=[], + label="Links", + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "color", + wagtail.blocks.ChoiceBlock( + choices=[ + ("white", "White"), + ("blue", "Blue"), + ("deep-green", "Deep Green"), + ] + ), + ) + ], + block_counts={"color": {"max_num": 1}}, + required=False, + ), + ), + ] + ), + ), + ( + "quote", + wagtail.blocks.StructBlock( + [ + ("image", pages.custom_blocks.APIImageChooserBlock()), + ("content", wagtail.blocks.RichTextBlock()), + ] + ), + ), + ] + ), + ), + ("image", pages.custom_blocks.APIImageChooserBlock(required=False)), + ("image_alt", wagtail.blocks.CharBlock(required=False)), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "id", + wagtail.blocks.RegexBlock( + error_mssages={"invalid": "not a valid id."}, + help_text="html id of this element. eg: cool_section", + regex="[a-zA-Z0-9\\-_]", + ), + ), + ( + "image_alignment", + wagtail.blocks.ChoiceBlock( + choices=[ + ("left", "Left"), + ("right", "Right"), + ("topLeft", "Top Left"), + ("topRight", "Top Right"), + ("bottomLeft", "Bottom Left"), + ("bottomRight", "Bottom Right"), + ] + ), + ), + ( + "image_size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("auto", "Auto"), + ("contain", "Contain"), + ("cover", "Cover"), + ] + ), + ), + ( + "padding", + wagtail.blocks.IntegerBlock( + help_text="Padding multiplier. default 0.", min_value=0 + ), + ), + ( + "background_color", + wagtail.blocks.RegexBlock( + error_mssages={"invalid": "not a valid hex color."}, + help_text="eg: #ff0000", + regex="#[a-zA-Z0-9]{6}", + ), + ), + ], + block_counts={ + "background_color": {"max_num": 1}, + "id": {"max_num": 1}, + "image_alignment": {"max_num": 1}, + "image_size": {"max_num": 1}, + "padding": {"max_num": 1}, + }, + required=False, + ), + ), + ] + ), + ), + ( + "section", + wagtail.blocks.StructBlock( + [ + ( + "content", + wagtail.blocks.StreamBlock( + [ + ( + "cards_block", + wagtail.blocks.StructBlock( + [ + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + pages.custom_blocks.APIRichTextBlock(), + ), + ( + "cta_block", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock( + required=True + ), + ), + ( + "aria_label", + wagtail.blocks.CharBlock( + required=False + ), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ], + label="Link", + required=False, + ), + default=[], + label="Call To Action", + max_num=1, + ), + ), + ] + ) + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "card_size", + wagtail.blocks.IntegerBlock( + help_text="Width multiplier. default 27.", + min_value=0, + ), + ), + ( + "card_style", + wagtail.blocks.ChoiceBlock( + choices=[ + ("rounded", "Rounded"), + ("square", "Square"), + ] + ), + ), + ], + block_counts={ + "card_size": {"max_num": 1}, + "card_style": {"max_num": 1}, + }, + required=False, + ), + ), + ], + label="Cards Block", + ), + ), + ("text", pages.custom_blocks.APIRichTextBlock()), + ("html", wagtail.blocks.RawHTMLBlock()), + ( + "cta_block", + wagtail.blocks.StructBlock( + [ + ( + "actions", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock(required=True), + ), + ( + "aria_label", + wagtail.blocks.CharBlock(required=False), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ], + label="Button", + required=False, + ), + default=[], + label="Actions", + max_num=2, + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "priority", + wagtail.blocks.ChoiceBlock( + choices=[ + ("descending", "Descending"), + ("equal", "Equal"), + ] + ), + ) + ], + block_counts={"priority": {"max_num": 1}}, + required=False, + ), + ), + ] + ), + ), + ( + "links_group", + wagtail.blocks.StructBlock( + [ + ( + "links", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock(required=True), + ), + ( + "aria_label", + wagtail.blocks.CharBlock(required=False), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ], + label="Link", + required=False, + ), + default=[], + label="Links", + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "color", + wagtail.blocks.ChoiceBlock( + choices=[ + ("white", "White"), + ("blue", "Blue"), + ("deep-green", "Deep Green"), + ] + ), + ) + ], + block_counts={"color": {"max_num": 1}}, + required=False, + ), + ), + ] + ), + ), + ( + "quote", + wagtail.blocks.StructBlock( + [ + ("image", pages.custom_blocks.APIImageChooserBlock()), + ("content", wagtail.blocks.RichTextBlock()), + ] + ), + ), + ] + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "id", + wagtail.blocks.RegexBlock( + error_mssages={"invalid": "not a valid id."}, + help_text="html id of this element. eg: cool_section", + regex="[a-zA-Z0-9\\-_]", + ), + ), + ( + "background_color", + wagtail.blocks.RegexBlock( + error_mssages={"invalid": "not a valid hex color."}, + help_text="eg: #ff0000", + regex="#[a-zA-Z0-9]{6}", + ), + ), + ( + "padding", + wagtail.blocks.IntegerBlock( + help_text="Padding multiplier. default 0.", min_value=0 + ), + ), + ( + "text_alignment", + wagtail.blocks.ChoiceBlock( + choices=[("center", "Center"), ("left", "Left"), ("right", "Right")] + ), + ), + ], + block_counts={ + "background_color": {"max_num": 1}, + "id": {"max_num": 1}, + "padding": {"max_num": 1}, + "text_alignment": {"max_num": 1}, + }, + required=False, + ), + ), + ] + ), + ), + ( + "divider", + wagtail.blocks.StructBlock( + [ + ("image", pages.custom_blocks.APIImageChooserBlock()), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "alignment", + wagtail.blocks.ChoiceBlock( + choices=[ + ("center", "Center"), + ("content_left", "Left side of content."), + ("content_right", "Right side of content."), + ("body_left", "Left side of window."), + ("body_right", "Right side of window."), + ] + ), + ), + ( + "width", + wagtail.blocks.RegexBlock( + error_messages={ + "invalid": "must be valid css measurement. eg: 30px, 50%, 10rem" + }, + regex="^[0-9]+(px|%|rem)$", + required=False, + ), + ), + ( + "height", + wagtail.blocks.RegexBlock( + error_messages={ + "invalid": "must be valid css measurement. eg: 30px, 50%, 10rem" + }, + regex="^[0-9]+(px|%|rem)$", + required=False, + ), + ), + ( + "offset_vertical", + wagtail.blocks.RegexBlock( + error_messages={ + "invalid": "must be valid css measurement. eg: 30px, 50%, 10rem" + }, + regex="^\\-?[0-9]+(px|%|rem)$", + required=False, + ), + ), + ( + "offset_horizontal", + wagtail.blocks.RegexBlock( + error_messages={ + "invalid": "must be valid css measurement. eg: 30px, 50%, 10rem" + }, + regex="^\\-?[0-9]+(px|%|rem)$", + required=False, + ), + ), + ], + block_counts={ + "alignment": {"max_num": 1}, + "height": {"max_num": 1}, + "offset_horizontal": {"max_num": 1}, + "offset_vertical": {"max_num": 1}, + "width": {"max_num": 1}, + }, + required=False, + ), + ), + ] + ), + ), + ("html", wagtail.blocks.RawHTMLBlock()), + ], + use_json_field=True, + ), + ), + ] diff --git a/pages/migrations/0143_alter_rootpage_body_alter_rootpage_layout.py b/pages/migrations/0143_alter_rootpage_body_alter_rootpage_layout.py new file mode 100644 index 000000000..b3283c636 --- /dev/null +++ b/pages/migrations/0143_alter_rootpage_body_alter_rootpage_layout.py @@ -0,0 +1,985 @@ +# Generated by Django 5.0.7 on 2024-07-25 12:29 + +import pages.custom_blocks +import wagtail.blocks +import wagtail.documents.blocks +import wagtail.fields +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ("pages", "0142_alter_rootpage_body"), + ] + + operations = [ + migrations.AlterField( + model_name="rootpage", + name="body", + field=wagtail.fields.StreamField( + [ + ( + "hero", + wagtail.blocks.StructBlock( + [ + ( + "content", + wagtail.blocks.StreamBlock( + [ + ( + "cards_block", + wagtail.blocks.StructBlock( + [ + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + pages.custom_blocks.APIRichTextBlock(), + ), + ( + "cta_block", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock( + required=True + ), + ), + ( + "aria_label", + wagtail.blocks.CharBlock( + required=False + ), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "style", + wagtail.blocks.ChoiceBlock( + choices=[ + ( + "primary", + "Primary", + ), + ( + "white", + "White", + ), + ( + "blue-outline", + "Blue Outline", + ), + ( + "deep-green", + "Deep Green Outline", + ), + ] + ), + ) + ], + block_counts={ + "style": { + "max_num": 1 + } + }, + required=False, + ), + ), + ], + label="Link", + required=False, + ), + default=[], + label="Call To Action", + max_num=1, + ), + ), + ] + ) + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "card_size", + wagtail.blocks.IntegerBlock( + help_text="Width multiplier. default 27.", + min_value=0, + ), + ), + ( + "card_style", + wagtail.blocks.ChoiceBlock( + choices=[ + ("rounded", "Rounded"), + ("square", "Square"), + ] + ), + ), + ], + block_counts={ + "card_size": {"max_num": 1}, + "card_style": {"max_num": 1}, + }, + required=False, + ), + ), + ], + label="Cards Block", + ), + ), + ("text", pages.custom_blocks.APIRichTextBlock()), + ("html", wagtail.blocks.RawHTMLBlock()), + ( + "cta_block", + wagtail.blocks.StructBlock( + [ + ( + "actions", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock(required=True), + ), + ( + "aria_label", + wagtail.blocks.CharBlock(required=False), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "style", + wagtail.blocks.ChoiceBlock( + choices=[ + ("primary", "Primary"), + ("white", "White"), + ( + "blue-outline", + "Blue Outline", + ), + ( + "deep-green", + "Deep Green Outline", + ), + ] + ), + ) + ], + block_counts={"style": {"max_num": 1}}, + required=False, + ), + ), + ], + label="Button", + required=False, + ), + default=[], + label="Actions", + max_num=2, + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "priority", + wagtail.blocks.ChoiceBlock( + choices=[ + ("descending", "Descending"), + ("equal", "Equal"), + ] + ), + ) + ], + block_counts={"priority": {"max_num": 1}}, + required=False, + ), + ), + ] + ), + ), + ( + "links_group", + wagtail.blocks.StructBlock( + [ + ( + "links", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock(required=True), + ), + ( + "aria_label", + wagtail.blocks.CharBlock(required=False), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ], + label="Link", + required=False, + ), + default=[], + label="Links", + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "color", + wagtail.blocks.ChoiceBlock( + choices=[ + ("white", "White"), + ("blue", "Blue"), + ("deep-green", "Deep Green"), + ] + ), + ) + ], + block_counts={"color": {"max_num": 1}}, + required=False, + ), + ), + ] + ), + ), + ( + "quote", + wagtail.blocks.StructBlock( + [ + ("image", pages.custom_blocks.APIImageChooserBlock()), + ("content", wagtail.blocks.RichTextBlock()), + ] + ), + ), + ] + ), + ), + ("image", pages.custom_blocks.APIImageChooserBlock(required=False)), + ("image_alt", wagtail.blocks.CharBlock(required=False)), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "id", + wagtail.blocks.RegexBlock( + error_mssages={"invalid": "not a valid id."}, + help_text="html id of this element. eg: cool_section", + regex="[a-zA-Z0-9\\-_]", + ), + ), + ( + "image_alignment", + wagtail.blocks.ChoiceBlock( + choices=[ + ("left", "Left"), + ("right", "Right"), + ("topLeft", "Top Left"), + ("topRight", "Top Right"), + ("bottomLeft", "Bottom Left"), + ("bottomRight", "Bottom Right"), + ] + ), + ), + ( + "image_size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("auto", "Auto"), + ("contain", "Contain"), + ("cover", "Cover"), + ] + ), + ), + ( + "padding", + wagtail.blocks.IntegerBlock( + help_text="Padding multiplier. default 0.", min_value=0 + ), + ), + ( + "background_color", + wagtail.blocks.RegexBlock( + error_mssages={"invalid": "not a valid hex color."}, + help_text="eg: #ff0000", + regex="#[a-zA-Z0-9]{6}", + ), + ), + ], + block_counts={ + "background_color": {"max_num": 1}, + "id": {"max_num": 1}, + "image_alignment": {"max_num": 1}, + "image_size": {"max_num": 1}, + "padding": {"max_num": 1}, + }, + required=False, + ), + ), + ] + ), + ), + ( + "section", + wagtail.blocks.StructBlock( + [ + ( + "content", + wagtail.blocks.StreamBlock( + [ + ( + "cards_block", + wagtail.blocks.StructBlock( + [ + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + pages.custom_blocks.APIRichTextBlock(), + ), + ( + "cta_block", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock( + required=True + ), + ), + ( + "aria_label", + wagtail.blocks.CharBlock( + required=False + ), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "style", + wagtail.blocks.ChoiceBlock( + choices=[ + ( + "primary", + "Primary", + ), + ( + "white", + "White", + ), + ( + "blue-outline", + "Blue Outline", + ), + ( + "deep-green", + "Deep Green Outline", + ), + ] + ), + ) + ], + block_counts={ + "style": { + "max_num": 1 + } + }, + required=False, + ), + ), + ], + label="Link", + required=False, + ), + default=[], + label="Call To Action", + max_num=1, + ), + ), + ] + ) + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "card_size", + wagtail.blocks.IntegerBlock( + help_text="Width multiplier. default 27.", + min_value=0, + ), + ), + ( + "card_style", + wagtail.blocks.ChoiceBlock( + choices=[ + ("rounded", "Rounded"), + ("square", "Square"), + ] + ), + ), + ], + block_counts={ + "card_size": {"max_num": 1}, + "card_style": {"max_num": 1}, + }, + required=False, + ), + ), + ], + label="Cards Block", + ), + ), + ("text", pages.custom_blocks.APIRichTextBlock()), + ("html", wagtail.blocks.RawHTMLBlock()), + ( + "cta_block", + wagtail.blocks.StructBlock( + [ + ( + "actions", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock(required=True), + ), + ( + "aria_label", + wagtail.blocks.CharBlock(required=False), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "style", + wagtail.blocks.ChoiceBlock( + choices=[ + ("primary", "Primary"), + ("white", "White"), + ( + "blue-outline", + "Blue Outline", + ), + ( + "deep-green", + "Deep Green Outline", + ), + ] + ), + ) + ], + block_counts={"style": {"max_num": 1}}, + required=False, + ), + ), + ], + label="Button", + required=False, + ), + default=[], + label="Actions", + max_num=2, + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "priority", + wagtail.blocks.ChoiceBlock( + choices=[ + ("descending", "Descending"), + ("equal", "Equal"), + ] + ), + ) + ], + block_counts={"priority": {"max_num": 1}}, + required=False, + ), + ), + ] + ), + ), + ( + "links_group", + wagtail.blocks.StructBlock( + [ + ( + "links", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock(required=True), + ), + ( + "aria_label", + wagtail.blocks.CharBlock(required=False), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ], + label="Link", + required=False, + ), + default=[], + label="Links", + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "color", + wagtail.blocks.ChoiceBlock( + choices=[ + ("white", "White"), + ("blue", "Blue"), + ("deep-green", "Deep Green"), + ] + ), + ) + ], + block_counts={"color": {"max_num": 1}}, + required=False, + ), + ), + ] + ), + ), + ( + "quote", + wagtail.blocks.StructBlock( + [ + ("image", pages.custom_blocks.APIImageChooserBlock()), + ("content", wagtail.blocks.RichTextBlock()), + ] + ), + ), + ] + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "id", + wagtail.blocks.RegexBlock( + error_mssages={"invalid": "not a valid id."}, + help_text="html id of this element. eg: cool_section", + regex="[a-zA-Z0-9\\-_]", + ), + ), + ( + "background_color", + wagtail.blocks.RegexBlock( + error_mssages={"invalid": "not a valid hex color."}, + help_text="eg: #ff0000", + regex="#[a-zA-Z0-9]{6}", + ), + ), + ( + "padding", + wagtail.blocks.IntegerBlock( + help_text="Padding multiplier. default 0.", min_value=0 + ), + ), + ( + "text_alignment", + wagtail.blocks.ChoiceBlock( + choices=[("center", "Center"), ("left", "Left"), ("right", "Right")] + ), + ), + ], + block_counts={ + "background_color": {"max_num": 1}, + "id": {"max_num": 1}, + "padding": {"max_num": 1}, + "text_alignment": {"max_num": 1}, + }, + required=False, + ), + ), + ] + ), + ), + ( + "divider", + wagtail.blocks.StructBlock( + [ + ("image", pages.custom_blocks.APIImageChooserBlock()), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "alignment", + wagtail.blocks.ChoiceBlock( + choices=[ + ("center", "Center"), + ("content_left", "Left side of content."), + ("content_right", "Right side of content."), + ("body_left", "Left side of window."), + ("body_right", "Right side of window."), + ] + ), + ), + ( + "width", + wagtail.blocks.RegexBlock( + error_messages={ + "invalid": "must be valid css measurement. eg: 30px, 50%, 10rem" + }, + regex="^[0-9]+(px|%|rem)$", + required=False, + ), + ), + ( + "height", + wagtail.blocks.RegexBlock( + error_messages={ + "invalid": "must be valid css measurement. eg: 30px, 50%, 10rem" + }, + regex="^[0-9]+(px|%|rem)$", + required=False, + ), + ), + ( + "offset_vertical", + wagtail.blocks.RegexBlock( + error_messages={ + "invalid": "must be valid css measurement. eg: 30px, 50%, 10rem" + }, + regex="^\\-?[0-9]+(px|%|rem)$", + required=False, + ), + ), + ( + "offset_horizontal", + wagtail.blocks.RegexBlock( + error_messages={ + "invalid": "must be valid css measurement. eg: 30px, 50%, 10rem" + }, + regex="^\\-?[0-9]+(px|%|rem)$", + required=False, + ), + ), + ], + block_counts={ + "alignment": {"max_num": 1}, + "height": {"max_num": 1}, + "offset_horizontal": {"max_num": 1}, + "offset_vertical": {"max_num": 1}, + "width": {"max_num": 1}, + }, + required=False, + ), + ), + ] + ), + ), + ("html", wagtail.blocks.RawHTMLBlock()), + ], + use_json_field=True, + ), + ), + migrations.AlterField( + model_name="rootpage", + name="layout", + field=wagtail.fields.StreamField( + [ + ("default", wagtail.blocks.StructBlock([])), + ( + "landing", + wagtail.blocks.StructBlock( + [ + ( + "nav_links", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("text", wagtail.blocks.CharBlock(required=True)), + ("aria_label", wagtail.blocks.CharBlock(required=False)), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ("external", wagtail.blocks.URLBlock(required=False)), + ( + "internal", + wagtail.blocks.PageChooserBlock(required=False), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ("anchor", wagtail.blocks.CharBlock(required=False)), + ], + required=True, + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "style", + wagtail.blocks.ChoiceBlock( + choices=[ + ("primary", "Primary"), + ("white", "White"), + ("blue-outline", "Blue Outline"), + ("deep-green", "Deep Green Outline"), + ] + ), + ) + ], + block_counts={"style": {"max_num": 1}}, + required=False, + ), + ), + ], + label="Link", + required=False, + ), + default=[], + label="Nav Links", + ), + ) + ], + label="Landing Page", + ), + ), + ], + blank=True, + default=[], + use_json_field=True, + ), + ), + ] diff --git a/pages/migrations/0144_alter_rootpage_body_alter_rootpage_layout.py b/pages/migrations/0144_alter_rootpage_body_alter_rootpage_layout.py new file mode 100644 index 000000000..56b02c895 --- /dev/null +++ b/pages/migrations/0144_alter_rootpage_body_alter_rootpage_layout.py @@ -0,0 +1,985 @@ +# Generated by Django 5.0.7 on 2024-07-25 13:01 + +import pages.custom_blocks +import wagtail.blocks +import wagtail.documents.blocks +import wagtail.fields +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ("pages", "0143_alter_rootpage_body_alter_rootpage_layout"), + ] + + operations = [ + migrations.AlterField( + model_name="rootpage", + name="body", + field=wagtail.fields.StreamField( + [ + ( + "hero", + wagtail.blocks.StructBlock( + [ + ( + "content", + wagtail.blocks.StreamBlock( + [ + ( + "cards_block", + wagtail.blocks.StructBlock( + [ + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + pages.custom_blocks.APIRichTextBlock(), + ), + ( + "cta_block", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock( + required=True + ), + ), + ( + "aria_label", + wagtail.blocks.CharBlock( + required=False + ), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "style", + wagtail.blocks.ChoiceBlock( + choices=[ + ( + "primary", + "Primary", + ), + ( + "white", + "White", + ), + ( + "blue_outline", + "Blue Outline", + ), + ( + "deep_green_outline", + "Deep Green Outline", + ), + ] + ), + ) + ], + block_counts={ + "style": { + "max_num": 1 + } + }, + required=False, + ), + ), + ], + label="Link", + required=False, + ), + default=[], + label="Call To Action", + max_num=1, + ), + ), + ] + ) + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "card_size", + wagtail.blocks.IntegerBlock( + help_text="Width multiplier. default 27.", + min_value=0, + ), + ), + ( + "card_style", + wagtail.blocks.ChoiceBlock( + choices=[ + ("rounded", "Rounded"), + ("square", "Square"), + ] + ), + ), + ], + block_counts={ + "card_size": {"max_num": 1}, + "card_style": {"max_num": 1}, + }, + required=False, + ), + ), + ], + label="Cards Block", + ), + ), + ("text", pages.custom_blocks.APIRichTextBlock()), + ("html", wagtail.blocks.RawHTMLBlock()), + ( + "cta_block", + wagtail.blocks.StructBlock( + [ + ( + "actions", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock(required=True), + ), + ( + "aria_label", + wagtail.blocks.CharBlock(required=False), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "style", + wagtail.blocks.ChoiceBlock( + choices=[ + ("primary", "Primary"), + ("white", "White"), + ( + "blue_outline", + "Blue Outline", + ), + ( + "deep_green_outline", + "Deep Green Outline", + ), + ] + ), + ) + ], + block_counts={"style": {"max_num": 1}}, + required=False, + ), + ), + ], + label="Button", + required=False, + ), + default=[], + label="Actions", + max_num=2, + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "priority", + wagtail.blocks.ChoiceBlock( + choices=[ + ("descending", "Descending"), + ("equal", "Equal"), + ] + ), + ) + ], + block_counts={"priority": {"max_num": 1}}, + required=False, + ), + ), + ] + ), + ), + ( + "links_group", + wagtail.blocks.StructBlock( + [ + ( + "links", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock(required=True), + ), + ( + "aria_label", + wagtail.blocks.CharBlock(required=False), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ], + label="Link", + required=False, + ), + default=[], + label="Links", + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "color", + wagtail.blocks.ChoiceBlock( + choices=[ + ("white", "White"), + ("blue", "Blue"), + ("deep_green", "Deep Green"), + ] + ), + ) + ], + block_counts={"color": {"max_num": 1}}, + required=False, + ), + ), + ] + ), + ), + ( + "quote", + wagtail.blocks.StructBlock( + [ + ("image", pages.custom_blocks.APIImageChooserBlock()), + ("content", wagtail.blocks.RichTextBlock()), + ] + ), + ), + ] + ), + ), + ("image", pages.custom_blocks.APIImageChooserBlock(required=False)), + ("image_alt", wagtail.blocks.CharBlock(required=False)), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "id", + wagtail.blocks.RegexBlock( + error_mssages={"invalid": "not a valid id."}, + help_text="html id of this element. eg: cool_section", + regex="[a-zA-Z0-9\\-_]", + ), + ), + ( + "image_alignment", + wagtail.blocks.ChoiceBlock( + choices=[ + ("left", "Left"), + ("right", "Right"), + ("topLeft", "Top Left"), + ("topRight", "Top Right"), + ("bottomLeft", "Bottom Left"), + ("bottomRight", "Bottom Right"), + ] + ), + ), + ( + "image_size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("auto", "Auto"), + ("contain", "Contain"), + ("cover", "Cover"), + ] + ), + ), + ( + "padding", + wagtail.blocks.IntegerBlock( + help_text="Padding multiplier. default 0.", min_value=0 + ), + ), + ( + "background_color", + wagtail.blocks.RegexBlock( + error_mssages={"invalid": "not a valid hex color."}, + help_text="eg: #ff0000", + regex="#[a-zA-Z0-9]{6}", + ), + ), + ], + block_counts={ + "background_color": {"max_num": 1}, + "id": {"max_num": 1}, + "image_alignment": {"max_num": 1}, + "image_size": {"max_num": 1}, + "padding": {"max_num": 1}, + }, + required=False, + ), + ), + ] + ), + ), + ( + "section", + wagtail.blocks.StructBlock( + [ + ( + "content", + wagtail.blocks.StreamBlock( + [ + ( + "cards_block", + wagtail.blocks.StructBlock( + [ + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + pages.custom_blocks.APIRichTextBlock(), + ), + ( + "cta_block", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock( + required=True + ), + ), + ( + "aria_label", + wagtail.blocks.CharBlock( + required=False + ), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "style", + wagtail.blocks.ChoiceBlock( + choices=[ + ( + "primary", + "Primary", + ), + ( + "white", + "White", + ), + ( + "blue_outline", + "Blue Outline", + ), + ( + "deep_green_outline", + "Deep Green Outline", + ), + ] + ), + ) + ], + block_counts={ + "style": { + "max_num": 1 + } + }, + required=False, + ), + ), + ], + label="Link", + required=False, + ), + default=[], + label="Call To Action", + max_num=1, + ), + ), + ] + ) + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "card_size", + wagtail.blocks.IntegerBlock( + help_text="Width multiplier. default 27.", + min_value=0, + ), + ), + ( + "card_style", + wagtail.blocks.ChoiceBlock( + choices=[ + ("rounded", "Rounded"), + ("square", "Square"), + ] + ), + ), + ], + block_counts={ + "card_size": {"max_num": 1}, + "card_style": {"max_num": 1}, + }, + required=False, + ), + ), + ], + label="Cards Block", + ), + ), + ("text", pages.custom_blocks.APIRichTextBlock()), + ("html", wagtail.blocks.RawHTMLBlock()), + ( + "cta_block", + wagtail.blocks.StructBlock( + [ + ( + "actions", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock(required=True), + ), + ( + "aria_label", + wagtail.blocks.CharBlock(required=False), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "style", + wagtail.blocks.ChoiceBlock( + choices=[ + ("primary", "Primary"), + ("white", "White"), + ( + "blue_outline", + "Blue Outline", + ), + ( + "deep_green_outline", + "Deep Green Outline", + ), + ] + ), + ) + ], + block_counts={"style": {"max_num": 1}}, + required=False, + ), + ), + ], + label="Button", + required=False, + ), + default=[], + label="Actions", + max_num=2, + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "priority", + wagtail.blocks.ChoiceBlock( + choices=[ + ("descending", "Descending"), + ("equal", "Equal"), + ] + ), + ) + ], + block_counts={"priority": {"max_num": 1}}, + required=False, + ), + ), + ] + ), + ), + ( + "links_group", + wagtail.blocks.StructBlock( + [ + ( + "links", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock(required=True), + ), + ( + "aria_label", + wagtail.blocks.CharBlock(required=False), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ], + label="Link", + required=False, + ), + default=[], + label="Links", + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "color", + wagtail.blocks.ChoiceBlock( + choices=[ + ("white", "White"), + ("blue", "Blue"), + ("deep_green", "Deep Green"), + ] + ), + ) + ], + block_counts={"color": {"max_num": 1}}, + required=False, + ), + ), + ] + ), + ), + ( + "quote", + wagtail.blocks.StructBlock( + [ + ("image", pages.custom_blocks.APIImageChooserBlock()), + ("content", wagtail.blocks.RichTextBlock()), + ] + ), + ), + ] + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "id", + wagtail.blocks.RegexBlock( + error_mssages={"invalid": "not a valid id."}, + help_text="html id of this element. eg: cool_section", + regex="[a-zA-Z0-9\\-_]", + ), + ), + ( + "background_color", + wagtail.blocks.RegexBlock( + error_mssages={"invalid": "not a valid hex color."}, + help_text="eg: #ff0000", + regex="#[a-zA-Z0-9]{6}", + ), + ), + ( + "padding", + wagtail.blocks.IntegerBlock( + help_text="Padding multiplier. default 0.", min_value=0 + ), + ), + ( + "text_alignment", + wagtail.blocks.ChoiceBlock( + choices=[("center", "Center"), ("left", "Left"), ("right", "Right")] + ), + ), + ], + block_counts={ + "background_color": {"max_num": 1}, + "id": {"max_num": 1}, + "padding": {"max_num": 1}, + "text_alignment": {"max_num": 1}, + }, + required=False, + ), + ), + ] + ), + ), + ( + "divider", + wagtail.blocks.StructBlock( + [ + ("image", pages.custom_blocks.APIImageChooserBlock()), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "alignment", + wagtail.blocks.ChoiceBlock( + choices=[ + ("center", "Center"), + ("content_left", "Left side of content."), + ("content_right", "Right side of content."), + ("body_left", "Left side of window."), + ("body_right", "Right side of window."), + ] + ), + ), + ( + "width", + wagtail.blocks.RegexBlock( + error_messages={ + "invalid": "must be valid css measurement. eg: 30px, 50%, 10rem" + }, + regex="^[0-9]+(px|%|rem)$", + required=False, + ), + ), + ( + "height", + wagtail.blocks.RegexBlock( + error_messages={ + "invalid": "must be valid css measurement. eg: 30px, 50%, 10rem" + }, + regex="^[0-9]+(px|%|rem)$", + required=False, + ), + ), + ( + "offset_vertical", + wagtail.blocks.RegexBlock( + error_messages={ + "invalid": "must be valid css measurement. eg: 30px, 50%, 10rem" + }, + regex="^\\-?[0-9]+(px|%|rem)$", + required=False, + ), + ), + ( + "offset_horizontal", + wagtail.blocks.RegexBlock( + error_messages={ + "invalid": "must be valid css measurement. eg: 30px, 50%, 10rem" + }, + regex="^\\-?[0-9]+(px|%|rem)$", + required=False, + ), + ), + ], + block_counts={ + "alignment": {"max_num": 1}, + "height": {"max_num": 1}, + "offset_horizontal": {"max_num": 1}, + "offset_vertical": {"max_num": 1}, + "width": {"max_num": 1}, + }, + required=False, + ), + ), + ] + ), + ), + ("html", wagtail.blocks.RawHTMLBlock()), + ], + use_json_field=True, + ), + ), + migrations.AlterField( + model_name="rootpage", + name="layout", + field=wagtail.fields.StreamField( + [ + ("default", wagtail.blocks.StructBlock([])), + ( + "landing", + wagtail.blocks.StructBlock( + [ + ( + "nav_links", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("text", wagtail.blocks.CharBlock(required=True)), + ("aria_label", wagtail.blocks.CharBlock(required=False)), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ("external", wagtail.blocks.URLBlock(required=False)), + ( + "internal", + wagtail.blocks.PageChooserBlock(required=False), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ("anchor", wagtail.blocks.CharBlock(required=False)), + ], + required=True, + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "style", + wagtail.blocks.ChoiceBlock( + choices=[ + ("primary", "Primary"), + ("white", "White"), + ("blue_outline", "Blue Outline"), + ("deep_green_outline", "Deep Green Outline"), + ] + ), + ) + ], + block_counts={"style": {"max_num": 1}}, + required=False, + ), + ), + ], + label="Link", + required=False, + ), + default=[], + label="Nav Links", + ), + ) + ], + label="Landing Page", + ), + ), + ], + blank=True, + default=[], + use_json_field=True, + ), + ), + ] diff --git a/pages/migrations/0145_alter_rootpage_body_alter_rootpage_layout.py b/pages/migrations/0145_alter_rootpage_body_alter_rootpage_layout.py new file mode 100644 index 000000000..acf232202 --- /dev/null +++ b/pages/migrations/0145_alter_rootpage_body_alter_rootpage_layout.py @@ -0,0 +1,989 @@ +# Generated by Django 5.0.7 on 2024-07-25 16:08 + +import pages.custom_blocks +import wagtail.blocks +import wagtail.documents.blocks +import wagtail.fields +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ("pages", "0144_alter_rootpage_body_alter_rootpage_layout"), + ] + + operations = [ + migrations.AlterField( + model_name="rootpage", + name="body", + field=wagtail.fields.StreamField( + [ + ( + "hero", + wagtail.blocks.StructBlock( + [ + ( + "content", + wagtail.blocks.StreamBlock( + [ + ( + "cards_block", + wagtail.blocks.StructBlock( + [ + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + pages.custom_blocks.APIRichTextBlock(), + ), + ( + "cta_block", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock( + required=True + ), + ), + ( + "aria_label", + wagtail.blocks.CharBlock( + required=False + ), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "style", + wagtail.blocks.ChoiceBlock( + choices=[ + ( + "orange", + "Orange", + ), + ( + "white", + "White", + ), + ( + "blue_outline", + "Blue Outline", + ), + ( + "deep_green_outline", + "Deep Green Outline", + ), + ] + ), + ) + ], + block_counts={ + "style": { + "max_num": 1 + } + }, + required=False, + ), + ), + ], + label="Link", + required=False, + ), + default=[], + label="Call To Action", + max_num=1, + ), + ), + ] + ) + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "card_size", + wagtail.blocks.IntegerBlock( + help_text="Width multiplier. default 27.", + min_value=0, + ), + ), + ( + "card_style", + wagtail.blocks.ChoiceBlock( + choices=[ + ("rounded", "Rounded"), + ("square", "Square"), + ] + ), + ), + ], + block_counts={ + "card_size": {"max_num": 1}, + "card_style": {"max_num": 1}, + }, + required=False, + ), + ), + ], + label="Cards Block", + ), + ), + ("text", pages.custom_blocks.APIRichTextBlock()), + ("html", wagtail.blocks.RawHTMLBlock()), + ( + "cta_block", + wagtail.blocks.StructBlock( + [ + ( + "actions", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock(required=True), + ), + ( + "aria_label", + wagtail.blocks.CharBlock(required=False), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "style", + wagtail.blocks.ChoiceBlock( + choices=[ + ("orange", "Orange"), + ("white", "White"), + ( + "blue_outline", + "Blue Outline", + ), + ( + "deep_green_outline", + "Deep Green Outline", + ), + ] + ), + ) + ], + block_counts={"style": {"max_num": 1}}, + required=False, + ), + ), + ], + label="Button", + required=False, + ), + default=[], + label="Actions", + max_num=2, + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "priority", + wagtail.blocks.ChoiceBlock( + choices=[ + ("descending", "Descending"), + ("equal", "Equal"), + ] + ), + ) + ], + block_counts={"priority": {"max_num": 1}}, + required=False, + ), + ), + ] + ), + ), + ( + "links_group", + wagtail.blocks.StructBlock( + [ + ( + "links", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock(required=True), + ), + ( + "aria_label", + wagtail.blocks.CharBlock(required=False), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ], + label="Link", + required=False, + ), + default=[], + label="Links", + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "color", + wagtail.blocks.ChoiceBlock( + choices=[ + ("white", "White"), + ("blue", "Blue"), + ("deep-green", "Deep Green"), + ] + ), + ) + ], + block_counts={"color": {"max_num": 1}}, + required=False, + ), + ), + ] + ), + ), + ( + "quote", + wagtail.blocks.StructBlock( + [ + ("image", pages.custom_blocks.APIImageChooserBlock()), + ("content", wagtail.blocks.RichTextBlock()), + ("name", wagtail.blocks.CharBlock()), + ("title", wagtail.blocks.CharBlock(requred=False)), + ] + ), + ), + ] + ), + ), + ("image", pages.custom_blocks.APIImageChooserBlock(required=False)), + ("image_alt", wagtail.blocks.CharBlock(required=False)), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "id", + wagtail.blocks.RegexBlock( + error_mssages={"invalid": "not a valid id."}, + help_text="html id of this element. eg: cool_section", + regex="[a-zA-Z0-9\\-_]", + ), + ), + ( + "image_alignment", + wagtail.blocks.ChoiceBlock( + choices=[ + ("left", "Left"), + ("right", "Right"), + ("topLeft", "Top Left"), + ("topRight", "Top Right"), + ("bottomLeft", "Bottom Left"), + ("bottomRight", "Bottom Right"), + ] + ), + ), + ( + "image_size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("auto", "Auto"), + ("contain", "Contain"), + ("cover", "Cover"), + ] + ), + ), + ( + "padding", + wagtail.blocks.IntegerBlock( + help_text="Padding multiplier. default 0.", min_value=0 + ), + ), + ( + "background_color", + wagtail.blocks.RegexBlock( + error_mssages={"invalid": "not a valid hex color."}, + help_text="eg: #ff0000", + regex="#[a-zA-Z0-9]{6}", + ), + ), + ], + block_counts={ + "background_color": {"max_num": 1}, + "id": {"max_num": 1}, + "image_alignment": {"max_num": 1}, + "image_size": {"max_num": 1}, + "padding": {"max_num": 1}, + }, + required=False, + ), + ), + ] + ), + ), + ( + "section", + wagtail.blocks.StructBlock( + [ + ( + "content", + wagtail.blocks.StreamBlock( + [ + ( + "cards_block", + wagtail.blocks.StructBlock( + [ + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + pages.custom_blocks.APIRichTextBlock(), + ), + ( + "cta_block", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock( + required=True + ), + ), + ( + "aria_label", + wagtail.blocks.CharBlock( + required=False + ), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "style", + wagtail.blocks.ChoiceBlock( + choices=[ + ( + "orange", + "Orange", + ), + ( + "white", + "White", + ), + ( + "blue_outline", + "Blue Outline", + ), + ( + "deep_green_outline", + "Deep Green Outline", + ), + ] + ), + ) + ], + block_counts={ + "style": { + "max_num": 1 + } + }, + required=False, + ), + ), + ], + label="Link", + required=False, + ), + default=[], + label="Call To Action", + max_num=1, + ), + ), + ] + ) + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "card_size", + wagtail.blocks.IntegerBlock( + help_text="Width multiplier. default 27.", + min_value=0, + ), + ), + ( + "card_style", + wagtail.blocks.ChoiceBlock( + choices=[ + ("rounded", "Rounded"), + ("square", "Square"), + ] + ), + ), + ], + block_counts={ + "card_size": {"max_num": 1}, + "card_style": {"max_num": 1}, + }, + required=False, + ), + ), + ], + label="Cards Block", + ), + ), + ("text", pages.custom_blocks.APIRichTextBlock()), + ("html", wagtail.blocks.RawHTMLBlock()), + ( + "cta_block", + wagtail.blocks.StructBlock( + [ + ( + "actions", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock(required=True), + ), + ( + "aria_label", + wagtail.blocks.CharBlock(required=False), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "style", + wagtail.blocks.ChoiceBlock( + choices=[ + ("orange", "Orange"), + ("white", "White"), + ( + "blue_outline", + "Blue Outline", + ), + ( + "deep_green_outline", + "Deep Green Outline", + ), + ] + ), + ) + ], + block_counts={"style": {"max_num": 1}}, + required=False, + ), + ), + ], + label="Button", + required=False, + ), + default=[], + label="Actions", + max_num=2, + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "priority", + wagtail.blocks.ChoiceBlock( + choices=[ + ("descending", "Descending"), + ("equal", "Equal"), + ] + ), + ) + ], + block_counts={"priority": {"max_num": 1}}, + required=False, + ), + ), + ] + ), + ), + ( + "links_group", + wagtail.blocks.StructBlock( + [ + ( + "links", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock(required=True), + ), + ( + "aria_label", + wagtail.blocks.CharBlock(required=False), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ], + label="Link", + required=False, + ), + default=[], + label="Links", + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "color", + wagtail.blocks.ChoiceBlock( + choices=[ + ("white", "White"), + ("blue", "Blue"), + ("deep-green", "Deep Green"), + ] + ), + ) + ], + block_counts={"color": {"max_num": 1}}, + required=False, + ), + ), + ] + ), + ), + ( + "quote", + wagtail.blocks.StructBlock( + [ + ("image", pages.custom_blocks.APIImageChooserBlock()), + ("content", wagtail.blocks.RichTextBlock()), + ("name", wagtail.blocks.CharBlock()), + ("title", wagtail.blocks.CharBlock(requred=False)), + ] + ), + ), + ] + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "id", + wagtail.blocks.RegexBlock( + error_mssages={"invalid": "not a valid id."}, + help_text="html id of this element. eg: cool_section", + regex="[a-zA-Z0-9\\-_]", + ), + ), + ( + "background_color", + wagtail.blocks.RegexBlock( + error_mssages={"invalid": "not a valid hex color."}, + help_text="eg: #ff0000", + regex="#[a-zA-Z0-9]{6}", + ), + ), + ( + "padding", + wagtail.blocks.IntegerBlock( + help_text="Padding multiplier. default 0.", min_value=0 + ), + ), + ( + "text_alignment", + wagtail.blocks.ChoiceBlock( + choices=[("center", "Center"), ("left", "Left"), ("right", "Right")] + ), + ), + ], + block_counts={ + "background_color": {"max_num": 1}, + "id": {"max_num": 1}, + "padding": {"max_num": 1}, + "text_alignment": {"max_num": 1}, + }, + required=False, + ), + ), + ] + ), + ), + ( + "divider", + wagtail.blocks.StructBlock( + [ + ("image", pages.custom_blocks.APIImageChooserBlock()), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "alignment", + wagtail.blocks.ChoiceBlock( + choices=[ + ("center", "Center"), + ("content_left", "Left side of content."), + ("content_right", "Right side of content."), + ("body_left", "Left side of window."), + ("body_right", "Right side of window."), + ] + ), + ), + ( + "width", + wagtail.blocks.RegexBlock( + error_messages={ + "invalid": "must be valid css measurement. eg: 30px, 50%, 10rem" + }, + regex="^[0-9]+(px|%|rem)$", + required=False, + ), + ), + ( + "height", + wagtail.blocks.RegexBlock( + error_messages={ + "invalid": "must be valid css measurement. eg: 30px, 50%, 10rem" + }, + regex="^[0-9]+(px|%|rem)$", + required=False, + ), + ), + ( + "offset_vertical", + wagtail.blocks.RegexBlock( + error_messages={ + "invalid": "must be valid css measurement. eg: 30px, 50%, 10rem" + }, + regex="^\\-?[0-9]+(px|%|rem)$", + required=False, + ), + ), + ( + "offset_horizontal", + wagtail.blocks.RegexBlock( + error_messages={ + "invalid": "must be valid css measurement. eg: 30px, 50%, 10rem" + }, + regex="^\\-?[0-9]+(px|%|rem)$", + required=False, + ), + ), + ], + block_counts={ + "alignment": {"max_num": 1}, + "height": {"max_num": 1}, + "offset_horizontal": {"max_num": 1}, + "offset_vertical": {"max_num": 1}, + "width": {"max_num": 1}, + }, + required=False, + ), + ), + ] + ), + ), + ("html", wagtail.blocks.RawHTMLBlock()), + ], + use_json_field=True, + ), + ), + migrations.AlterField( + model_name="rootpage", + name="layout", + field=wagtail.fields.StreamField( + [ + ("default", wagtail.blocks.StructBlock([])), + ( + "landing", + wagtail.blocks.StructBlock( + [ + ( + "nav_links", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("text", wagtail.blocks.CharBlock(required=True)), + ("aria_label", wagtail.blocks.CharBlock(required=False)), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ("external", wagtail.blocks.URLBlock(required=False)), + ( + "internal", + wagtail.blocks.PageChooserBlock(required=False), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ("anchor", wagtail.blocks.CharBlock(required=False)), + ], + required=True, + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "style", + wagtail.blocks.ChoiceBlock( + choices=[ + ("orange", "Orange"), + ("white", "White"), + ("blue_outline", "Blue Outline"), + ("deep_green_outline", "Deep Green Outline"), + ] + ), + ) + ], + block_counts={"style": {"max_num": 1}}, + required=False, + ), + ), + ], + label="Link", + required=False, + ), + default=[], + label="Nav Links", + ), + ) + ], + label="Landing Page", + ), + ), + ], + blank=True, + default=[], + use_json_field=True, + ), + ), + ] diff --git a/pages/migrations/0146_alter_rootpage_body.py b/pages/migrations/0146_alter_rootpage_body.py new file mode 100644 index 000000000..18e010568 --- /dev/null +++ b/pages/migrations/0146_alter_rootpage_body.py @@ -0,0 +1,972 @@ +# Generated by Django 5.0.7 on 2024-07-25 16:25 + +import pages.custom_blocks +import wagtail.blocks +import wagtail.documents.blocks +import wagtail.fields +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ("pages", "0145_alter_rootpage_body_alter_rootpage_layout"), + ] + + operations = [ + migrations.AlterField( + model_name="rootpage", + name="body", + field=wagtail.fields.StreamField( + [ + ( + "hero", + wagtail.blocks.StructBlock( + [ + ( + "content", + wagtail.blocks.StreamBlock( + [ + ( + "cards_block", + wagtail.blocks.StructBlock( + [ + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + pages.custom_blocks.APIRichTextBlock(), + ), + ( + "cta_block", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock( + required=True + ), + ), + ( + "aria_label", + wagtail.blocks.CharBlock( + required=False + ), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "style", + wagtail.blocks.ChoiceBlock( + choices=[ + ( + "orange", + "Orange", + ), + ( + "white", + "White", + ), + ( + "blue_outline", + "Blue Outline", + ), + ( + "deep_green_outline", + "Deep Green Outline", + ), + ] + ), + ) + ], + block_counts={ + "style": { + "max_num": 1 + } + }, + required=False, + ), + ), + ], + label="Link", + required=False, + ), + default=[], + label="Call To Action", + max_num=1, + ), + ), + ] + ) + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "card_size", + wagtail.blocks.IntegerBlock( + help_text="Width multiplier. default 27.", + min_value=0, + ), + ), + ( + "card_style", + wagtail.blocks.ChoiceBlock( + choices=[ + ("rounded", "Rounded"), + ("square", "Square"), + ] + ), + ), + ], + block_counts={ + "card_size": {"max_num": 1}, + "card_style": {"max_num": 1}, + }, + required=False, + ), + ), + ], + label="Cards Block", + ), + ), + ("text", pages.custom_blocks.APIRichTextBlock()), + ("html", wagtail.blocks.RawHTMLBlock()), + ( + "cta_block", + wagtail.blocks.StructBlock( + [ + ( + "actions", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock(required=True), + ), + ( + "aria_label", + wagtail.blocks.CharBlock(required=False), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "style", + wagtail.blocks.ChoiceBlock( + choices=[ + ("orange", "Orange"), + ("white", "White"), + ( + "blue_outline", + "Blue Outline", + ), + ( + "deep_green_outline", + "Deep Green Outline", + ), + ] + ), + ) + ], + block_counts={"style": {"max_num": 1}}, + required=False, + ), + ), + ], + label="Button", + required=False, + ), + default=[], + label="Actions", + max_num=2, + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "priority", + wagtail.blocks.ChoiceBlock( + choices=[ + ("descending", "Descending"), + ("equal", "Equal"), + ] + ), + ) + ], + block_counts={"priority": {"max_num": 1}}, + required=False, + ), + ), + ] + ), + ), + ( + "links_group", + wagtail.blocks.StructBlock( + [ + ( + "links", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock(required=True), + ), + ( + "aria_label", + wagtail.blocks.CharBlock(required=False), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ], + label="Link", + required=False, + ), + default=[], + label="Links", + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "color", + wagtail.blocks.ChoiceBlock( + choices=[ + ("white", "White"), + ("blue", "Blue"), + ("deep-green", "Deep Green"), + ] + ), + ) + ], + block_counts={"color": {"max_num": 1}}, + required=False, + ), + ), + ] + ), + ), + ( + "quote", + wagtail.blocks.StructBlock( + [ + ("image", pages.custom_blocks.APIImageChooserBlock()), + ("content", wagtail.blocks.RichTextBlock()), + ("name", wagtail.blocks.CharBlock()), + ("title", wagtail.blocks.CharBlock(requred=False)), + ] + ), + ), + ( + "faq", + wagtail.blocks.StreamBlock( + [ + ( + "faq", + wagtail.blocks.StructBlock( + [ + ( + "question", + wagtail.blocks.RichTextBlock(required=True), + ), + ("slug", wagtail.blocks.CharBlock(required=True)), + ( + "answer", + wagtail.blocks.RichTextBlock(required=True), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ] + ), + ) + ] + ), + ), + ] + ), + ), + ("image", pages.custom_blocks.APIImageChooserBlock(required=False)), + ("image_alt", wagtail.blocks.CharBlock(required=False)), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "id", + wagtail.blocks.RegexBlock( + error_mssages={"invalid": "not a valid id."}, + help_text="html id of this element. eg: cool_section", + regex="[a-zA-Z0-9\\-_]", + ), + ), + ( + "image_alignment", + wagtail.blocks.ChoiceBlock( + choices=[ + ("left", "Left"), + ("right", "Right"), + ("topLeft", "Top Left"), + ("topRight", "Top Right"), + ("bottomLeft", "Bottom Left"), + ("bottomRight", "Bottom Right"), + ] + ), + ), + ( + "image_size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("auto", "Auto"), + ("contain", "Contain"), + ("cover", "Cover"), + ] + ), + ), + ( + "padding", + wagtail.blocks.IntegerBlock( + help_text="Padding multiplier. default 0.", min_value=0 + ), + ), + ( + "background_color", + wagtail.blocks.RegexBlock( + error_mssages={"invalid": "not a valid hex color."}, + help_text="eg: #ff0000", + regex="#[a-zA-Z0-9]{6}", + ), + ), + ], + block_counts={ + "background_color": {"max_num": 1}, + "id": {"max_num": 1}, + "image_alignment": {"max_num": 1}, + "image_size": {"max_num": 1}, + "padding": {"max_num": 1}, + }, + required=False, + ), + ), + ] + ), + ), + ( + "section", + wagtail.blocks.StructBlock( + [ + ( + "content", + wagtail.blocks.StreamBlock( + [ + ( + "cards_block", + wagtail.blocks.StructBlock( + [ + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + pages.custom_blocks.APIRichTextBlock(), + ), + ( + "cta_block", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock( + required=True + ), + ), + ( + "aria_label", + wagtail.blocks.CharBlock( + required=False + ), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "style", + wagtail.blocks.ChoiceBlock( + choices=[ + ( + "orange", + "Orange", + ), + ( + "white", + "White", + ), + ( + "blue_outline", + "Blue Outline", + ), + ( + "deep_green_outline", + "Deep Green Outline", + ), + ] + ), + ) + ], + block_counts={ + "style": { + "max_num": 1 + } + }, + required=False, + ), + ), + ], + label="Link", + required=False, + ), + default=[], + label="Call To Action", + max_num=1, + ), + ), + ] + ) + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "card_size", + wagtail.blocks.IntegerBlock( + help_text="Width multiplier. default 27.", + min_value=0, + ), + ), + ( + "card_style", + wagtail.blocks.ChoiceBlock( + choices=[ + ("rounded", "Rounded"), + ("square", "Square"), + ] + ), + ), + ], + block_counts={ + "card_size": {"max_num": 1}, + "card_style": {"max_num": 1}, + }, + required=False, + ), + ), + ], + label="Cards Block", + ), + ), + ("text", pages.custom_blocks.APIRichTextBlock()), + ("html", wagtail.blocks.RawHTMLBlock()), + ( + "cta_block", + wagtail.blocks.StructBlock( + [ + ( + "actions", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock(required=True), + ), + ( + "aria_label", + wagtail.blocks.CharBlock(required=False), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "style", + wagtail.blocks.ChoiceBlock( + choices=[ + ("orange", "Orange"), + ("white", "White"), + ( + "blue_outline", + "Blue Outline", + ), + ( + "deep_green_outline", + "Deep Green Outline", + ), + ] + ), + ) + ], + block_counts={"style": {"max_num": 1}}, + required=False, + ), + ), + ], + label="Button", + required=False, + ), + default=[], + label="Actions", + max_num=2, + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "priority", + wagtail.blocks.ChoiceBlock( + choices=[ + ("descending", "Descending"), + ("equal", "Equal"), + ] + ), + ) + ], + block_counts={"priority": {"max_num": 1}}, + required=False, + ), + ), + ] + ), + ), + ( + "links_group", + wagtail.blocks.StructBlock( + [ + ( + "links", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "text", + wagtail.blocks.CharBlock(required=True), + ), + ( + "aria_label", + wagtail.blocks.CharBlock(required=False), + ), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ( + "external", + wagtail.blocks.URLBlock( + required=False + ), + ), + ( + "internal", + wagtail.blocks.PageChooserBlock( + required=False + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + required=False + ), + ), + ], + required=True, + ), + ), + ], + label="Link", + required=False, + ), + default=[], + label="Links", + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "color", + wagtail.blocks.ChoiceBlock( + choices=[ + ("white", "White"), + ("blue", "Blue"), + ("deep-green", "Deep Green"), + ] + ), + ) + ], + block_counts={"color": {"max_num": 1}}, + required=False, + ), + ), + ] + ), + ), + ( + "quote", + wagtail.blocks.StructBlock( + [ + ("image", pages.custom_blocks.APIImageChooserBlock()), + ("content", wagtail.blocks.RichTextBlock()), + ("name", wagtail.blocks.CharBlock()), + ("title", wagtail.blocks.CharBlock(requred=False)), + ] + ), + ), + ( + "faq", + wagtail.blocks.StreamBlock( + [ + ( + "faq", + wagtail.blocks.StructBlock( + [ + ( + "question", + wagtail.blocks.RichTextBlock(required=True), + ), + ("slug", wagtail.blocks.CharBlock(required=True)), + ( + "answer", + wagtail.blocks.RichTextBlock(required=True), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ] + ), + ) + ] + ), + ), + ] + ), + ), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "id", + wagtail.blocks.RegexBlock( + error_mssages={"invalid": "not a valid id."}, + help_text="html id of this element. eg: cool_section", + regex="[a-zA-Z0-9\\-_]", + ), + ), + ( + "background_color", + wagtail.blocks.RegexBlock( + error_mssages={"invalid": "not a valid hex color."}, + help_text="eg: #ff0000", + regex="#[a-zA-Z0-9]{6}", + ), + ), + ( + "padding", + wagtail.blocks.IntegerBlock( + help_text="Padding multiplier. default 0.", min_value=0 + ), + ), + ( + "text_alignment", + wagtail.blocks.ChoiceBlock( + choices=[("center", "Center"), ("left", "Left"), ("right", "Right")] + ), + ), + ], + block_counts={ + "background_color": {"max_num": 1}, + "id": {"max_num": 1}, + "padding": {"max_num": 1}, + "text_alignment": {"max_num": 1}, + }, + required=False, + ), + ), + ] + ), + ), + ( + "divider", + wagtail.blocks.StructBlock( + [ + ("image", pages.custom_blocks.APIImageChooserBlock()), + ( + "config", + wagtail.blocks.StreamBlock( + [ + ( + "alignment", + wagtail.blocks.ChoiceBlock( + choices=[ + ("center", "Center"), + ("content_left", "Left side of content."), + ("content_right", "Right side of content."), + ("body_left", "Left side of window."), + ("body_right", "Right side of window."), + ] + ), + ), + ( + "width", + wagtail.blocks.RegexBlock( + error_messages={ + "invalid": "must be valid css measurement. eg: 30px, 50%, 10rem" + }, + regex="^[0-9]+(px|%|rem)$", + required=False, + ), + ), + ( + "height", + wagtail.blocks.RegexBlock( + error_messages={ + "invalid": "must be valid css measurement. eg: 30px, 50%, 10rem" + }, + regex="^[0-9]+(px|%|rem)$", + required=False, + ), + ), + ( + "offset_vertical", + wagtail.blocks.RegexBlock( + error_messages={ + "invalid": "must be valid css measurement. eg: 30px, 50%, 10rem" + }, + regex="^\\-?[0-9]+(px|%|rem)$", + required=False, + ), + ), + ( + "offset_horizontal", + wagtail.blocks.RegexBlock( + error_messages={ + "invalid": "must be valid css measurement. eg: 30px, 50%, 10rem" + }, + regex="^\\-?[0-9]+(px|%|rem)$", + required=False, + ), + ), + ], + block_counts={ + "alignment": {"max_num": 1}, + "height": {"max_num": 1}, + "offset_horizontal": {"max_num": 1}, + "offset_vertical": {"max_num": 1}, + "width": {"max_num": 1}, + }, + required=False, + ), + ), + ] + ), + ), + ("html", wagtail.blocks.RawHTMLBlock()), + ], + use_json_field=True, + ), + ), + ] diff --git a/pages/migrations/0147_merge_20240725_1221.py b/pages/migrations/0147_merge_20240725_1221.py new file mode 100644 index 000000000..5ec49dfe0 --- /dev/null +++ b/pages/migrations/0147_merge_20240725_1221.py @@ -0,0 +1,13 @@ +# Generated by Django 5.0.7 on 2024-07-25 17:21 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ("pages", "0137_alter_rootpage_promote_image"), + ("pages", "0146_alter_rootpage_body"), + ] + + operations = [] diff --git a/pages/migrations/0148_alter_rootpage_layout.py b/pages/migrations/0148_alter_rootpage_layout.py new file mode 100644 index 000000000..eabc2e144 --- /dev/null +++ b/pages/migrations/0148_alter_rootpage_layout.py @@ -0,0 +1,71 @@ +# Generated by Django 5.0.7 on 2024-07-25 17:31 + +import wagtail.blocks +import wagtail.documents.blocks +import wagtail.fields +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ("pages", "0147_merge_20240725_1221"), + ] + + operations = [ + migrations.AlterField( + model_name="rootpage", + name="layout", + field=wagtail.fields.StreamField( + [ + ("default", wagtail.blocks.StructBlock([])), + ( + "landing", + wagtail.blocks.StructBlock( + [ + ( + "nav_links", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("text", wagtail.blocks.CharBlock(required=True)), + ("aria_label", wagtail.blocks.CharBlock(required=False)), + ( + "target", + wagtail.blocks.StreamBlock( + [ + ("external", wagtail.blocks.URLBlock(required=False)), + ( + "internal", + wagtail.blocks.PageChooserBlock(required=False), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + required=False + ), + ), + ("anchor", wagtail.blocks.CharBlock(required=False)), + ], + required=True, + ), + ), + ], + label="Link", + required=False, + ), + default=[], + label="Nav Links", + ), + ) + ], + label="Landing Page", + ), + ), + ], + blank=True, + default=[], + use_json_field=True, + ), + ), + ] diff --git a/pages/models.py b/pages/models.py index 03969a72a..8c5cdb7fc 100644 --- a/pages/models.py +++ b/pages/models.py @@ -35,6 +35,9 @@ DividerBlock, \ APIRichTextBlock, \ CTAButtonBarBlock, \ + LinksGroupBlock, \ + QuoteBlock, \ + LinkInfoBlock, \ CTALinkBlock from .custom_fields import Group @@ -82,6 +85,11 @@ ('text', APIRichTextBlock()), ('html', blocks.RawHTMLBlock()), ('cta_block', CTAButtonBarBlock()), + ('links_group', LinksGroupBlock()), + ('quote', QuoteBlock()), + ('faq', blocks.StreamBlock([ + ('faq', FAQBlock()), + ])) ] # we have one RootPage, which is the parent of all other pages @@ -92,7 +100,7 @@ class RootPage(Page): ('default', blocks.StructBlock([ ])), ('landing', blocks.StructBlock([ - ('nav_links', blocks.ListBlock(CTALinkBlock(required=False, label="Link"), + ('nav_links', blocks.ListBlock(LinkInfoBlock(required=False, label="Link"), default=[], label='Nav Links' )), @@ -105,6 +113,11 @@ class RootPage(Page): ('image', APIImageChooserBlock(required=False)), ('image_alt', blocks.CharBlock(required=False)), ('config', blocks.StreamBlock([ + ('id', blocks.RegexBlock( + regex=r'[a-zA-Z0-9\-_]', + help_text='html id of this element. eg: cool_section', + error_mssages={'invalid': 'not a valid id.'} + )), ('image_alignment', blocks.ChoiceBlock(choices=HERO_IMAGE_ALIGNMENT_CHOICES)), ('image_size', blocks.ChoiceBlock(choices=HERO_IMAGE_SIZE_CHOICES)), ('padding', blocks.IntegerBlock(min_value=0, help_text='Padding multiplier. default 0.')), @@ -114,6 +127,7 @@ class RootPage(Page): error_mssages={'invalid': 'not a valid hex color.'} )), ], block_counts={ + 'id': {'max_num': 1}, 'image_alignment': {'max_num': 1}, 'image_size': {'max_num': 1}, 'padding': {'max_num': 1}, @@ -123,6 +137,11 @@ class RootPage(Page): ('section', blocks.StructBlock([ ('content', blocks.StreamBlock(SECTION_CONTENT_BLOCKS)), ('config', blocks.StreamBlock([ + ('id', blocks.RegexBlock( + regex=r'[a-zA-Z0-9\-_]', + help_text='html id of this element. eg: cool_section', + error_mssages={'invalid': 'not a valid id.'} + )), ('background_color', blocks.RegexBlock( regex=r'#[a-zA-Z0-9]{6}', help_text='eg: #ff0000', @@ -137,6 +156,7 @@ class RootPage(Page): ('right', 'Right'), ], default='left')), ], block_counts={ + 'id': {'max_num': 1}, 'background_color': {'max_num': 1}, 'padding': {'max_num': 1}, 'text_alignment': {'max_num': 1},