diff --git a/network-api/networkapi/donate/migrations/0017_update_grouplistingblock_with_linkblock.py b/network-api/networkapi/donate/migrations/0017_update_grouplistingblock_with_linkblock.py new file mode 100644 index 00000000000..994d4a27ad2 --- /dev/null +++ b/network-api/networkapi/donate/migrations/0017_update_grouplistingblock_with_linkblock.py @@ -0,0 +1,3843 @@ +# Generated by Django 4.2.14 on 2024-07-17 01:24 + +import wagtail.blocks +import wagtail.blocks.static_block +import wagtail.documents.blocks +import wagtail.embeds.blocks +import wagtail.fields +import wagtail.images.blocks +import wagtail.snippets.blocks +from django.db import migrations +from wagtail.blocks.migrations.migrate_operation import MigrateStreamData + +import networkapi.wagtailpages.pagemodels.blog.blog_topic +import networkapi.wagtailpages.pagemodels.profiles +import networkapi.wagtailpages.validators +from networkapi.utility.migration.operations import AlterStreamChildBlockDataOperation + + +def migrate_group_listing_block_cards(source_block): + + if "cards" in source_block["value"]: + for card in source_block["value"]["cards"]: + + old_url = card["value"].get("url") + if old_url: + card["value"]["link"] = [ + { + "link_to": "external_url", + "external_url": old_url, + "new_window": True, + } + ] + + return source_block + + +class Migration(migrations.Migration): + + dependencies = [ + ("donate", "0016_update_imageteaserblock_with_linkblock"), + ] + + operations = [ + migrations.AlterField( + model_name="donatehelppage", + name="body", + field=wagtail.fields.StreamField( + [ + ( + "paragraph", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "h2", + "h3", + "h4", + "h5", + "ol", + "ul", + "hr", + "document-link", + "large", + ], + template="wagtailpages/blocks/rich_text_block.html", + ), + ), + ( + "card_grid", + wagtail.blocks.StructBlock( + [ + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Alt text for card's image.", required=False + ), + ), + ("title", wagtail.blocks.CharBlock(help_text="Heading for the card.")), + ("body", wagtail.blocks.TextBlock(help_text="Body text of the card.")), + ( + "link_url", + wagtail.blocks.CharBlock( + help_text="Optional URL that this card should link out to. (Note: If left blank, link will not render.) ", + required=False, + ), + ), + ( + "link_label", + wagtail.blocks.CharBlock( + help_text="Optional Label for the URL link above. (Note: If left blank, link will not render.) ", + required=False, + ), + ), + ] + ), + help_text="Please use a minimum of 2 cards.", + ), + ) + ] + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "altText", + wagtail.blocks.CharBlock( + help_text="Image description (for screen readers).", required=True + ), + ), + ("caption", wagtail.blocks.CharBlock(required=False)), + ( + "caption_url", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock(label="Page", required=False), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", required=False + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False + ), + ), + ] + ), + help_text="Optional URL that this caption should link out to.", + max_num=1, + min_num=0, + ), + ), + ( + "image_width", + wagtail.blocks.ChoiceBlock( + choices=[("normal", "Normal"), ("wide", "Wide"), ("full_width", "Full Width")], + help_text="Wide images are col-12, Full-Width Images reach both ends of the screen (16:6 images recommended for full width)", + ), + ), + ] + ), + ), + ( + "image_text", + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "altText", + wagtail.blocks.CharBlock( + help_text="Image description (for screen readers).", required=True + ), + ), + ( + "text", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "h2", + "h3", + "h4", + "h5", + "ol", + "ul", + "hr", + "document-link", + ] + ), + ), + ( + "url", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock(label="Page", required=False), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", required=False + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False + ), + ), + ] + ), + help_text="Optional URL that this image should link out to.", + max_num=1, + min_num=0, + ), + ), + ( + "top_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider above content block.", required=False + ), + ), + ( + "bottom_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider below content block.", required=False + ), + ), + ] + ), + ), + ( + "image_text_mini", + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "altText", + wagtail.blocks.CharBlock( + help_text="Image description (for screen readers).", required=True + ), + ), + ("text", wagtail.blocks.RichTextBlock(features=["bold", "italic", "link"])), + ] + ), + ), + ( + "image_grid", + wagtail.blocks.StructBlock( + [ + ( + "grid_items", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Alt text for this image.", required=False + ), + ), + ( + "caption", + wagtail.blocks.CharBlock( + help_text="Please remember to properly attribute any images we use.", + required=False, + ), + ), + ( + "url", + wagtail.blocks.CharBlock( + help_text="Optional URL that this figure should link out to.", + required=False, + ), + ), + ( + "square_image", + wagtail.blocks.BooleanBlock( + default=True, + help_text="If left checked, the image will be cropped to be square.", + required=False, + ), + ), + ] + ) + ), + ) + ] + ), + ), + ( + "video", + wagtail.blocks.StructBlock( + [ + ( + "url", + wagtail.blocks.URLBlock( + help_text="For YouTube: go to your YouTube video and click “Share,” then “Embed,” and then copy and paste the provided URL only. For example: https://www.youtube.com/embed/3FIVXBawyQw For Vimeo: follow similar steps to grab the embed URL. For example: https://player.vimeo.com/video/9004979", + label="Embed URL", + ), + ), + ("caption", wagtail.blocks.CharBlock(required=False)), + ( + "caption_url", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock(label="Page", required=False), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", required=False + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False + ), + ), + ] + ), + help_text="Optional URL that this caption should link out to.", + max_num=1, + min_num=0, + ), + ), + ( + "video_width", + wagtail.blocks.ChoiceBlock( + choices=[("normal", "Normal"), ("wide", "Wide"), ("full_width", "Full Width")], + help_text="Wide videos are col-12, Full-Width videos reach both ends of the screen.", + ), + ), + ] + ), + ), + ( + "iframe", + wagtail.blocks.StructBlock( + [ + ( + "url", + wagtail.blocks.CharBlock( + help_text="Please note that only URLs from allow-listed domains will work." + ), + ), + ( + "height", + wagtail.blocks.IntegerBlock( + help_text="Optional integer pixel value for custom iFrame height", + required=False, + ), + ), + ("caption", wagtail.blocks.CharBlock(required=False)), + ( + "caption_url", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock(label="Page", required=False), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", required=False + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False + ), + ), + ] + ), + help_text="Optional URL that this caption should link out to.", + max_num=1, + min_num=0, + ), + ), + ( + "iframe_width", + wagtail.blocks.ChoiceBlock( + choices=[("normal", "Normal"), ("wide", "Wide"), ("full_width", "Full Width")], + help_text="Wide iframes are col-12, Full-Width iframes reach both ends of the screen", + ), + ), + ( + "disable_scroll", + wagtail.blocks.BooleanBlock( + default=False, + help_text='Checking this will add "scrolling=no" to the iframe. Use this if your iframe is rendering an unnecessary scroll bar or whitespace below it.', + required=False, + ), + ), + ] + ), + ), + ( + "linkbutton", + wagtail.blocks.StructBlock( + [ + ("label", wagtail.blocks.CharBlock()), + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ("page", wagtail.blocks.PageChooserBlock(label="Page", required=False)), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[networkapi.wagtailpages.validators.RelativeURLValidator()], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[networkapi.wagtailpages.validators.AnchorLinkValidator()], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ("file", wagtail.documents.blocks.DocumentChooserBlock(label="File", required=False)), + ("phone", wagtail.blocks.CharBlock(label="Phone", max_length=30, required=False)), + ( + "new_window", + wagtail.blocks.BooleanBlock(label="Open in new window", required=False), + ), + ( + "styling", + wagtail.blocks.ChoiceBlock( + choices=[ + ("btn-primary", "Primary button"), + ("btn-secondary", "Secondary button"), + ] + ), + ), + ] + ), + ), + ( + "spacer", + wagtail.blocks.StructBlock( + [ + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("1", "quarter spacing"), + ("2", "half spacing"), + ("3", "single spacing"), + ("4", "one and a half spacing"), + ("5", "triple spacing"), + ] + ), + ) + ] + ), + ), + ( + "single_quote", + wagtail.blocks.StructBlock( + [ + ("quote", wagtail.blocks.RichTextBlock(features=["bold"])), + ("attribution", wagtail.blocks.CharBlock(required=False)), + ( + "attribution_info", + wagtail.blocks.RichTextBlock(features=["bold", "link", "large"], required=False), + ), + ] + ), + ), + ( + "pulse_listing", + wagtail.blocks.StructBlock( + [ + ( + "search_terms", + wagtail.blocks.CharBlock( + help_text="Test your search at mozillapulse.org/search", + label="Search", + required=False, + ), + ), + ( + "max_number_of_results", + wagtail.blocks.IntegerBlock( + default=6, + help_text="Choose 1-12. If you want visitors to see more, link to a search or tag on Pulse.", + max_value=12, + min_value=0, + required=True, + ), + ), + ( + "only_featured_entries", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Featured items are selected by Pulse moderators.", + label="Display only featured entries", + required=False, + ), + ), + ( + "newest_first", + wagtail.blocks.ChoiceBlock( + choices=[ + ("True", "Show newer entries first"), + ("False", "Show older entries first"), + ], + label="Sort", + ), + ), + ( + "advanced_filter_header", + wagtail.blocks.static_block.StaticBlock( + admin_text="-------- ADVANCED FILTERS: OPTIONS TO DISPLAY FEWER, MORE TARGETED RESULTS. --------", + label=" ", + ), + ), + ( + "issues", + wagtail.blocks.ChoiceBlock( + choices=[ + ("all", "All"), + ("Decentralization", "Decentralization"), + ("Digital Inclusion", "Digital Inclusion"), + ("Online Privacy & Security", "Online Privacy & Security"), + ("Open Innovation", "Open Innovation"), + ("Web Literacy", "Web Literacy"), + ] + ), + ), + ( + "help", + wagtail.blocks.ChoiceBlock( + choices=[ + ("all", "All"), + ("Attend", "Attend"), + ("Create content", "Create content"), + ("Code", "Code"), + ("Design", "Design"), + ("Fundraise", "Fundraise"), + ("Join community", "Join community"), + ("Localize & translate", "Localize & translate"), + ("Mentor", "Mentor"), + ("Plan & organize", "Plan & organize"), + ("Promote", "Promote"), + ("Take action", "Take action"), + ("Test & feedback", "Test & feedback"), + ("Write documentation", "Write documentation"), + ], + label="Type of help needed", + ), + ), + ( + "direct_link", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Checked: user goes to project link. Unchecked: user goes to pulse entry", + label="Direct link", + required=False, + ), + ), + ] + ), + ), + ( + "profile_listing", + wagtail.blocks.StructBlock( + [ + ( + "max_number_of_results", + wagtail.blocks.IntegerBlock( + default=12, + help_text="Pick up to 48 profiles.", + max_value=48, + min_value=1, + required=True, + ), + ), + ( + "advanced_filter_header", + wagtail.blocks.static_block.StaticBlock( + admin_text="-------- ADVANCED FILTERS: OPTIONS TO DISPLAY FEWER, MORE TARGETED RESULTS. --------", + label=" ", + ), + ), + ( + "profile_type", + wagtail.blocks.CharBlock(default="", help_text="Example: Fellow.", required=False), + ), + ( + "program_type", + wagtail.blocks.CharBlock( + default="", help_text="Example: Tech Policy.", required=False + ), + ), + ("year", wagtail.blocks.CharBlock(default="", required=False)), + ] + ), + ), + ( + "profile_by_id", + wagtail.blocks.StructBlock( + [ + ( + "ids", + wagtail.blocks.CharBlock( + help_text="Show profiles for pulse users with specific profile ids (mozillapulse.org/profile/[##]). For multiple profiles, specify a comma separated list (e.g. 85,105,332).", + label="Profile by ID", + ), + ) + ] + ), + ), + ( + "profile_directory", + wagtail.blocks.StructBlock( + [ + ( + "max_number_of_results", + wagtail.blocks.IntegerBlock( + default=12, + help_text="Pick up to 48 profiles.", + max_value=48, + min_value=1, + required=True, + ), + ), + ( + "advanced_filter_header", + wagtail.blocks.static_block.StaticBlock( + admin_text="-------- ADVANCED FILTERS: OPTIONS TO DISPLAY FEWER, MORE TARGETED RESULTS. --------", + label=" ", + ), + ), + ( + "profile_type", + wagtail.blocks.CharBlock(default="", help_text="Example: Fellow.", required=False), + ), + ( + "program_type", + wagtail.blocks.CharBlock( + default="", help_text="Example: Tech Policy.", required=False + ), + ), + ("year", wagtail.blocks.CharBlock(default="", required=False)), + ( + "filter_values", + wagtail.blocks.CharBlock( + default="2019,2018,2017,2016,2015,2014,2013", + help_text="Example: 2019,2018,2017,2016,2015,2014,2013", + required=True, + ), + ), + ] + ), + ), + ( + "recent_blog_entries", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock(required=False)), + ( + "tag_filter", + wagtail.blocks.CharBlock( + help_text="Test this filter at foundation.mozilla.org/blog/tags/", + label="Filter by Tag", + required=False, + ), + ), + ( + "topic_filter", + wagtail.blocks.ChoiceBlock( + choices=networkapi.wagtailpages.pagemodels.blog.blog_topic.BlogPageTopic.get_topics, + help_text="Test this filter at foundation.mozilla.org/blog/topic/", + label="Filter by Topic", + required=False, + ), + ), + ( + "top_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider above content block.", required=False + ), + ), + ( + "bottom_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider below content block.", required=False + ), + ), + ] + ), + ), + ( + "blog_set", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock()), + ( + "top_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider above content block.", required=False + ), + ), + ( + "bottom_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider below content block.", required=False + ), + ), + ( + "blog_pages", + wagtail.blocks.ListBlock( + wagtail.blocks.PageChooserBlock(page_type=["wagtailpages.BlogPage"]) + ), + ), + ] + ), + ), + ( + "airtable", + wagtail.blocks.StructBlock( + [ + ( + "url", + wagtail.blocks.URLBlock( + help_text="Copied from the Airtable embed code. The word 'embed' will be in the url" + ), + ), + ( + "height", + wagtail.blocks.IntegerBlock( + default=533, + help_text="The pixel height on desktop view, usually copied from the Airtable embed code", + ), + ), + ] + ), + ), + ( + "typeform", + wagtail.blocks.StructBlock( + [ + ( + "embed_id", + wagtail.blocks.CharBlock( + help_text="The embed id of your Typeform page (e.g. if the form is on admin.typeform.com/form/e8zScc6t, the id will be: e8zScc6t)", + required=True, + ), + ), + ( + "button_type", + wagtail.blocks.ChoiceBlock( + choices=[ + ("btn-primary", "Primary button"), + ("btn-secondary", "Secondary button"), + ] + ), + ), + ( + "button_text", + wagtail.blocks.CharBlock( + help_text="This is a text prompt for users to open the typeform content", + required=True, + ), + ), + ] + ), + ), + ( + "datawrapper", + wagtail.embeds.blocks.EmbedBlock( + help_text='Enter the "visualization only" link of the Datawrapper chart. It looks something like this: https://datawrapper.dwcdn.net/KwSKp/1/', + icon="image", + template="wagtailpages/blocks/datawrapper_block.html", + ), + ), + ( + "listing", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock(help_text="Heading for the block.", required=False), + ), + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Alt text for card's image.", required=False + ), + ), + ("title", wagtail.blocks.CharBlock(help_text="Heading for the card.")), + ( + "highlighted_metadata", + wagtail.blocks.CharBlock( + help_text="Metadata to highlight on the card.", required=False + ), + ), + ( + "metadata", + wagtail.blocks.CharBlock( + help_text="Generic metadata.", required=False + ), + ), + ( + "body", + wagtail.blocks.RichTextBlock( + features=["bold"], + help_text="Body text of the card.", + required=False, + ), + ), + ( + "link_page", + wagtail.blocks.PageChooserBlock( + help_text="Page that this should link out to.", required=False + ), + ), + ( + "link_url", + wagtail.blocks.CharBlock( + help_text="Optional URL that the header should link out to.", + required=False, + ), + ), + ] + ), + help_text="Please use a minimum of 2 cards.", + min_num=2, + ), + ), + ( + "cards_per_row", + wagtail.blocks.ChoiceBlock( + choices=[(2, "2"), (3, "3")], + help_text="Number of cards per row. Note: this is a max and fewer might be used if is less space is available.", + required=False, + ), + ), + ] + ), + ), + ( + "profiles", + wagtail.blocks.StructBlock( + [ + ( + "profiles", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "profile", + wagtail.snippets.blocks.SnippetChooserBlock( + networkapi.wagtailpages.pagemodels.profiles.Profile + ), + ) + ] + ), + min_num=1, + ), + ) + ] + ), + ), + ( + "article_teaser_block", + wagtail.blocks.StructBlock( + [ + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "article", + wagtail.blocks.PageChooserBlock( + help_text="Page that this should link out to.", + page_type=["wagtailpages.ArticlePage"], + required=False, + ), + ) + ] + ), + help_text="Please use a minimum of 3 cards.", + min_num=3, + ), + ) + ] + ), + ), + ( + "group_listing_block", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + help_text="Heading for the group of cards.", required=False + ), + ), + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Alt text for card's image.", required=False + ), + ), + ( + "meta_data", + wagtail.blocks.CharBlock( + help_text="Optional meta data information for the card.", + required=False, + ), + ), + ("title", wagtail.blocks.CharBlock(help_text="Heading for the card.")), + ( + "body", + wagtail.blocks.RichTextBlock( + features=["bold", "link"], help_text="Body text of the card." + ), + ), + ( + "url", + wagtail.blocks.CharBlock( + help_text="The URL this card should link to.", required=False + ), + ), + ( + "link", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock( + label="Page", required=False + ), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", required=False + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False + ), + ), + ] + ), + help_text="Optional link that this card should link to.", + max_num=1, + min_num=0, + ), + ), + ] + ) + ), + ), + ] + ), + ), + ( + "image_feature", + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "alt_text", + wagtail.blocks.CharBlock(help_text="Image description (for screen readers)."), + ), + ("metadata", wagtail.blocks.CharBlock(required=False)), + ("title", wagtail.blocks.CharBlock(help_text="Heading for the card.")), + ( + "title_link", + wagtail.blocks.PageChooserBlock( + help_text="Page that the title should link out to.", required=False + ), + ), + ("body", wagtail.blocks.CharBlock(required=False)), + ] + ), + ), + ( + "image_teaser_block", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock(help_text="Heading for the card.")), + ("text", wagtail.blocks.RichTextBlock(features=["bold"])), + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "altText", + wagtail.blocks.CharBlock( + help_text="Image description (for screen readers).", required=True + ), + ), + ( + "link_button", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("label", wagtail.blocks.CharBlock()), + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock(label="Page", required=False), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", required=False + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False + ), + ), + ( + "styling", + wagtail.blocks.ChoiceBlock( + choices=[ + ("btn-primary", "Primary button"), + ("btn-secondary", "Secondary button"), + ] + ), + ), + ] + ), + help_text="Optional link button", + max_num=1, + min_num=0, + ), + ), + ( + "top_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider above content block.", required=False + ), + ), + ( + "bottom_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider below content block.", required=False + ), + ), + ] + ), + ), + ( + "text_only_teaser", + wagtail.blocks.StructBlock( + [ + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock(help_text="Heading for the card."), + ), + ( + "link_page", + wagtail.blocks.PageChooserBlock( + help_text="Page that the header should link out to.", + required=False, + ), + ), + ( + "link_url", + wagtail.blocks.CharBlock( + help_text="Optional URL that the header should link out to.", + required=False, + ), + ), + ("meta_data", wagtail.blocks.CharBlock(max_length=500)), + ( + "body", + wagtail.blocks.TextBlock( + help_text="Body text of the card.", + max_length=200, + required=False, + ), + ), + ] + ), + help_text="Please use a minimum of 3 cards.", + min_num=3, + ), + ) + ] + ), + ), + ( + "block_with_aside", + wagtail.blocks.StructBlock( + [ + ( + "content", + wagtail.blocks.StreamBlock( + [ + ( + "listing", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + help_text="Heading for the block.", required=False + ), + ), + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "image", + wagtail.images.blocks.ImageChooserBlock(), + ), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Alt text for card's image.", + required=False, + ), + ), + ( + "title", + wagtail.blocks.CharBlock( + help_text="Heading for the card." + ), + ), + ( + "highlighted_metadata", + wagtail.blocks.CharBlock( + help_text="Metadata to highlight on the card.", + required=False, + ), + ), + ( + "metadata", + wagtail.blocks.CharBlock( + help_text="Generic metadata.", + required=False, + ), + ), + ( + "body", + wagtail.blocks.RichTextBlock( + features=["bold"], + help_text="Body text of the card.", + required=False, + ), + ), + ( + "link_page", + wagtail.blocks.PageChooserBlock( + help_text="Page that this should link out to.", + required=False, + ), + ), + ( + "link_url", + wagtail.blocks.CharBlock( + help_text="Optional URL that the header should link out to.", + required=False, + ), + ), + ] + ), + help_text="Please use a minimum of 2 cards.", + min_num=2, + ), + ), + ( + "cards_per_row", + wagtail.blocks.ChoiceBlock( + choices=[(2, "2"), (3, "3")], + help_text="Number of cards per row. Note: this is a max and fewer might be used if is less space is available.", + required=False, + ), + ), + ] + ), + ), + ( + "paragraph", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "h2", + "h3", + "h4", + "h5", + "ol", + "ul", + "hr", + "document-link", + ] + ), + ), + ], + help_text="The wider block that appears on the left on desktop", + icon="doc-full", + max_num=1, + ), + ), + ( + "aside", + wagtail.blocks.StreamBlock( + [ + ( + "aside_content", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + help_text="Heading for the card.", required=False + ), + ), + ( + "body", + wagtail.blocks.TextBlock( + help_text="Body text of the card.", required=False + ), + ), + ] + ), + ), + ( + "linkbutton", + wagtail.blocks.StructBlock( + [ + ("label", wagtail.blocks.CharBlock()), + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock( + label="Page", required=False + ), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", required=False + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False + ), + ), + ( + "styling", + wagtail.blocks.ChoiceBlock( + choices=[ + ("btn-primary", "Primary button"), + ("btn-secondary", "Secondary button"), + ] + ), + ), + ] + ), + ), + ( + "spacer", + wagtail.blocks.StructBlock( + [ + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("1", "quarter spacing"), + ("2", "half spacing"), + ("3", "single spacing"), + ("4", "one and a half spacing"), + ("5", "triple spacing"), + ] + ), + ) + ] + ), + ), + ], + help_text="Elements here will appear in the column on the right side of the page on desktop. This can be left blank if you would just like a 2/3 column on the left", + icon="doc-full", + required=False, + ), + ), + ] + ), + ), + ( + "accordion", + wagtail.blocks.StructBlock( + [ + ( + "accordion_items", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + help_text="Heading for the Accordion Item" + ), + ), + ( + "content", + wagtail.blocks.StreamBlock( + [ + ( + "rich_text", + wagtail.blocks.RichTextBlock( + blank=True, + features=[ + "bold", + "italic", + "link", + "ul", + "ol", + "document-link", + ], + ), + ), + ( + "datawrapper", + wagtail.embeds.blocks.EmbedBlock( + help_text='Enter the "visualization only" link of the Datawrapper chart. It looks something like this: https://datawrapper.dwcdn.net/KwSKp/1/', + icon="image", + template="wagtailpages/blocks/datawrapper_block.html", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "image", + wagtail.images.blocks.ImageChooserBlock(), + ), + ( + "altText", + wagtail.blocks.CharBlock( + help_text="Image description (for screen readers).", + required=True, + ), + ), + ] + ), + ), + ( + "video", + wagtail.blocks.StructBlock( + [ + ( + "url", + wagtail.blocks.URLBlock( + help_text="For YouTube: go to your YouTube video and click “Share,” then “Embed,” and then copy and paste the provided URL only. For example: https://www.youtube.com/embed/3FIVXBawyQw For Vimeo: follow similar steps to grab the embed URL. For example: https://player.vimeo.com/video/9004979", + label="Embed URL", + ), + ), + ( + "caption", + wagtail.blocks.CharBlock(required=False), + ), + ( + "caption_url", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ( + "external_url", + "External URL", + ), + ( + "relative_url", + "Relative URL", + ), + ("email", "Email"), + ( + "anchor", + "Anchor", + ), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock( + label="Page", + required=False, + ), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ( + "email", + wagtail.blocks.EmailBlock( + required=False + ), + ), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", + required=False, + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", + max_length=30, + required=False, + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", + required=False, + ), + ), + ] + ), + help_text="Optional URL that this caption should link out to.", + max_num=1, + min_num=0, + ), + ), + ( + "video_width", + wagtail.blocks.ChoiceBlock( + choices=[ + ("normal", "Normal"), + ("wide", "Wide"), + ("full_width", "Full Width"), + ], + help_text="Wide videos are col-12, Full-Width videos reach both ends of the screen.", + ), + ), + ] + ), + ), + ] + ), + ), + ] + ) + ), + ) + ] + ), + ), + ], + blank=True, + use_json_field=True, + ), + ), + MigrateStreamData( + app_name="donate", + model_name="DonateHelpPage", + field_name="body", + operations_and_block_paths=[ + ( + AlterStreamChildBlockDataOperation( + block="group_listing_block", operation=migrate_group_listing_block_cards + ), + "", + ), + ], + ), + migrations.AlterField( + model_name="donatehelppage", + name="body", + field=wagtail.fields.StreamField( + [ + ( + "paragraph", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "h2", + "h3", + "h4", + "h5", + "ol", + "ul", + "hr", + "document-link", + "large", + ], + template="wagtailpages/blocks/rich_text_block.html", + ), + ), + ( + "card_grid", + wagtail.blocks.StructBlock( + [ + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Alt text for card's image.", required=False + ), + ), + ("title", wagtail.blocks.CharBlock(help_text="Heading for the card.")), + ("body", wagtail.blocks.TextBlock(help_text="Body text of the card.")), + ( + "link_url", + wagtail.blocks.CharBlock( + help_text="Optional URL that this card should link out to. (Note: If left blank, link will not render.) ", + required=False, + ), + ), + ( + "link_label", + wagtail.blocks.CharBlock( + help_text="Optional Label for the URL link above. (Note: If left blank, link will not render.) ", + required=False, + ), + ), + ] + ), + help_text="Please use a minimum of 2 cards.", + ), + ) + ] + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "altText", + wagtail.blocks.CharBlock( + help_text="Image description (for screen readers).", required=True + ), + ), + ("caption", wagtail.blocks.CharBlock(required=False)), + ( + "caption_url", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock(label="Page", required=False), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", required=False + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False + ), + ), + ] + ), + help_text="Optional URL that this caption should link out to.", + max_num=1, + min_num=0, + ), + ), + ( + "image_width", + wagtail.blocks.ChoiceBlock( + choices=[("normal", "Normal"), ("wide", "Wide"), ("full_width", "Full Width")], + help_text="Wide images are col-12, Full-Width Images reach both ends of the screen (16:6 images recommended for full width)", + ), + ), + ] + ), + ), + ( + "image_text", + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "altText", + wagtail.blocks.CharBlock( + help_text="Image description (for screen readers).", required=True + ), + ), + ( + "text", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "h2", + "h3", + "h4", + "h5", + "ol", + "ul", + "hr", + "document-link", + ] + ), + ), + ( + "url", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock(label="Page", required=False), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", required=False + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False + ), + ), + ] + ), + help_text="Optional URL that this image should link out to.", + max_num=1, + min_num=0, + ), + ), + ( + "top_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider above content block.", required=False + ), + ), + ( + "bottom_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider below content block.", required=False + ), + ), + ] + ), + ), + ( + "image_text_mini", + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "altText", + wagtail.blocks.CharBlock( + help_text="Image description (for screen readers).", required=True + ), + ), + ("text", wagtail.blocks.RichTextBlock(features=["bold", "italic", "link"])), + ] + ), + ), + ( + "image_grid", + wagtail.blocks.StructBlock( + [ + ( + "grid_items", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Alt text for this image.", required=False + ), + ), + ( + "caption", + wagtail.blocks.CharBlock( + help_text="Please remember to properly attribute any images we use.", + required=False, + ), + ), + ( + "url", + wagtail.blocks.CharBlock( + help_text="Optional URL that this figure should link out to.", + required=False, + ), + ), + ( + "square_image", + wagtail.blocks.BooleanBlock( + default=True, + help_text="If left checked, the image will be cropped to be square.", + required=False, + ), + ), + ] + ) + ), + ) + ] + ), + ), + ( + "video", + wagtail.blocks.StructBlock( + [ + ( + "url", + wagtail.blocks.URLBlock( + help_text="For YouTube: go to your YouTube video and click “Share,” then “Embed,” and then copy and paste the provided URL only. For example: https://www.youtube.com/embed/3FIVXBawyQw For Vimeo: follow similar steps to grab the embed URL. For example: https://player.vimeo.com/video/9004979", + label="Embed URL", + ), + ), + ("caption", wagtail.blocks.CharBlock(required=False)), + ( + "caption_url", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock(label="Page", required=False), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", required=False + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False + ), + ), + ] + ), + help_text="Optional URL that this caption should link out to.", + max_num=1, + min_num=0, + ), + ), + ( + "video_width", + wagtail.blocks.ChoiceBlock( + choices=[("normal", "Normal"), ("wide", "Wide"), ("full_width", "Full Width")], + help_text="Wide videos are col-12, Full-Width videos reach both ends of the screen.", + ), + ), + ] + ), + ), + ( + "iframe", + wagtail.blocks.StructBlock( + [ + ( + "url", + wagtail.blocks.CharBlock( + help_text="Please note that only URLs from allow-listed domains will work." + ), + ), + ( + "height", + wagtail.blocks.IntegerBlock( + help_text="Optional integer pixel value for custom iFrame height", + required=False, + ), + ), + ("caption", wagtail.blocks.CharBlock(required=False)), + ( + "caption_url", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock(label="Page", required=False), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", required=False + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False + ), + ), + ] + ), + help_text="Optional URL that this caption should link out to.", + max_num=1, + min_num=0, + ), + ), + ( + "iframe_width", + wagtail.blocks.ChoiceBlock( + choices=[("normal", "Normal"), ("wide", "Wide"), ("full_width", "Full Width")], + help_text="Wide iframes are col-12, Full-Width iframes reach both ends of the screen", + ), + ), + ( + "disable_scroll", + wagtail.blocks.BooleanBlock( + default=False, + help_text='Checking this will add "scrolling=no" to the iframe. Use this if your iframe is rendering an unnecessary scroll bar or whitespace below it.', + required=False, + ), + ), + ] + ), + ), + ( + "linkbutton", + wagtail.blocks.StructBlock( + [ + ("label", wagtail.blocks.CharBlock()), + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ("page", wagtail.blocks.PageChooserBlock(label="Page", required=False)), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[networkapi.wagtailpages.validators.RelativeURLValidator()], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[networkapi.wagtailpages.validators.AnchorLinkValidator()], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ("file", wagtail.documents.blocks.DocumentChooserBlock(label="File", required=False)), + ("phone", wagtail.blocks.CharBlock(label="Phone", max_length=30, required=False)), + ( + "new_window", + wagtail.blocks.BooleanBlock(label="Open in new window", required=False), + ), + ( + "styling", + wagtail.blocks.ChoiceBlock( + choices=[ + ("btn-primary", "Primary button"), + ("btn-secondary", "Secondary button"), + ] + ), + ), + ] + ), + ), + ( + "spacer", + wagtail.blocks.StructBlock( + [ + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("1", "quarter spacing"), + ("2", "half spacing"), + ("3", "single spacing"), + ("4", "one and a half spacing"), + ("5", "triple spacing"), + ] + ), + ) + ] + ), + ), + ( + "single_quote", + wagtail.blocks.StructBlock( + [ + ("quote", wagtail.blocks.RichTextBlock(features=["bold"])), + ("attribution", wagtail.blocks.CharBlock(required=False)), + ( + "attribution_info", + wagtail.blocks.RichTextBlock(features=["bold", "link", "large"], required=False), + ), + ] + ), + ), + ( + "pulse_listing", + wagtail.blocks.StructBlock( + [ + ( + "search_terms", + wagtail.blocks.CharBlock( + help_text="Test your search at mozillapulse.org/search", + label="Search", + required=False, + ), + ), + ( + "max_number_of_results", + wagtail.blocks.IntegerBlock( + default=6, + help_text="Choose 1-12. If you want visitors to see more, link to a search or tag on Pulse.", + max_value=12, + min_value=0, + required=True, + ), + ), + ( + "only_featured_entries", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Featured items are selected by Pulse moderators.", + label="Display only featured entries", + required=False, + ), + ), + ( + "newest_first", + wagtail.blocks.ChoiceBlock( + choices=[ + ("True", "Show newer entries first"), + ("False", "Show older entries first"), + ], + label="Sort", + ), + ), + ( + "advanced_filter_header", + wagtail.blocks.static_block.StaticBlock( + admin_text="-------- ADVANCED FILTERS: OPTIONS TO DISPLAY FEWER, MORE TARGETED RESULTS. --------", + label=" ", + ), + ), + ( + "issues", + wagtail.blocks.ChoiceBlock( + choices=[ + ("all", "All"), + ("Decentralization", "Decentralization"), + ("Digital Inclusion", "Digital Inclusion"), + ("Online Privacy & Security", "Online Privacy & Security"), + ("Open Innovation", "Open Innovation"), + ("Web Literacy", "Web Literacy"), + ] + ), + ), + ( + "help", + wagtail.blocks.ChoiceBlock( + choices=[ + ("all", "All"), + ("Attend", "Attend"), + ("Create content", "Create content"), + ("Code", "Code"), + ("Design", "Design"), + ("Fundraise", "Fundraise"), + ("Join community", "Join community"), + ("Localize & translate", "Localize & translate"), + ("Mentor", "Mentor"), + ("Plan & organize", "Plan & organize"), + ("Promote", "Promote"), + ("Take action", "Take action"), + ("Test & feedback", "Test & feedback"), + ("Write documentation", "Write documentation"), + ], + label="Type of help needed", + ), + ), + ( + "direct_link", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Checked: user goes to project link. Unchecked: user goes to pulse entry", + label="Direct link", + required=False, + ), + ), + ] + ), + ), + ( + "profile_listing", + wagtail.blocks.StructBlock( + [ + ( + "max_number_of_results", + wagtail.blocks.IntegerBlock( + default=12, + help_text="Pick up to 48 profiles.", + max_value=48, + min_value=1, + required=True, + ), + ), + ( + "advanced_filter_header", + wagtail.blocks.static_block.StaticBlock( + admin_text="-------- ADVANCED FILTERS: OPTIONS TO DISPLAY FEWER, MORE TARGETED RESULTS. --------", + label=" ", + ), + ), + ( + "profile_type", + wagtail.blocks.CharBlock(default="", help_text="Example: Fellow.", required=False), + ), + ( + "program_type", + wagtail.blocks.CharBlock( + default="", help_text="Example: Tech Policy.", required=False + ), + ), + ("year", wagtail.blocks.CharBlock(default="", required=False)), + ] + ), + ), + ( + "profile_by_id", + wagtail.blocks.StructBlock( + [ + ( + "ids", + wagtail.blocks.CharBlock( + help_text="Show profiles for pulse users with specific profile ids (mozillapulse.org/profile/[##]). For multiple profiles, specify a comma separated list (e.g. 85,105,332).", + label="Profile by ID", + ), + ) + ] + ), + ), + ( + "profile_directory", + wagtail.blocks.StructBlock( + [ + ( + "max_number_of_results", + wagtail.blocks.IntegerBlock( + default=12, + help_text="Pick up to 48 profiles.", + max_value=48, + min_value=1, + required=True, + ), + ), + ( + "advanced_filter_header", + wagtail.blocks.static_block.StaticBlock( + admin_text="-------- ADVANCED FILTERS: OPTIONS TO DISPLAY FEWER, MORE TARGETED RESULTS. --------", + label=" ", + ), + ), + ( + "profile_type", + wagtail.blocks.CharBlock(default="", help_text="Example: Fellow.", required=False), + ), + ( + "program_type", + wagtail.blocks.CharBlock( + default="", help_text="Example: Tech Policy.", required=False + ), + ), + ("year", wagtail.blocks.CharBlock(default="", required=False)), + ( + "filter_values", + wagtail.blocks.CharBlock( + default="2019,2018,2017,2016,2015,2014,2013", + help_text="Example: 2019,2018,2017,2016,2015,2014,2013", + required=True, + ), + ), + ] + ), + ), + ( + "recent_blog_entries", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock(required=False)), + ( + "tag_filter", + wagtail.blocks.CharBlock( + help_text="Test this filter at foundation.mozilla.org/blog/tags/", + label="Filter by Tag", + required=False, + ), + ), + ( + "topic_filter", + wagtail.blocks.ChoiceBlock( + choices=networkapi.wagtailpages.pagemodels.blog.blog_topic.BlogPageTopic.get_topics, + help_text="Test this filter at foundation.mozilla.org/blog/topic/", + label="Filter by Topic", + required=False, + ), + ), + ( + "top_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider above content block.", required=False + ), + ), + ( + "bottom_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider below content block.", required=False + ), + ), + ] + ), + ), + ( + "blog_set", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock()), + ( + "top_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider above content block.", required=False + ), + ), + ( + "bottom_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider below content block.", required=False + ), + ), + ( + "blog_pages", + wagtail.blocks.ListBlock( + wagtail.blocks.PageChooserBlock(page_type=["wagtailpages.BlogPage"]) + ), + ), + ] + ), + ), + ( + "airtable", + wagtail.blocks.StructBlock( + [ + ( + "url", + wagtail.blocks.URLBlock( + help_text="Copied from the Airtable embed code. The word 'embed' will be in the url" + ), + ), + ( + "height", + wagtail.blocks.IntegerBlock( + default=533, + help_text="The pixel height on desktop view, usually copied from the Airtable embed code", + ), + ), + ] + ), + ), + ( + "typeform", + wagtail.blocks.StructBlock( + [ + ( + "embed_id", + wagtail.blocks.CharBlock( + help_text="The embed id of your Typeform page (e.g. if the form is on admin.typeform.com/form/e8zScc6t, the id will be: e8zScc6t)", + required=True, + ), + ), + ( + "button_type", + wagtail.blocks.ChoiceBlock( + choices=[ + ("btn-primary", "Primary button"), + ("btn-secondary", "Secondary button"), + ] + ), + ), + ( + "button_text", + wagtail.blocks.CharBlock( + help_text="This is a text prompt for users to open the typeform content", + required=True, + ), + ), + ] + ), + ), + ( + "datawrapper", + wagtail.embeds.blocks.EmbedBlock( + help_text='Enter the "visualization only" link of the Datawrapper chart. It looks something like this: https://datawrapper.dwcdn.net/KwSKp/1/', + icon="image", + template="wagtailpages/blocks/datawrapper_block.html", + ), + ), + ( + "listing", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock(help_text="Heading for the block.", required=False), + ), + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Alt text for card's image.", required=False + ), + ), + ("title", wagtail.blocks.CharBlock(help_text="Heading for the card.")), + ( + "highlighted_metadata", + wagtail.blocks.CharBlock( + help_text="Metadata to highlight on the card.", required=False + ), + ), + ( + "metadata", + wagtail.blocks.CharBlock( + help_text="Generic metadata.", required=False + ), + ), + ( + "body", + wagtail.blocks.RichTextBlock( + features=["bold"], + help_text="Body text of the card.", + required=False, + ), + ), + ( + "link_page", + wagtail.blocks.PageChooserBlock( + help_text="Page that this should link out to.", required=False + ), + ), + ( + "link_url", + wagtail.blocks.CharBlock( + help_text="Optional URL that the header should link out to.", + required=False, + ), + ), + ] + ), + help_text="Please use a minimum of 2 cards.", + min_num=2, + ), + ), + ( + "cards_per_row", + wagtail.blocks.ChoiceBlock( + choices=[(2, "2"), (3, "3")], + help_text="Number of cards per row. Note: this is a max and fewer might be used if is less space is available.", + required=False, + ), + ), + ] + ), + ), + ( + "profiles", + wagtail.blocks.StructBlock( + [ + ( + "profiles", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "profile", + wagtail.snippets.blocks.SnippetChooserBlock( + networkapi.wagtailpages.pagemodels.profiles.Profile + ), + ) + ] + ), + min_num=1, + ), + ) + ] + ), + ), + ( + "article_teaser_block", + wagtail.blocks.StructBlock( + [ + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "article", + wagtail.blocks.PageChooserBlock( + help_text="Page that this should link out to.", + page_type=["wagtailpages.ArticlePage"], + required=False, + ), + ) + ] + ), + help_text="Please use a minimum of 3 cards.", + min_num=3, + ), + ) + ] + ), + ), + ( + "group_listing_block", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + help_text="Heading for the group of cards.", required=False + ), + ), + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Alt text for card's image.", required=False + ), + ), + ( + "meta_data", + wagtail.blocks.CharBlock( + help_text="Optional meta data information for the card.", + required=False, + ), + ), + ("title", wagtail.blocks.CharBlock(help_text="Heading for the card.")), + ( + "body", + wagtail.blocks.RichTextBlock( + features=["bold", "link"], help_text="Body text of the card." + ), + ), + ( + "link", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock( + label="Page", required=False + ), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", required=False + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False + ), + ), + ] + ), + help_text="Optional link that this card should link to.", + max_num=1, + min_num=0, + ), + ), + ] + ) + ), + ), + ] + ), + ), + ( + "image_feature", + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "alt_text", + wagtail.blocks.CharBlock(help_text="Image description (for screen readers)."), + ), + ("metadata", wagtail.blocks.CharBlock(required=False)), + ("title", wagtail.blocks.CharBlock(help_text="Heading for the card.")), + ( + "title_link", + wagtail.blocks.PageChooserBlock( + help_text="Page that the title should link out to.", required=False + ), + ), + ("body", wagtail.blocks.CharBlock(required=False)), + ] + ), + ), + ( + "image_teaser_block", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock(help_text="Heading for the card.")), + ("text", wagtail.blocks.RichTextBlock(features=["bold"])), + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "altText", + wagtail.blocks.CharBlock( + help_text="Image description (for screen readers).", required=True + ), + ), + ( + "link_button", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("label", wagtail.blocks.CharBlock()), + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock(label="Page", required=False), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", required=False + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False + ), + ), + ( + "styling", + wagtail.blocks.ChoiceBlock( + choices=[ + ("btn-primary", "Primary button"), + ("btn-secondary", "Secondary button"), + ] + ), + ), + ] + ), + help_text="Optional link button", + max_num=1, + min_num=0, + ), + ), + ( + "top_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider above content block.", required=False + ), + ), + ( + "bottom_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider below content block.", required=False + ), + ), + ] + ), + ), + ( + "text_only_teaser", + wagtail.blocks.StructBlock( + [ + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock(help_text="Heading for the card."), + ), + ( + "link_page", + wagtail.blocks.PageChooserBlock( + help_text="Page that the header should link out to.", + required=False, + ), + ), + ( + "link_url", + wagtail.blocks.CharBlock( + help_text="Optional URL that the header should link out to.", + required=False, + ), + ), + ("meta_data", wagtail.blocks.CharBlock(max_length=500)), + ( + "body", + wagtail.blocks.TextBlock( + help_text="Body text of the card.", + max_length=200, + required=False, + ), + ), + ] + ), + help_text="Please use a minimum of 3 cards.", + min_num=3, + ), + ) + ] + ), + ), + ( + "block_with_aside", + wagtail.blocks.StructBlock( + [ + ( + "content", + wagtail.blocks.StreamBlock( + [ + ( + "listing", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + help_text="Heading for the block.", required=False + ), + ), + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "image", + wagtail.images.blocks.ImageChooserBlock(), + ), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Alt text for card's image.", + required=False, + ), + ), + ( + "title", + wagtail.blocks.CharBlock( + help_text="Heading for the card." + ), + ), + ( + "highlighted_metadata", + wagtail.blocks.CharBlock( + help_text="Metadata to highlight on the card.", + required=False, + ), + ), + ( + "metadata", + wagtail.blocks.CharBlock( + help_text="Generic metadata.", + required=False, + ), + ), + ( + "body", + wagtail.blocks.RichTextBlock( + features=["bold"], + help_text="Body text of the card.", + required=False, + ), + ), + ( + "link_page", + wagtail.blocks.PageChooserBlock( + help_text="Page that this should link out to.", + required=False, + ), + ), + ( + "link_url", + wagtail.blocks.CharBlock( + help_text="Optional URL that the header should link out to.", + required=False, + ), + ), + ] + ), + help_text="Please use a minimum of 2 cards.", + min_num=2, + ), + ), + ( + "cards_per_row", + wagtail.blocks.ChoiceBlock( + choices=[(2, "2"), (3, "3")], + help_text="Number of cards per row. Note: this is a max and fewer might be used if is less space is available.", + required=False, + ), + ), + ] + ), + ), + ( + "paragraph", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "h2", + "h3", + "h4", + "h5", + "ol", + "ul", + "hr", + "document-link", + ] + ), + ), + ], + help_text="The wider block that appears on the left on desktop", + icon="doc-full", + max_num=1, + ), + ), + ( + "aside", + wagtail.blocks.StreamBlock( + [ + ( + "aside_content", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + help_text="Heading for the card.", required=False + ), + ), + ( + "body", + wagtail.blocks.TextBlock( + help_text="Body text of the card.", required=False + ), + ), + ] + ), + ), + ( + "linkbutton", + wagtail.blocks.StructBlock( + [ + ("label", wagtail.blocks.CharBlock()), + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock( + label="Page", required=False + ), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", required=False + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False + ), + ), + ( + "styling", + wagtail.blocks.ChoiceBlock( + choices=[ + ("btn-primary", "Primary button"), + ("btn-secondary", "Secondary button"), + ] + ), + ), + ] + ), + ), + ( + "spacer", + wagtail.blocks.StructBlock( + [ + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("1", "quarter spacing"), + ("2", "half spacing"), + ("3", "single spacing"), + ("4", "one and a half spacing"), + ("5", "triple spacing"), + ] + ), + ) + ] + ), + ), + ], + help_text="Elements here will appear in the column on the right side of the page on desktop. This can be left blank if you would just like a 2/3 column on the left", + icon="doc-full", + required=False, + ), + ), + ] + ), + ), + ( + "accordion", + wagtail.blocks.StructBlock( + [ + ( + "accordion_items", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + help_text="Heading for the Accordion Item" + ), + ), + ( + "content", + wagtail.blocks.StreamBlock( + [ + ( + "rich_text", + wagtail.blocks.RichTextBlock( + blank=True, + features=[ + "bold", + "italic", + "link", + "ul", + "ol", + "document-link", + ], + ), + ), + ( + "datawrapper", + wagtail.embeds.blocks.EmbedBlock( + help_text='Enter the "visualization only" link of the Datawrapper chart. It looks something like this: https://datawrapper.dwcdn.net/KwSKp/1/', + icon="image", + template="wagtailpages/blocks/datawrapper_block.html", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "image", + wagtail.images.blocks.ImageChooserBlock(), + ), + ( + "altText", + wagtail.blocks.CharBlock( + help_text="Image description (for screen readers).", + required=True, + ), + ), + ] + ), + ), + ( + "video", + wagtail.blocks.StructBlock( + [ + ( + "url", + wagtail.blocks.URLBlock( + help_text="For YouTube: go to your YouTube video and click “Share,” then “Embed,” and then copy and paste the provided URL only. For example: https://www.youtube.com/embed/3FIVXBawyQw For Vimeo: follow similar steps to grab the embed URL. For example: https://player.vimeo.com/video/9004979", + label="Embed URL", + ), + ), + ( + "caption", + wagtail.blocks.CharBlock(required=False), + ), + ( + "caption_url", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ( + "external_url", + "External URL", + ), + ( + "relative_url", + "Relative URL", + ), + ("email", "Email"), + ( + "anchor", + "Anchor", + ), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock( + label="Page", + required=False, + ), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ( + "email", + wagtail.blocks.EmailBlock( + required=False + ), + ), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", + required=False, + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", + max_length=30, + required=False, + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", + required=False, + ), + ), + ] + ), + help_text="Optional URL that this caption should link out to.", + max_num=1, + min_num=0, + ), + ), + ( + "video_width", + wagtail.blocks.ChoiceBlock( + choices=[ + ("normal", "Normal"), + ("wide", "Wide"), + ("full_width", "Full Width"), + ], + help_text="Wide videos are col-12, Full-Width videos reach both ends of the screen.", + ), + ), + ] + ), + ), + ] + ), + ), + ] + ) + ), + ) + ] + ), + ), + ], + blank=True, + use_json_field=True, + ), + ), + ] diff --git a/network-api/networkapi/mozfest/migrations/0057_update_grouplistingblock_with_linkblock.py b/network-api/networkapi/mozfest/migrations/0057_update_grouplistingblock_with_linkblock.py new file mode 100644 index 00000000000..336ceb0f1c0 --- /dev/null +++ b/network-api/networkapi/mozfest/migrations/0057_update_grouplistingblock_with_linkblock.py @@ -0,0 +1,4774 @@ +# Generated by Django 4.2.14 on 2024-07-17 01:24 + +import wagtail.blocks +import wagtail.blocks.static_block +import wagtail.documents.blocks +import wagtail.embeds.blocks +import wagtail.fields +import wagtail.images.blocks +import wagtail.snippets.blocks +import wagtailmedia.blocks +from django.db import migrations +from wagtail.blocks.migrations.migrate_operation import MigrateStreamData + +import networkapi.wagtailpages.pagemodels.blog.blog_topic +import networkapi.wagtailpages.pagemodels.profiles +import networkapi.wagtailpages.validators +from networkapi.utility.migration.operations import AlterStreamChildBlockDataOperation + + +def migrate_group_listing_block_cards(source_block): + + if "cards" in source_block["value"]: + for card in source_block["value"]["cards"]: + + old_url = card["value"].get("url") + if old_url: + card["value"]["link"] = [ + { + "link_to": "external_url", + "external_url": old_url, + "new_window": True, + } + ] + + return source_block + + +class Migration(migrations.Migration): + + dependencies = [ + ("mozfest", "0056_update_imageteaserblock_with_linkblock"), + ] + + operations = [ + migrations.AlterField( + model_name="mozfestprimarypage", + name="body", + field=wagtail.fields.StreamField( + [ + ( + "paragraph", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "h2", + "h3", + "h4", + "h5", + "ol", + "ul", + "hr", + "document-link", + "large", + ], + template="wagtailpages/blocks/rich_text_block.html", + ), + ), + ( + "card_grid", + wagtail.blocks.StructBlock( + [ + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Alt text for card's image.", required=False + ), + ), + ("title", wagtail.blocks.CharBlock(help_text="Heading for the card.")), + ("body", wagtail.blocks.TextBlock(help_text="Body text of the card.")), + ( + "link_url", + wagtail.blocks.CharBlock( + help_text="Optional URL that this card should link out to. (Note: If left blank, link will not render.) ", + required=False, + ), + ), + ( + "link_label", + wagtail.blocks.CharBlock( + help_text="Optional Label for the URL link above. (Note: If left blank, link will not render.) ", + required=False, + ), + ), + ] + ), + help_text="Please use a minimum of 2 cards.", + ), + ) + ] + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "altText", + wagtail.blocks.CharBlock( + help_text="Image description (for screen readers).", required=True + ), + ), + ("caption", wagtail.blocks.CharBlock(required=False)), + ( + "caption_url", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock(label="Page", required=False), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", required=False + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False + ), + ), + ] + ), + help_text="Optional URL that this caption should link out to.", + max_num=1, + min_num=0, + ), + ), + ( + "image_width", + wagtail.blocks.ChoiceBlock( + choices=[("normal", "Normal"), ("wide", "Wide"), ("full_width", "Full Width")], + help_text="Wide images are col-12, Full-Width Images reach both ends of the screen (16:6 images recommended for full width)", + ), + ), + ] + ), + ), + ( + "image_text", + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "altText", + wagtail.blocks.CharBlock( + help_text="Image description (for screen readers).", required=True + ), + ), + ( + "text", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "h2", + "h3", + "h4", + "h5", + "ol", + "ul", + "hr", + "document-link", + ] + ), + ), + ( + "url", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock(label="Page", required=False), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", required=False + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False + ), + ), + ] + ), + help_text="Optional URL that this image should link out to.", + max_num=1, + min_num=0, + ), + ), + ( + "top_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider above content block.", required=False + ), + ), + ( + "bottom_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider below content block.", required=False + ), + ), + ] + ), + ), + ( + "image_text_mini", + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "altText", + wagtail.blocks.CharBlock( + help_text="Image description (for screen readers).", required=True + ), + ), + ("text", wagtail.blocks.RichTextBlock(features=["bold", "italic", "link"])), + ] + ), + ), + ( + "image_grid", + wagtail.blocks.StructBlock( + [ + ( + "grid_items", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Alt text for this image.", required=False + ), + ), + ( + "caption", + wagtail.blocks.CharBlock( + help_text="Please remember to properly attribute any images we use.", + required=False, + ), + ), + ( + "url", + wagtail.blocks.CharBlock( + help_text="Optional URL that this figure should link out to.", + required=False, + ), + ), + ( + "square_image", + wagtail.blocks.BooleanBlock( + default=True, + help_text="If left checked, the image will be cropped to be square.", + required=False, + ), + ), + ] + ) + ), + ) + ] + ), + ), + ( + "video", + wagtail.blocks.StructBlock( + [ + ( + "url", + wagtail.blocks.URLBlock( + help_text="For YouTube: go to your YouTube video and click “Share,” then “Embed,” and then copy and paste the provided URL only. For example: https://www.youtube.com/embed/3FIVXBawyQw For Vimeo: follow similar steps to grab the embed URL. For example: https://player.vimeo.com/video/9004979", + label="Embed URL", + ), + ), + ("caption", wagtail.blocks.CharBlock(required=False)), + ( + "caption_url", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock(label="Page", required=False), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", required=False + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False + ), + ), + ] + ), + help_text="Optional URL that this caption should link out to.", + max_num=1, + min_num=0, + ), + ), + ( + "video_width", + wagtail.blocks.ChoiceBlock( + choices=[("normal", "Normal"), ("wide", "Wide"), ("full_width", "Full Width")], + help_text="Wide videos are col-12, Full-Width videos reach both ends of the screen.", + ), + ), + ] + ), + ), + ( + "iframe", + wagtail.blocks.StructBlock( + [ + ( + "url", + wagtail.blocks.CharBlock( + help_text="Please note that only URLs from allow-listed domains will work." + ), + ), + ( + "height", + wagtail.blocks.IntegerBlock( + help_text="Optional integer pixel value for custom iFrame height", + required=False, + ), + ), + ("caption", wagtail.blocks.CharBlock(required=False)), + ( + "caption_url", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock(label="Page", required=False), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", required=False + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False + ), + ), + ] + ), + help_text="Optional URL that this caption should link out to.", + max_num=1, + min_num=0, + ), + ), + ( + "iframe_width", + wagtail.blocks.ChoiceBlock( + choices=[("normal", "Normal"), ("wide", "Wide"), ("full_width", "Full Width")], + help_text="Wide iframes are col-12, Full-Width iframes reach both ends of the screen", + ), + ), + ( + "disable_scroll", + wagtail.blocks.BooleanBlock( + default=False, + help_text='Checking this will add "scrolling=no" to the iframe. Use this if your iframe is rendering an unnecessary scroll bar or whitespace below it.', + required=False, + ), + ), + ] + ), + ), + ( + "linkbutton", + wagtail.blocks.StructBlock( + [ + ("label", wagtail.blocks.CharBlock()), + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ("page", wagtail.blocks.PageChooserBlock(label="Page", required=False)), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[networkapi.wagtailpages.validators.RelativeURLValidator()], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[networkapi.wagtailpages.validators.AnchorLinkValidator()], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ("file", wagtail.documents.blocks.DocumentChooserBlock(label="File", required=False)), + ("phone", wagtail.blocks.CharBlock(label="Phone", max_length=30, required=False)), + ( + "new_window", + wagtail.blocks.BooleanBlock(label="Open in new window", required=False), + ), + ( + "styling", + wagtail.blocks.ChoiceBlock( + choices=[ + ("btn-primary", "Primary button"), + ("btn-secondary", "Secondary button"), + ] + ), + ), + ] + ), + ), + ( + "spacer", + wagtail.blocks.StructBlock( + [ + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("1", "quarter spacing"), + ("2", "half spacing"), + ("3", "single spacing"), + ("4", "one and a half spacing"), + ("5", "triple spacing"), + ] + ), + ) + ] + ), + ), + ( + "single_quote", + wagtail.blocks.StructBlock( + [ + ("quote", wagtail.blocks.RichTextBlock(features=["bold"])), + ("attribution", wagtail.blocks.CharBlock(required=False)), + ( + "attribution_info", + wagtail.blocks.RichTextBlock(features=["bold", "link", "large"], required=False), + ), + ] + ), + ), + ( + "profile_by_id", + wagtail.blocks.StructBlock( + [ + ( + "ids", + wagtail.blocks.CharBlock( + help_text="Show profiles for pulse users with specific profile ids (mozillapulse.org/profile/[##]). For multiple profiles, specify a comma separated list (e.g. 85,105,332).", + label="Profile by ID", + ), + ) + ] + ), + ), + ( + "profile_directory", + wagtail.blocks.StructBlock( + [ + ( + "max_number_of_results", + wagtail.blocks.IntegerBlock( + default=12, + help_text="Pick up to 48 profiles.", + max_value=48, + min_value=1, + required=True, + ), + ), + ( + "advanced_filter_header", + wagtail.blocks.static_block.StaticBlock( + admin_text="-------- ADVANCED FILTERS: OPTIONS TO DISPLAY FEWER, MORE TARGETED RESULTS. --------", + label=" ", + ), + ), + ( + "profile_type", + wagtail.blocks.CharBlock(default="", help_text="Example: Fellow.", required=False), + ), + ( + "program_type", + wagtail.blocks.CharBlock( + default="", help_text="Example: Tech Policy.", required=False + ), + ), + ("year", wagtail.blocks.CharBlock(default="", required=False)), + ( + "filter_values", + wagtail.blocks.CharBlock( + default="2019,2018,2017,2016,2015,2014,2013", + help_text="Example: 2019,2018,2017,2016,2015,2014,2013", + required=True, + ), + ), + ] + ), + ), + ( + "recent_blog_entries", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock(required=False)), + ( + "tag_filter", + wagtail.blocks.CharBlock( + help_text="Test this filter at foundation.mozilla.org/blog/tags/", + label="Filter by Tag", + required=False, + ), + ), + ( + "topic_filter", + wagtail.blocks.ChoiceBlock( + choices=networkapi.wagtailpages.pagemodels.blog.blog_topic.BlogPageTopic.get_topics, + help_text="Test this filter at foundation.mozilla.org/blog/topic/", + label="Filter by Topic", + required=False, + ), + ), + ( + "top_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider above content block.", required=False + ), + ), + ( + "bottom_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider below content block.", required=False + ), + ), + ] + ), + ), + ( + "blog_set", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock()), + ( + "top_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider above content block.", required=False + ), + ), + ( + "bottom_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider below content block.", required=False + ), + ), + ( + "blog_pages", + wagtail.blocks.ListBlock( + wagtail.blocks.PageChooserBlock(page_type=["wagtailpages.BlogPage"]) + ), + ), + ] + ), + ), + ( + "datawrapper", + wagtail.embeds.blocks.EmbedBlock( + help_text='Enter the "visualization only" link of the Datawrapper chart. It looks something like this: https://datawrapper.dwcdn.net/KwSKp/1/', + icon="image", + template="wagtailpages/blocks/datawrapper_block.html", + ), + ), + ( + "listing", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock(help_text="Heading for the block.", required=False), + ), + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Alt text for card's image.", required=False + ), + ), + ("title", wagtail.blocks.CharBlock(help_text="Heading for the card.")), + ( + "highlighted_metadata", + wagtail.blocks.CharBlock( + help_text="Metadata to highlight on the card.", required=False + ), + ), + ( + "metadata", + wagtail.blocks.CharBlock( + help_text="Generic metadata.", required=False + ), + ), + ( + "body", + wagtail.blocks.RichTextBlock( + features=["bold"], + help_text="Body text of the card.", + required=False, + ), + ), + ( + "link_page", + wagtail.blocks.PageChooserBlock( + help_text="Page that this should link out to.", required=False + ), + ), + ( + "link_url", + wagtail.blocks.CharBlock( + help_text="Optional URL that the header should link out to.", + required=False, + ), + ), + ] + ), + help_text="Please use a minimum of 2 cards.", + min_num=2, + ), + ), + ( + "cards_per_row", + wagtail.blocks.ChoiceBlock( + choices=[(2, "2"), (3, "3")], + help_text="Number of cards per row. Note: this is a max and fewer might be used if is less space is available.", + required=False, + ), + ), + ] + ), + ), + ( + "profiles", + wagtail.blocks.StructBlock( + [ + ( + "profiles", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "profile", + wagtail.snippets.blocks.SnippetChooserBlock( + networkapi.wagtailpages.pagemodels.profiles.Profile + ), + ) + ] + ), + min_num=1, + ), + ) + ] + ), + ), + ( + "group_listing_block", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + help_text="Heading for the group of cards.", required=False + ), + ), + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Alt text for card's image.", required=False + ), + ), + ( + "meta_data", + wagtail.blocks.CharBlock( + help_text="Optional meta data information for the card.", + required=False, + ), + ), + ("title", wagtail.blocks.CharBlock(help_text="Heading for the card.")), + ( + "body", + wagtail.blocks.RichTextBlock( + features=["bold", "link"], help_text="Body text of the card." + ), + ), + ( + "url", + wagtail.blocks.CharBlock( + help_text="The URL this card should link to.", required=False + ), + ), + ( + "link", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock( + label="Page", required=False + ), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", required=False + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False + ), + ), + ] + ), + help_text="Optional link that this card should link to.", + max_num=1, + min_num=0, + ), + ), + ] + ) + ), + ), + ] + ), + ), + ( + "image_feature", + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "alt_text", + wagtail.blocks.CharBlock(help_text="Image description (for screen readers)."), + ), + ("metadata", wagtail.blocks.CharBlock(required=False)), + ("title", wagtail.blocks.CharBlock(help_text="Heading for the card.")), + ( + "title_link", + wagtail.blocks.PageChooserBlock( + help_text="Page that the title should link out to.", required=False + ), + ), + ("body", wagtail.blocks.CharBlock(required=False)), + ] + ), + ), + ( + "image_teaser_block", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock(help_text="Heading for the card.")), + ("text", wagtail.blocks.RichTextBlock(features=["bold"])), + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "altText", + wagtail.blocks.CharBlock( + help_text="Image description (for screen readers).", required=True + ), + ), + ( + "link_button", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("label", wagtail.blocks.CharBlock()), + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock(label="Page", required=False), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", required=False + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False + ), + ), + ( + "styling", + wagtail.blocks.ChoiceBlock( + choices=[ + ("btn-primary", "Primary button"), + ("btn-secondary", "Secondary button"), + ] + ), + ), + ] + ), + help_text="Optional link button", + max_num=1, + min_num=0, + ), + ), + ( + "top_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider above content block.", required=False + ), + ), + ( + "bottom_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider below content block.", required=False + ), + ), + ] + ), + ), + ( + "text_only_teaser", + wagtail.blocks.StructBlock( + [ + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock(help_text="Heading for the card."), + ), + ( + "link_page", + wagtail.blocks.PageChooserBlock( + help_text="Page that the header should link out to.", + required=False, + ), + ), + ( + "link_url", + wagtail.blocks.CharBlock( + help_text="Optional URL that the header should link out to.", + required=False, + ), + ), + ("meta_data", wagtail.blocks.CharBlock(max_length=500)), + ( + "body", + wagtail.blocks.TextBlock( + help_text="Body text of the card.", + max_length=200, + required=False, + ), + ), + ] + ), + help_text="Please use a minimum of 3 cards.", + min_num=3, + ), + ) + ] + ), + ), + ( + "block_with_aside", + wagtail.blocks.StructBlock( + [ + ( + "content", + wagtail.blocks.StreamBlock( + [ + ( + "listing", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + help_text="Heading for the block.", required=False + ), + ), + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "image", + wagtail.images.blocks.ImageChooserBlock(), + ), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Alt text for card's image.", + required=False, + ), + ), + ( + "title", + wagtail.blocks.CharBlock( + help_text="Heading for the card." + ), + ), + ( + "highlighted_metadata", + wagtail.blocks.CharBlock( + help_text="Metadata to highlight on the card.", + required=False, + ), + ), + ( + "metadata", + wagtail.blocks.CharBlock( + help_text="Generic metadata.", + required=False, + ), + ), + ( + "body", + wagtail.blocks.RichTextBlock( + features=["bold"], + help_text="Body text of the card.", + required=False, + ), + ), + ( + "link_page", + wagtail.blocks.PageChooserBlock( + help_text="Page that this should link out to.", + required=False, + ), + ), + ( + "link_url", + wagtail.blocks.CharBlock( + help_text="Optional URL that the header should link out to.", + required=False, + ), + ), + ] + ), + help_text="Please use a minimum of 2 cards.", + min_num=2, + ), + ), + ( + "cards_per_row", + wagtail.blocks.ChoiceBlock( + choices=[(2, "2"), (3, "3")], + help_text="Number of cards per row. Note: this is a max and fewer might be used if is less space is available.", + required=False, + ), + ), + ] + ), + ), + ( + "paragraph", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "h2", + "h3", + "h4", + "h5", + "ol", + "ul", + "hr", + "document-link", + ] + ), + ), + ], + help_text="The wider block that appears on the left on desktop", + icon="doc-full", + max_num=1, + ), + ), + ( + "aside", + wagtail.blocks.StreamBlock( + [ + ( + "aside_content", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + help_text="Heading for the card.", required=False + ), + ), + ( + "body", + wagtail.blocks.TextBlock( + help_text="Body text of the card.", required=False + ), + ), + ] + ), + ), + ( + "linkbutton", + wagtail.blocks.StructBlock( + [ + ("label", wagtail.blocks.CharBlock()), + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock( + label="Page", required=False + ), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", required=False + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False + ), + ), + ( + "styling", + wagtail.blocks.ChoiceBlock( + choices=[ + ("btn-primary", "Primary button"), + ("btn-secondary", "Secondary button"), + ] + ), + ), + ] + ), + ), + ( + "spacer", + wagtail.blocks.StructBlock( + [ + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("1", "quarter spacing"), + ("2", "half spacing"), + ("3", "single spacing"), + ("4", "one and a half spacing"), + ("5", "triple spacing"), + ] + ), + ) + ] + ), + ), + ], + help_text="Elements here will appear in the column on the right side of the page on desktop. This can be left blank if you would just like a 2/3 column on the left", + icon="doc-full", + required=False, + ), + ), + ] + ), + ), + ( + "accordion", + wagtail.blocks.StructBlock( + [ + ( + "accordion_items", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + help_text="Heading for the Accordion Item" + ), + ), + ( + "content", + wagtail.blocks.StreamBlock( + [ + ( + "rich_text", + wagtail.blocks.RichTextBlock( + blank=True, + features=[ + "bold", + "italic", + "link", + "ul", + "ol", + "document-link", + ], + ), + ), + ( + "datawrapper", + wagtail.embeds.blocks.EmbedBlock( + help_text='Enter the "visualization only" link of the Datawrapper chart. It looks something like this: https://datawrapper.dwcdn.net/KwSKp/1/', + icon="image", + template="wagtailpages/blocks/datawrapper_block.html", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "image", + wagtail.images.blocks.ImageChooserBlock(), + ), + ( + "altText", + wagtail.blocks.CharBlock( + help_text="Image description (for screen readers).", + required=True, + ), + ), + ] + ), + ), + ( + "video", + wagtail.blocks.StructBlock( + [ + ( + "url", + wagtail.blocks.URLBlock( + help_text="For YouTube: go to your YouTube video and click “Share,” then “Embed,” and then copy and paste the provided URL only. For example: https://www.youtube.com/embed/3FIVXBawyQw For Vimeo: follow similar steps to grab the embed URL. For example: https://player.vimeo.com/video/9004979", + label="Embed URL", + ), + ), + ( + "caption", + wagtail.blocks.CharBlock(required=False), + ), + ( + "caption_url", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ( + "external_url", + "External URL", + ), + ( + "relative_url", + "Relative URL", + ), + ("email", "Email"), + ( + "anchor", + "Anchor", + ), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock( + label="Page", + required=False, + ), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ( + "email", + wagtail.blocks.EmailBlock( + required=False + ), + ), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", + required=False, + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", + max_length=30, + required=False, + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", + required=False, + ), + ), + ] + ), + help_text="Optional URL that this caption should link out to.", + max_num=1, + min_num=0, + ), + ), + ( + "video_width", + wagtail.blocks.ChoiceBlock( + choices=[ + ("normal", "Normal"), + ("wide", "Wide"), + ("full_width", "Full Width"), + ], + help_text="Wide videos are col-12, Full-Width videos reach both ends of the screen.", + ), + ), + ] + ), + ), + ] + ), + ), + ] + ) + ), + ) + ] + ), + ), + ( + "session_slider", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock(help_text="Heading for the slider.")), + ( + "session_items", + wagtail.blocks.StreamBlock( + [ + ( + "session_item", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + help_text="Heading for the card." + ), + ), + ( + "author_subheading", + wagtail.blocks.CharBlock( + help_text="Author of this session.", required=False + ), + ), + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + help_text="The image associated with this session." + ), + ), + ( + "body", + wagtail.blocks.RichTextBlock( + help_text="Body text of this card." + ), + ), + ( + "video", + wagtailmedia.blocks.VideoChooserBlock( + help_text="Video that will autoplay when this card is hovered on", + required=False, + ), + ), + ( + "link", + wagtail.blocks.StreamBlock( + [ + ( + "internal", + wagtail.blocks.StructBlock( + [ + ( + "link", + wagtail.blocks.PageChooserBlock( + help_text="Page that this should link out to." + ), + ) + ] + ), + ), + ( + "external", + wagtail.blocks.StructBlock( + [ + ( + "link", + wagtail.blocks.URLBlock( + help_text="URL that this should link out to." + ), + ) + ] + ), + ), + ], + help_text="Page or external URL this card will link out to.", + max_num=1, + ), + ), + ] + ), + ) + ], + help_text="A list of sessions in the slider.", + ), + ), + ( + "button", + wagtail.blocks.StreamBlock( + [ + ( + "internal", + wagtail.blocks.StructBlock( + [ + ( + "label", + wagtail.blocks.CharBlock(help_text="Label for this link."), + ), + ( + "link", + wagtail.blocks.PageChooserBlock( + help_text="Page that this should link out to." + ), + ), + ] + ), + ), + ( + "external", + wagtail.blocks.StructBlock( + [ + ( + "label", + wagtail.blocks.CharBlock(help_text="Label for this link."), + ), + ( + "link", + wagtail.blocks.URLBlock( + help_text="URL that this should link out to." + ), + ), + ] + ), + ), + ], + help_text="Button that appears below the slider.", + max_num=1, + required=False, + ), + ), + ] + ), + ), + ( + "current_events_slider", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock(help_text="Heading for the slider.")), + ( + "current_events", + wagtail.blocks.StreamBlock( + [ + ( + "current_event", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock(help_text="Heading of the card."), + ), + ( + "subheading_link", + wagtail.blocks.StreamBlock( + [ + ( + "internal", + wagtail.blocks.StructBlock( + [ + ( + "label", + wagtail.blocks.CharBlock( + help_text="Label for this link." + ), + ), + ( + "link", + wagtail.blocks.PageChooserBlock( + help_text="Page that this should link out to." + ), + ), + ] + ), + ), + ( + "external", + wagtail.blocks.StructBlock( + [ + ( + "label", + wagtail.blocks.CharBlock( + help_text="Label for this link." + ), + ), + ( + "link", + wagtail.blocks.URLBlock( + help_text="URL that this should link out to." + ), + ), + ] + ), + ), + ], + help_text="The link that appears below the card heading.", + max_num=1, + required=False, + ), + ), + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + help_text="The image associated with this event." + ), + ), + ( + "body", + wagtail.blocks.TextBlock( + help_text="Body text of the card." + ), + ), + ( + "buttons", + wagtail.blocks.StreamBlock( + [ + ( + "internal", + wagtail.blocks.StructBlock( + [ + ( + "label", + wagtail.blocks.CharBlock( + help_text="Label for this link." + ), + ), + ( + "link", + wagtail.blocks.PageChooserBlock( + help_text="Page that this should link out to." + ), + ), + ] + ), + ), + ( + "external", + wagtail.blocks.StructBlock( + [ + ( + "label", + wagtail.blocks.CharBlock( + help_text="Label for this link." + ), + ), + ( + "link", + wagtail.blocks.URLBlock( + help_text="URL that this should link out to." + ), + ), + ] + ), + ), + ( + "document", + wagtail.blocks.StructBlock( + [ + ( + "label", + wagtail.blocks.CharBlock( + help_text="Label for this link." + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + help_text="Document that this should link out to." + ), + ), + ], + help_text='An iCal document can be attached here for an "Add to Calendar" button.', + ), + ), + ], + help_text="A list of buttons that will appear at the bottom of the card.", + max_num=2, + ), + ), + ] + ), + ) + ], + help_text="A list of current events in the slider.", + ), + ), + ] + ), + ), + ( + "spaces", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock()), + ( + "cards", + wagtail.blocks.StreamBlock( + [ + ( + "space_card", + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "title", + wagtail.blocks.CharBlock( + help_text="Heading for the card." + ), + ), + ( + "body", + wagtail.blocks.TextBlock( + help_text="Body text of the card." + ), + ), + ( + "link", + wagtail.blocks.StreamBlock( + [ + ( + "internal", + wagtail.blocks.StructBlock( + [ + ( + "link", + wagtail.blocks.PageChooserBlock( + help_text="Page that this should link out to." + ), + ) + ] + ), + ), + ( + "external", + wagtail.blocks.StructBlock( + [ + ( + "link", + wagtail.blocks.URLBlock( + help_text="URL that this should link out to." + ), + ) + ] + ), + ), + ], + help_text="Page or external URL this card will link out to.", + max_num=1, + ), + ), + ] + ), + ) + ], + help_text="A list of Spaces Cards.", + ), + ), + ] + ), + ), + ( + "tito_widget", + wagtail.blocks.StructBlock( + [ + ( + "button_label", + wagtail.blocks.CharBlock(help_text="The text to show on the Tito button."), + ), + ( + "styling", + wagtail.blocks.ChoiceBlock( + choices=[ + ("btn-primary", "Primary button"), + ("btn-secondary", "Secondary button"), + ] + ), + ), + ( + "event", + wagtail.snippets.blocks.SnippetChooserBlock( + "events.TitoEvent", help_event="The Tito event to be displayed" + ), + ), + ( + "releases", + wagtail.blocks.CharBlock( + help_text='Comma-separated list of ticket/release IDs to limit to, e.g. "3elajg6qcxu,6qiiw4socs4"', + required=False, + ), + ), + ] + ), + ), + ( + "statistics", + wagtail.blocks.StructBlock( + [ + ( + "statistics", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + help_text="The statistic figure, e.g '1000+' or '10%'" + ), + ), + ( + "description", + wagtail.blocks.CharBlock( + help_text="Context or description for the statistic" + ), + ), + ] + ), + help_text="Please use a minimum of 2 cards.", + max_num=4, + min_num=2, + ), + ) + ] + ), + ), + ( + "carousel_and_text", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock(help_text="Heading for the block.", required=False), + ), + ("text", wagtail.blocks.RichTextBlock(features=["bold", "italic", "link"])), + ( + "link_url", + wagtail.blocks.URLBlock( + help_text="A CTA URL for a link displayed", required=False + ), + ), + ( + "link_label", + wagtail.blocks.CharBlock(help_text="Label for the CTA link.", required=False), + ), + ( + "carousel_images", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "altText", + wagtail.blocks.CharBlock( + help_text="Image description (for screen readers).", + required=True, + ), + ), + ] + ), + max_num=4, + ), + ), + ] + ), + ), + ( + "tickets", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock(help_text="Heading for the block.", required=False), + ), + ( + "tickets", + wagtail.blocks.ListBlock( + wagtail.snippets.blocks.SnippetChooserBlock("mozfest.Ticket"), max_num=3 + ), + ), + ] + ), + ), + ( + "dark_quote", + wagtail.blocks.StructBlock( + [ + ("quote", wagtail.blocks.RichTextBlock(features=["bold"])), + ("attribution", wagtail.blocks.CharBlock(required=False)), + ( + "attribution_info", + wagtail.blocks.RichTextBlock(features=["bold", "link", "large"], required=False), + ), + ] + ), + ), + ( + "cta", + wagtail.blocks.StructBlock( + [ + ("label", wagtail.blocks.CharBlock()), + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ("page", wagtail.blocks.PageChooserBlock(label="Page", required=False)), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[networkapi.wagtailpages.validators.RelativeURLValidator()], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[networkapi.wagtailpages.validators.AnchorLinkValidator()], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ("file", wagtail.documents.blocks.DocumentChooserBlock(label="File", required=False)), + ("phone", wagtail.blocks.CharBlock(label="Phone", max_length=30, required=False)), + ( + "new_window", + wagtail.blocks.BooleanBlock(label="Open in new window", required=False), + ), + ("heading", wagtail.blocks.CharBlock(required=False)), + ("text", wagtail.blocks.CharBlock(required=False)), + ("dark_background", wagtail.blocks.BooleanBlock(required=False)), + ] + ), + ), + ( + "newsletter_signup", + wagtail.blocks.StructBlock( + [ + ( + "snippet", + wagtail.snippets.blocks.SnippetChooserBlock( + "mozfest.NewsletterSignupWithBackground" + ), + ) + ] + ), + ), + ( + "mixed_content", + wagtail.blocks.StructBlock( + [ + ( + "video", + wagtail.blocks.StructBlock( + [ + ( + "url", + wagtail.blocks.URLBlock( + help_text="For YouTube: go to your YouTube video and click “Share,” then “Embed,” and then copy and paste the provided URL only. For example: https://www.youtube.com/embed/3FIVXBawyQw For Vimeo: follow similar steps to grab the embed URL. For example: https://player.vimeo.com/video/9004979", + label="Embed URL", + ), + ), + ( + "caption", + wagtail.blocks.CharBlock( + help_text="Optional caption for the video, displayed next to the play button.", + max_length=25, + required=False, + ), + ), + ( + "title", + wagtail.blocks.CharBlock( + help_text="Optional title for the video.", + max_length=50, + required=False, + ), + ), + ( + "text", + wagtail.blocks.CharBlock( + help_text="Text content to display with the video title.", + required=False, + ), + ), + ( + "thumbnail", + wagtail.images.blocks.ImageChooserBlock( + help_text="The image to show before the video is played." + ), + ), + ] + ), + ), + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Alt text for card's image.", required=False + ), + ), + ("title", wagtail.blocks.CharBlock(help_text="Heading for the card.")), + ( + "highlighted_metadata", + wagtail.blocks.CharBlock( + help_text="Metadata to highlight on the card.", required=False + ), + ), + ( + "metadata", + wagtail.blocks.CharBlock( + help_text="Generic metadata.", required=False + ), + ), + ( + "body", + wagtail.blocks.RichTextBlock( + features=["bold"], + help_text="Body text of the card.", + required=False, + ), + ), + ( + "link_page", + wagtail.blocks.PageChooserBlock( + help_text="Page that this should link out to.", required=False + ), + ), + ( + "link_url", + wagtail.blocks.CharBlock( + help_text="Optional URL that the header should link out to.", + required=False, + ), + ), + ] + ), + max_num=4, + min_num=1, + ), + ), + ("link_url", wagtail.blocks.URLBlock(required=False)), + ("link_text", wagtail.blocks.CharBlock(max_length=50, required=False)), + ] + ), + ), + ], + use_json_field=True, + ), + ), + MigrateStreamData( + app_name="mozfest", + model_name="mozfestprimarypage", + field_name="body", + operations_and_block_paths=[ + ( + AlterStreamChildBlockDataOperation( + block="group_listing_block", operation=migrate_group_listing_block_cards + ), + "", + ), + ], + ), + migrations.AlterField( + model_name="mozfestprimarypage", + name="body", + field=wagtail.fields.StreamField( + [ + ( + "paragraph", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "h2", + "h3", + "h4", + "h5", + "ol", + "ul", + "hr", + "document-link", + "large", + ], + template="wagtailpages/blocks/rich_text_block.html", + ), + ), + ( + "card_grid", + wagtail.blocks.StructBlock( + [ + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Alt text for card's image.", required=False + ), + ), + ("title", wagtail.blocks.CharBlock(help_text="Heading for the card.")), + ("body", wagtail.blocks.TextBlock(help_text="Body text of the card.")), + ( + "link_url", + wagtail.blocks.CharBlock( + help_text="Optional URL that this card should link out to. (Note: If left blank, link will not render.) ", + required=False, + ), + ), + ( + "link_label", + wagtail.blocks.CharBlock( + help_text="Optional Label for the URL link above. (Note: If left blank, link will not render.) ", + required=False, + ), + ), + ] + ), + help_text="Please use a minimum of 2 cards.", + ), + ) + ] + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "altText", + wagtail.blocks.CharBlock( + help_text="Image description (for screen readers).", required=True + ), + ), + ("caption", wagtail.blocks.CharBlock(required=False)), + ( + "caption_url", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock(label="Page", required=False), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", required=False + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False + ), + ), + ] + ), + help_text="Optional URL that this caption should link out to.", + max_num=1, + min_num=0, + ), + ), + ( + "image_width", + wagtail.blocks.ChoiceBlock( + choices=[("normal", "Normal"), ("wide", "Wide"), ("full_width", "Full Width")], + help_text="Wide images are col-12, Full-Width Images reach both ends of the screen (16:6 images recommended for full width)", + ), + ), + ] + ), + ), + ( + "image_text", + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "altText", + wagtail.blocks.CharBlock( + help_text="Image description (for screen readers).", required=True + ), + ), + ( + "text", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "h2", + "h3", + "h4", + "h5", + "ol", + "ul", + "hr", + "document-link", + ] + ), + ), + ( + "url", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock(label="Page", required=False), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", required=False + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False + ), + ), + ] + ), + help_text="Optional URL that this image should link out to.", + max_num=1, + min_num=0, + ), + ), + ( + "top_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider above content block.", required=False + ), + ), + ( + "bottom_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider below content block.", required=False + ), + ), + ] + ), + ), + ( + "image_text_mini", + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "altText", + wagtail.blocks.CharBlock( + help_text="Image description (for screen readers).", required=True + ), + ), + ("text", wagtail.blocks.RichTextBlock(features=["bold", "italic", "link"])), + ] + ), + ), + ( + "image_grid", + wagtail.blocks.StructBlock( + [ + ( + "grid_items", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Alt text for this image.", required=False + ), + ), + ( + "caption", + wagtail.blocks.CharBlock( + help_text="Please remember to properly attribute any images we use.", + required=False, + ), + ), + ( + "url", + wagtail.blocks.CharBlock( + help_text="Optional URL that this figure should link out to.", + required=False, + ), + ), + ( + "square_image", + wagtail.blocks.BooleanBlock( + default=True, + help_text="If left checked, the image will be cropped to be square.", + required=False, + ), + ), + ] + ) + ), + ) + ] + ), + ), + ( + "video", + wagtail.blocks.StructBlock( + [ + ( + "url", + wagtail.blocks.URLBlock( + help_text="For YouTube: go to your YouTube video and click “Share,” then “Embed,” and then copy and paste the provided URL only. For example: https://www.youtube.com/embed/3FIVXBawyQw For Vimeo: follow similar steps to grab the embed URL. For example: https://player.vimeo.com/video/9004979", + label="Embed URL", + ), + ), + ("caption", wagtail.blocks.CharBlock(required=False)), + ( + "caption_url", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock(label="Page", required=False), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", required=False + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False + ), + ), + ] + ), + help_text="Optional URL that this caption should link out to.", + max_num=1, + min_num=0, + ), + ), + ( + "video_width", + wagtail.blocks.ChoiceBlock( + choices=[("normal", "Normal"), ("wide", "Wide"), ("full_width", "Full Width")], + help_text="Wide videos are col-12, Full-Width videos reach both ends of the screen.", + ), + ), + ] + ), + ), + ( + "iframe", + wagtail.blocks.StructBlock( + [ + ( + "url", + wagtail.blocks.CharBlock( + help_text="Please note that only URLs from allow-listed domains will work." + ), + ), + ( + "height", + wagtail.blocks.IntegerBlock( + help_text="Optional integer pixel value for custom iFrame height", + required=False, + ), + ), + ("caption", wagtail.blocks.CharBlock(required=False)), + ( + "caption_url", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock(label="Page", required=False), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", required=False + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False + ), + ), + ] + ), + help_text="Optional URL that this caption should link out to.", + max_num=1, + min_num=0, + ), + ), + ( + "iframe_width", + wagtail.blocks.ChoiceBlock( + choices=[("normal", "Normal"), ("wide", "Wide"), ("full_width", "Full Width")], + help_text="Wide iframes are col-12, Full-Width iframes reach both ends of the screen", + ), + ), + ( + "disable_scroll", + wagtail.blocks.BooleanBlock( + default=False, + help_text='Checking this will add "scrolling=no" to the iframe. Use this if your iframe is rendering an unnecessary scroll bar or whitespace below it.', + required=False, + ), + ), + ] + ), + ), + ( + "linkbutton", + wagtail.blocks.StructBlock( + [ + ("label", wagtail.blocks.CharBlock()), + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ("page", wagtail.blocks.PageChooserBlock(label="Page", required=False)), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[networkapi.wagtailpages.validators.RelativeURLValidator()], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[networkapi.wagtailpages.validators.AnchorLinkValidator()], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ("file", wagtail.documents.blocks.DocumentChooserBlock(label="File", required=False)), + ("phone", wagtail.blocks.CharBlock(label="Phone", max_length=30, required=False)), + ( + "new_window", + wagtail.blocks.BooleanBlock(label="Open in new window", required=False), + ), + ( + "styling", + wagtail.blocks.ChoiceBlock( + choices=[ + ("btn-primary", "Primary button"), + ("btn-secondary", "Secondary button"), + ] + ), + ), + ] + ), + ), + ( + "spacer", + wagtail.blocks.StructBlock( + [ + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("1", "quarter spacing"), + ("2", "half spacing"), + ("3", "single spacing"), + ("4", "one and a half spacing"), + ("5", "triple spacing"), + ] + ), + ) + ] + ), + ), + ( + "single_quote", + wagtail.blocks.StructBlock( + [ + ("quote", wagtail.blocks.RichTextBlock(features=["bold"])), + ("attribution", wagtail.blocks.CharBlock(required=False)), + ( + "attribution_info", + wagtail.blocks.RichTextBlock(features=["bold", "link", "large"], required=False), + ), + ] + ), + ), + ( + "profile_by_id", + wagtail.blocks.StructBlock( + [ + ( + "ids", + wagtail.blocks.CharBlock( + help_text="Show profiles for pulse users with specific profile ids (mozillapulse.org/profile/[##]). For multiple profiles, specify a comma separated list (e.g. 85,105,332).", + label="Profile by ID", + ), + ) + ] + ), + ), + ( + "profile_directory", + wagtail.blocks.StructBlock( + [ + ( + "max_number_of_results", + wagtail.blocks.IntegerBlock( + default=12, + help_text="Pick up to 48 profiles.", + max_value=48, + min_value=1, + required=True, + ), + ), + ( + "advanced_filter_header", + wagtail.blocks.static_block.StaticBlock( + admin_text="-------- ADVANCED FILTERS: OPTIONS TO DISPLAY FEWER, MORE TARGETED RESULTS. --------", + label=" ", + ), + ), + ( + "profile_type", + wagtail.blocks.CharBlock(default="", help_text="Example: Fellow.", required=False), + ), + ( + "program_type", + wagtail.blocks.CharBlock( + default="", help_text="Example: Tech Policy.", required=False + ), + ), + ("year", wagtail.blocks.CharBlock(default="", required=False)), + ( + "filter_values", + wagtail.blocks.CharBlock( + default="2019,2018,2017,2016,2015,2014,2013", + help_text="Example: 2019,2018,2017,2016,2015,2014,2013", + required=True, + ), + ), + ] + ), + ), + ( + "recent_blog_entries", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock(required=False)), + ( + "tag_filter", + wagtail.blocks.CharBlock( + help_text="Test this filter at foundation.mozilla.org/blog/tags/", + label="Filter by Tag", + required=False, + ), + ), + ( + "topic_filter", + wagtail.blocks.ChoiceBlock( + choices=networkapi.wagtailpages.pagemodels.blog.blog_topic.BlogPageTopic.get_topics, + help_text="Test this filter at foundation.mozilla.org/blog/topic/", + label="Filter by Topic", + required=False, + ), + ), + ( + "top_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider above content block.", required=False + ), + ), + ( + "bottom_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider below content block.", required=False + ), + ), + ] + ), + ), + ( + "blog_set", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock()), + ( + "top_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider above content block.", required=False + ), + ), + ( + "bottom_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider below content block.", required=False + ), + ), + ( + "blog_pages", + wagtail.blocks.ListBlock( + wagtail.blocks.PageChooserBlock(page_type=["wagtailpages.BlogPage"]) + ), + ), + ] + ), + ), + ( + "datawrapper", + wagtail.embeds.blocks.EmbedBlock( + help_text='Enter the "visualization only" link of the Datawrapper chart. It looks something like this: https://datawrapper.dwcdn.net/KwSKp/1/', + icon="image", + template="wagtailpages/blocks/datawrapper_block.html", + ), + ), + ( + "listing", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock(help_text="Heading for the block.", required=False), + ), + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Alt text for card's image.", required=False + ), + ), + ("title", wagtail.blocks.CharBlock(help_text="Heading for the card.")), + ( + "highlighted_metadata", + wagtail.blocks.CharBlock( + help_text="Metadata to highlight on the card.", required=False + ), + ), + ( + "metadata", + wagtail.blocks.CharBlock( + help_text="Generic metadata.", required=False + ), + ), + ( + "body", + wagtail.blocks.RichTextBlock( + features=["bold"], + help_text="Body text of the card.", + required=False, + ), + ), + ( + "link_page", + wagtail.blocks.PageChooserBlock( + help_text="Page that this should link out to.", required=False + ), + ), + ( + "link_url", + wagtail.blocks.CharBlock( + help_text="Optional URL that the header should link out to.", + required=False, + ), + ), + ] + ), + help_text="Please use a minimum of 2 cards.", + min_num=2, + ), + ), + ( + "cards_per_row", + wagtail.blocks.ChoiceBlock( + choices=[(2, "2"), (3, "3")], + help_text="Number of cards per row. Note: this is a max and fewer might be used if is less space is available.", + required=False, + ), + ), + ] + ), + ), + ( + "profiles", + wagtail.blocks.StructBlock( + [ + ( + "profiles", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "profile", + wagtail.snippets.blocks.SnippetChooserBlock( + networkapi.wagtailpages.pagemodels.profiles.Profile + ), + ) + ] + ), + min_num=1, + ), + ) + ] + ), + ), + ( + "group_listing_block", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + help_text="Heading for the group of cards.", required=False + ), + ), + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Alt text for card's image.", required=False + ), + ), + ( + "meta_data", + wagtail.blocks.CharBlock( + help_text="Optional meta data information for the card.", + required=False, + ), + ), + ("title", wagtail.blocks.CharBlock(help_text="Heading for the card.")), + ( + "body", + wagtail.blocks.RichTextBlock( + features=["bold", "link"], help_text="Body text of the card." + ), + ), + ( + "link", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock( + label="Page", required=False + ), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", required=False + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False + ), + ), + ] + ), + help_text="Optional link that this card should link to.", + max_num=1, + min_num=0, + ), + ), + ] + ) + ), + ), + ] + ), + ), + ( + "image_feature", + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "alt_text", + wagtail.blocks.CharBlock(help_text="Image description (for screen readers)."), + ), + ("metadata", wagtail.blocks.CharBlock(required=False)), + ("title", wagtail.blocks.CharBlock(help_text="Heading for the card.")), + ( + "title_link", + wagtail.blocks.PageChooserBlock( + help_text="Page that the title should link out to.", required=False + ), + ), + ("body", wagtail.blocks.CharBlock(required=False)), + ] + ), + ), + ( + "image_teaser_block", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock(help_text="Heading for the card.")), + ("text", wagtail.blocks.RichTextBlock(features=["bold"])), + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "altText", + wagtail.blocks.CharBlock( + help_text="Image description (for screen readers).", required=True + ), + ), + ( + "link_button", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("label", wagtail.blocks.CharBlock()), + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock(label="Page", required=False), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", required=False + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False + ), + ), + ( + "styling", + wagtail.blocks.ChoiceBlock( + choices=[ + ("btn-primary", "Primary button"), + ("btn-secondary", "Secondary button"), + ] + ), + ), + ] + ), + help_text="Optional link button", + max_num=1, + min_num=0, + ), + ), + ( + "top_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider above content block.", required=False + ), + ), + ( + "bottom_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider below content block.", required=False + ), + ), + ] + ), + ), + ( + "text_only_teaser", + wagtail.blocks.StructBlock( + [ + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock(help_text="Heading for the card."), + ), + ( + "link_page", + wagtail.blocks.PageChooserBlock( + help_text="Page that the header should link out to.", + required=False, + ), + ), + ( + "link_url", + wagtail.blocks.CharBlock( + help_text="Optional URL that the header should link out to.", + required=False, + ), + ), + ("meta_data", wagtail.blocks.CharBlock(max_length=500)), + ( + "body", + wagtail.blocks.TextBlock( + help_text="Body text of the card.", + max_length=200, + required=False, + ), + ), + ] + ), + help_text="Please use a minimum of 3 cards.", + min_num=3, + ), + ) + ] + ), + ), + ( + "block_with_aside", + wagtail.blocks.StructBlock( + [ + ( + "content", + wagtail.blocks.StreamBlock( + [ + ( + "listing", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + help_text="Heading for the block.", required=False + ), + ), + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "image", + wagtail.images.blocks.ImageChooserBlock(), + ), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Alt text for card's image.", + required=False, + ), + ), + ( + "title", + wagtail.blocks.CharBlock( + help_text="Heading for the card." + ), + ), + ( + "highlighted_metadata", + wagtail.blocks.CharBlock( + help_text="Metadata to highlight on the card.", + required=False, + ), + ), + ( + "metadata", + wagtail.blocks.CharBlock( + help_text="Generic metadata.", + required=False, + ), + ), + ( + "body", + wagtail.blocks.RichTextBlock( + features=["bold"], + help_text="Body text of the card.", + required=False, + ), + ), + ( + "link_page", + wagtail.blocks.PageChooserBlock( + help_text="Page that this should link out to.", + required=False, + ), + ), + ( + "link_url", + wagtail.blocks.CharBlock( + help_text="Optional URL that the header should link out to.", + required=False, + ), + ), + ] + ), + help_text="Please use a minimum of 2 cards.", + min_num=2, + ), + ), + ( + "cards_per_row", + wagtail.blocks.ChoiceBlock( + choices=[(2, "2"), (3, "3")], + help_text="Number of cards per row. Note: this is a max and fewer might be used if is less space is available.", + required=False, + ), + ), + ] + ), + ), + ( + "paragraph", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "h2", + "h3", + "h4", + "h5", + "ol", + "ul", + "hr", + "document-link", + ] + ), + ), + ], + help_text="The wider block that appears on the left on desktop", + icon="doc-full", + max_num=1, + ), + ), + ( + "aside", + wagtail.blocks.StreamBlock( + [ + ( + "aside_content", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + help_text="Heading for the card.", required=False + ), + ), + ( + "body", + wagtail.blocks.TextBlock( + help_text="Body text of the card.", required=False + ), + ), + ] + ), + ), + ( + "linkbutton", + wagtail.blocks.StructBlock( + [ + ("label", wagtail.blocks.CharBlock()), + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock( + label="Page", required=False + ), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", required=False + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False + ), + ), + ( + "styling", + wagtail.blocks.ChoiceBlock( + choices=[ + ("btn-primary", "Primary button"), + ("btn-secondary", "Secondary button"), + ] + ), + ), + ] + ), + ), + ( + "spacer", + wagtail.blocks.StructBlock( + [ + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("1", "quarter spacing"), + ("2", "half spacing"), + ("3", "single spacing"), + ("4", "one and a half spacing"), + ("5", "triple spacing"), + ] + ), + ) + ] + ), + ), + ], + help_text="Elements here will appear in the column on the right side of the page on desktop. This can be left blank if you would just like a 2/3 column on the left", + icon="doc-full", + required=False, + ), + ), + ] + ), + ), + ( + "accordion", + wagtail.blocks.StructBlock( + [ + ( + "accordion_items", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + help_text="Heading for the Accordion Item" + ), + ), + ( + "content", + wagtail.blocks.StreamBlock( + [ + ( + "rich_text", + wagtail.blocks.RichTextBlock( + blank=True, + features=[ + "bold", + "italic", + "link", + "ul", + "ol", + "document-link", + ], + ), + ), + ( + "datawrapper", + wagtail.embeds.blocks.EmbedBlock( + help_text='Enter the "visualization only" link of the Datawrapper chart. It looks something like this: https://datawrapper.dwcdn.net/KwSKp/1/', + icon="image", + template="wagtailpages/blocks/datawrapper_block.html", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "image", + wagtail.images.blocks.ImageChooserBlock(), + ), + ( + "altText", + wagtail.blocks.CharBlock( + help_text="Image description (for screen readers).", + required=True, + ), + ), + ] + ), + ), + ( + "video", + wagtail.blocks.StructBlock( + [ + ( + "url", + wagtail.blocks.URLBlock( + help_text="For YouTube: go to your YouTube video and click “Share,” then “Embed,” and then copy and paste the provided URL only. For example: https://www.youtube.com/embed/3FIVXBawyQw For Vimeo: follow similar steps to grab the embed URL. For example: https://player.vimeo.com/video/9004979", + label="Embed URL", + ), + ), + ( + "caption", + wagtail.blocks.CharBlock(required=False), + ), + ( + "caption_url", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ( + "external_url", + "External URL", + ), + ( + "relative_url", + "Relative URL", + ), + ("email", "Email"), + ( + "anchor", + "Anchor", + ), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock( + label="Page", + required=False, + ), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ( + "email", + wagtail.blocks.EmailBlock( + required=False + ), + ), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", + required=False, + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", + max_length=30, + required=False, + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", + required=False, + ), + ), + ] + ), + help_text="Optional URL that this caption should link out to.", + max_num=1, + min_num=0, + ), + ), + ( + "video_width", + wagtail.blocks.ChoiceBlock( + choices=[ + ("normal", "Normal"), + ("wide", "Wide"), + ("full_width", "Full Width"), + ], + help_text="Wide videos are col-12, Full-Width videos reach both ends of the screen.", + ), + ), + ] + ), + ), + ] + ), + ), + ] + ) + ), + ) + ] + ), + ), + ( + "session_slider", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock(help_text="Heading for the slider.")), + ( + "session_items", + wagtail.blocks.StreamBlock( + [ + ( + "session_item", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + help_text="Heading for the card." + ), + ), + ( + "author_subheading", + wagtail.blocks.CharBlock( + help_text="Author of this session.", required=False + ), + ), + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + help_text="The image associated with this session." + ), + ), + ( + "body", + wagtail.blocks.RichTextBlock( + help_text="Body text of this card." + ), + ), + ( + "video", + wagtailmedia.blocks.VideoChooserBlock( + help_text="Video that will autoplay when this card is hovered on", + required=False, + ), + ), + ( + "link", + wagtail.blocks.StreamBlock( + [ + ( + "internal", + wagtail.blocks.StructBlock( + [ + ( + "link", + wagtail.blocks.PageChooserBlock( + help_text="Page that this should link out to." + ), + ) + ] + ), + ), + ( + "external", + wagtail.blocks.StructBlock( + [ + ( + "link", + wagtail.blocks.URLBlock( + help_text="URL that this should link out to." + ), + ) + ] + ), + ), + ], + help_text="Page or external URL this card will link out to.", + max_num=1, + ), + ), + ] + ), + ) + ], + help_text="A list of sessions in the slider.", + ), + ), + ( + "button", + wagtail.blocks.StreamBlock( + [ + ( + "internal", + wagtail.blocks.StructBlock( + [ + ( + "label", + wagtail.blocks.CharBlock(help_text="Label for this link."), + ), + ( + "link", + wagtail.blocks.PageChooserBlock( + help_text="Page that this should link out to." + ), + ), + ] + ), + ), + ( + "external", + wagtail.blocks.StructBlock( + [ + ( + "label", + wagtail.blocks.CharBlock(help_text="Label for this link."), + ), + ( + "link", + wagtail.blocks.URLBlock( + help_text="URL that this should link out to." + ), + ), + ] + ), + ), + ], + help_text="Button that appears below the slider.", + max_num=1, + required=False, + ), + ), + ] + ), + ), + ( + "current_events_slider", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock(help_text="Heading for the slider.")), + ( + "current_events", + wagtail.blocks.StreamBlock( + [ + ( + "current_event", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock(help_text="Heading of the card."), + ), + ( + "subheading_link", + wagtail.blocks.StreamBlock( + [ + ( + "internal", + wagtail.blocks.StructBlock( + [ + ( + "label", + wagtail.blocks.CharBlock( + help_text="Label for this link." + ), + ), + ( + "link", + wagtail.blocks.PageChooserBlock( + help_text="Page that this should link out to." + ), + ), + ] + ), + ), + ( + "external", + wagtail.blocks.StructBlock( + [ + ( + "label", + wagtail.blocks.CharBlock( + help_text="Label for this link." + ), + ), + ( + "link", + wagtail.blocks.URLBlock( + help_text="URL that this should link out to." + ), + ), + ] + ), + ), + ], + help_text="The link that appears below the card heading.", + max_num=1, + required=False, + ), + ), + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + help_text="The image associated with this event." + ), + ), + ( + "body", + wagtail.blocks.TextBlock( + help_text="Body text of the card." + ), + ), + ( + "buttons", + wagtail.blocks.StreamBlock( + [ + ( + "internal", + wagtail.blocks.StructBlock( + [ + ( + "label", + wagtail.blocks.CharBlock( + help_text="Label for this link." + ), + ), + ( + "link", + wagtail.blocks.PageChooserBlock( + help_text="Page that this should link out to." + ), + ), + ] + ), + ), + ( + "external", + wagtail.blocks.StructBlock( + [ + ( + "label", + wagtail.blocks.CharBlock( + help_text="Label for this link." + ), + ), + ( + "link", + wagtail.blocks.URLBlock( + help_text="URL that this should link out to." + ), + ), + ] + ), + ), + ( + "document", + wagtail.blocks.StructBlock( + [ + ( + "label", + wagtail.blocks.CharBlock( + help_text="Label for this link." + ), + ), + ( + "document", + wagtail.documents.blocks.DocumentChooserBlock( + help_text="Document that this should link out to." + ), + ), + ], + help_text='An iCal document can be attached here for an "Add to Calendar" button.', + ), + ), + ], + help_text="A list of buttons that will appear at the bottom of the card.", + max_num=2, + ), + ), + ] + ), + ) + ], + help_text="A list of current events in the slider.", + ), + ), + ] + ), + ), + ( + "spaces", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock()), + ( + "cards", + wagtail.blocks.StreamBlock( + [ + ( + "space_card", + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "title", + wagtail.blocks.CharBlock( + help_text="Heading for the card." + ), + ), + ( + "body", + wagtail.blocks.TextBlock( + help_text="Body text of the card." + ), + ), + ( + "link", + wagtail.blocks.StreamBlock( + [ + ( + "internal", + wagtail.blocks.StructBlock( + [ + ( + "link", + wagtail.blocks.PageChooserBlock( + help_text="Page that this should link out to." + ), + ) + ] + ), + ), + ( + "external", + wagtail.blocks.StructBlock( + [ + ( + "link", + wagtail.blocks.URLBlock( + help_text="URL that this should link out to." + ), + ) + ] + ), + ), + ], + help_text="Page or external URL this card will link out to.", + max_num=1, + ), + ), + ] + ), + ) + ], + help_text="A list of Spaces Cards.", + ), + ), + ] + ), + ), + ( + "tito_widget", + wagtail.blocks.StructBlock( + [ + ( + "button_label", + wagtail.blocks.CharBlock(help_text="The text to show on the Tito button."), + ), + ( + "styling", + wagtail.blocks.ChoiceBlock( + choices=[ + ("btn-primary", "Primary button"), + ("btn-secondary", "Secondary button"), + ] + ), + ), + ( + "event", + wagtail.snippets.blocks.SnippetChooserBlock( + "events.TitoEvent", help_event="The Tito event to be displayed" + ), + ), + ( + "releases", + wagtail.blocks.CharBlock( + help_text='Comma-separated list of ticket/release IDs to limit to, e.g. "3elajg6qcxu,6qiiw4socs4"', + required=False, + ), + ), + ] + ), + ), + ( + "statistics", + wagtail.blocks.StructBlock( + [ + ( + "statistics", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + help_text="The statistic figure, e.g '1000+' or '10%'" + ), + ), + ( + "description", + wagtail.blocks.CharBlock( + help_text="Context or description for the statistic" + ), + ), + ] + ), + help_text="Please use a minimum of 2 cards.", + max_num=4, + min_num=2, + ), + ) + ] + ), + ), + ( + "carousel_and_text", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock(help_text="Heading for the block.", required=False), + ), + ("text", wagtail.blocks.RichTextBlock(features=["bold", "italic", "link"])), + ( + "link_url", + wagtail.blocks.URLBlock( + help_text="A CTA URL for a link displayed", required=False + ), + ), + ( + "link_label", + wagtail.blocks.CharBlock(help_text="Label for the CTA link.", required=False), + ), + ( + "carousel_images", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "altText", + wagtail.blocks.CharBlock( + help_text="Image description (for screen readers).", + required=True, + ), + ), + ] + ), + max_num=4, + ), + ), + ] + ), + ), + ( + "tickets", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock(help_text="Heading for the block.", required=False), + ), + ( + "tickets", + wagtail.blocks.ListBlock( + wagtail.snippets.blocks.SnippetChooserBlock("mozfest.Ticket"), max_num=3 + ), + ), + ] + ), + ), + ( + "dark_quote", + wagtail.blocks.StructBlock( + [ + ("quote", wagtail.blocks.RichTextBlock(features=["bold"])), + ("attribution", wagtail.blocks.CharBlock(required=False)), + ( + "attribution_info", + wagtail.blocks.RichTextBlock(features=["bold", "link", "large"], required=False), + ), + ] + ), + ), + ( + "cta", + wagtail.blocks.StructBlock( + [ + ("label", wagtail.blocks.CharBlock()), + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ("page", wagtail.blocks.PageChooserBlock(label="Page", required=False)), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[networkapi.wagtailpages.validators.RelativeURLValidator()], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[networkapi.wagtailpages.validators.AnchorLinkValidator()], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ("file", wagtail.documents.blocks.DocumentChooserBlock(label="File", required=False)), + ("phone", wagtail.blocks.CharBlock(label="Phone", max_length=30, required=False)), + ( + "new_window", + wagtail.blocks.BooleanBlock(label="Open in new window", required=False), + ), + ("heading", wagtail.blocks.CharBlock(required=False)), + ("text", wagtail.blocks.CharBlock(required=False)), + ("dark_background", wagtail.blocks.BooleanBlock(required=False)), + ] + ), + ), + ( + "newsletter_signup", + wagtail.blocks.StructBlock( + [ + ( + "snippet", + wagtail.snippets.blocks.SnippetChooserBlock( + "mozfest.NewsletterSignupWithBackground" + ), + ) + ] + ), + ), + ( + "mixed_content", + wagtail.blocks.StructBlock( + [ + ( + "video", + wagtail.blocks.StructBlock( + [ + ( + "url", + wagtail.blocks.URLBlock( + help_text="For YouTube: go to your YouTube video and click “Share,” then “Embed,” and then copy and paste the provided URL only. For example: https://www.youtube.com/embed/3FIVXBawyQw For Vimeo: follow similar steps to grab the embed URL. For example: https://player.vimeo.com/video/9004979", + label="Embed URL", + ), + ), + ( + "caption", + wagtail.blocks.CharBlock( + help_text="Optional caption for the video, displayed next to the play button.", + max_length=25, + required=False, + ), + ), + ( + "title", + wagtail.blocks.CharBlock( + help_text="Optional title for the video.", + max_length=50, + required=False, + ), + ), + ( + "text", + wagtail.blocks.CharBlock( + help_text="Text content to display with the video title.", + required=False, + ), + ), + ( + "thumbnail", + wagtail.images.blocks.ImageChooserBlock( + help_text="The image to show before the video is played." + ), + ), + ] + ), + ), + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Alt text for card's image.", required=False + ), + ), + ("title", wagtail.blocks.CharBlock(help_text="Heading for the card.")), + ( + "highlighted_metadata", + wagtail.blocks.CharBlock( + help_text="Metadata to highlight on the card.", required=False + ), + ), + ( + "metadata", + wagtail.blocks.CharBlock( + help_text="Generic metadata.", required=False + ), + ), + ( + "body", + wagtail.blocks.RichTextBlock( + features=["bold"], + help_text="Body text of the card.", + required=False, + ), + ), + ( + "link_page", + wagtail.blocks.PageChooserBlock( + help_text="Page that this should link out to.", required=False + ), + ), + ( + "link_url", + wagtail.blocks.CharBlock( + help_text="Optional URL that the header should link out to.", + required=False, + ), + ), + ] + ), + max_num=4, + min_num=1, + ), + ), + ("link_url", wagtail.blocks.URLBlock(required=False)), + ("link_text", wagtail.blocks.CharBlock(max_length=50, required=False)), + ] + ), + ), + ], + use_json_field=True, + ), + ), + ] diff --git a/network-api/networkapi/wagtailpages/migrations/0147_update_grouplistingblock_with_linkblock.py b/network-api/networkapi/wagtailpages/migrations/0147_update_grouplistingblock_with_linkblock.py new file mode 100644 index 00000000000..2fdabebe25f --- /dev/null +++ b/network-api/networkapi/wagtailpages/migrations/0147_update_grouplistingblock_with_linkblock.py @@ -0,0 +1,7638 @@ +# Generated by Django 4.2.14 on 2024-07-17 01:24 + +import wagtail.blocks +import wagtail.blocks.static_block +import wagtail.documents.blocks +import wagtail.embeds.blocks +import wagtail.fields +import wagtail.images.blocks +import wagtail.snippets.blocks +from django.db import migrations +from wagtail.blocks.migrations.migrate_operation import MigrateStreamData + +import networkapi.wagtailpages.pagemodels.blog.blog_topic +import networkapi.wagtailpages.pagemodels.profiles +import networkapi.wagtailpages.validators +from networkapi.utility.migration.operations import AlterStreamChildBlockDataOperation + + +def migrate_group_listing_block_cards(source_block): + + if "cards" in source_block["value"]: + for card in source_block["value"]["cards"]: + + old_url = card["value"].get("url") + if old_url: + card["value"]["link"] = [ + { + "link_to": "external_url", + "external_url": old_url, + "new_window": True, + } + ] + + return source_block + + +class Migration(migrations.Migration): + + dependencies = [ + ("wagtailpages", "0146_update_imageteaserblock_with_linkblock"), + ] + + operations = [ + migrations.AlterField( + model_name="modularpage", + name="body", + field=wagtail.fields.StreamField( + [ + ( + "paragraph", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "h2", + "h3", + "h4", + "h5", + "ol", + "ul", + "hr", + "document-link", + "large", + ], + template="wagtailpages/blocks/rich_text_block.html", + ), + ), + ( + "card_grid", + wagtail.blocks.StructBlock( + [ + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Alt text for card's image.", required=False + ), + ), + ("title", wagtail.blocks.CharBlock(help_text="Heading for the card.")), + ("body", wagtail.blocks.TextBlock(help_text="Body text of the card.")), + ( + "link_url", + wagtail.blocks.CharBlock( + help_text="Optional URL that this card should link out to. (Note: If left blank, link will not render.) ", + required=False, + ), + ), + ( + "link_label", + wagtail.blocks.CharBlock( + help_text="Optional Label for the URL link above. (Note: If left blank, link will not render.) ", + required=False, + ), + ), + ] + ), + help_text="Please use a minimum of 2 cards.", + ), + ) + ] + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "altText", + wagtail.blocks.CharBlock( + help_text="Image description (for screen readers).", required=True + ), + ), + ("caption", wagtail.blocks.CharBlock(required=False)), + ( + "caption_url", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock(label="Page", required=False), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", required=False + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False + ), + ), + ] + ), + help_text="Optional URL that this caption should link out to.", + max_num=1, + min_num=0, + ), + ), + ( + "image_width", + wagtail.blocks.ChoiceBlock( + choices=[("normal", "Normal"), ("wide", "Wide"), ("full_width", "Full Width")], + help_text="Wide images are col-12, Full-Width Images reach both ends of the screen (16:6 images recommended for full width)", + ), + ), + ] + ), + ), + ( + "image_text", + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "altText", + wagtail.blocks.CharBlock( + help_text="Image description (for screen readers).", required=True + ), + ), + ( + "text", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "h2", + "h3", + "h4", + "h5", + "ol", + "ul", + "hr", + "document-link", + ] + ), + ), + ( + "url", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock(label="Page", required=False), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", required=False + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False + ), + ), + ] + ), + help_text="Optional URL that this image should link out to.", + max_num=1, + min_num=0, + ), + ), + ( + "top_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider above content block.", required=False + ), + ), + ( + "bottom_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider below content block.", required=False + ), + ), + ] + ), + ), + ( + "image_text_mini", + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "altText", + wagtail.blocks.CharBlock( + help_text="Image description (for screen readers).", required=True + ), + ), + ("text", wagtail.blocks.RichTextBlock(features=["bold", "italic", "link"])), + ] + ), + ), + ( + "image_grid", + wagtail.blocks.StructBlock( + [ + ( + "grid_items", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Alt text for this image.", required=False + ), + ), + ( + "caption", + wagtail.blocks.CharBlock( + help_text="Please remember to properly attribute any images we use.", + required=False, + ), + ), + ( + "url", + wagtail.blocks.CharBlock( + help_text="Optional URL that this figure should link out to.", + required=False, + ), + ), + ( + "square_image", + wagtail.blocks.BooleanBlock( + default=True, + help_text="If left checked, the image will be cropped to be square.", + required=False, + ), + ), + ] + ) + ), + ) + ] + ), + ), + ( + "video", + wagtail.blocks.StructBlock( + [ + ( + "url", + wagtail.blocks.URLBlock( + help_text="For YouTube: go to your YouTube video and click “Share,” then “Embed,” and then copy and paste the provided URL only. For example: https://www.youtube.com/embed/3FIVXBawyQw For Vimeo: follow similar steps to grab the embed URL. For example: https://player.vimeo.com/video/9004979", + label="Embed URL", + ), + ), + ("caption", wagtail.blocks.CharBlock(required=False)), + ( + "caption_url", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock(label="Page", required=False), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", required=False + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False + ), + ), + ] + ), + help_text="Optional URL that this caption should link out to.", + max_num=1, + min_num=0, + ), + ), + ( + "video_width", + wagtail.blocks.ChoiceBlock( + choices=[("normal", "Normal"), ("wide", "Wide"), ("full_width", "Full Width")], + help_text="Wide videos are col-12, Full-Width videos reach both ends of the screen.", + ), + ), + ] + ), + ), + ( + "iframe", + wagtail.blocks.StructBlock( + [ + ( + "url", + wagtail.blocks.CharBlock( + help_text="Please note that only URLs from allow-listed domains will work." + ), + ), + ( + "height", + wagtail.blocks.IntegerBlock( + help_text="Optional integer pixel value for custom iFrame height", + required=False, + ), + ), + ("caption", wagtail.blocks.CharBlock(required=False)), + ( + "caption_url", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock(label="Page", required=False), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", required=False + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False + ), + ), + ] + ), + help_text="Optional URL that this caption should link out to.", + max_num=1, + min_num=0, + ), + ), + ( + "iframe_width", + wagtail.blocks.ChoiceBlock( + choices=[("normal", "Normal"), ("wide", "Wide"), ("full_width", "Full Width")], + help_text="Wide iframes are col-12, Full-Width iframes reach both ends of the screen", + ), + ), + ( + "disable_scroll", + wagtail.blocks.BooleanBlock( + default=False, + help_text='Checking this will add "scrolling=no" to the iframe. Use this if your iframe is rendering an unnecessary scroll bar or whitespace below it.', + required=False, + ), + ), + ] + ), + ), + ( + "linkbutton", + wagtail.blocks.StructBlock( + [ + ("label", wagtail.blocks.CharBlock()), + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ("page", wagtail.blocks.PageChooserBlock(label="Page", required=False)), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[networkapi.wagtailpages.validators.RelativeURLValidator()], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[networkapi.wagtailpages.validators.AnchorLinkValidator()], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ("file", wagtail.documents.blocks.DocumentChooserBlock(label="File", required=False)), + ("phone", wagtail.blocks.CharBlock(label="Phone", max_length=30, required=False)), + ( + "new_window", + wagtail.blocks.BooleanBlock(label="Open in new window", required=False), + ), + ( + "styling", + wagtail.blocks.ChoiceBlock( + choices=[ + ("btn-primary", "Primary button"), + ("btn-secondary", "Secondary button"), + ] + ), + ), + ] + ), + ), + ( + "spacer", + wagtail.blocks.StructBlock( + [ + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("1", "quarter spacing"), + ("2", "half spacing"), + ("3", "single spacing"), + ("4", "one and a half spacing"), + ("5", "triple spacing"), + ] + ), + ) + ] + ), + ), + ( + "single_quote", + wagtail.blocks.StructBlock( + [ + ("quote", wagtail.blocks.RichTextBlock(features=["bold"])), + ("attribution", wagtail.blocks.CharBlock(required=False)), + ( + "attribution_info", + wagtail.blocks.RichTextBlock(features=["bold", "link", "large"], required=False), + ), + ] + ), + ), + ( + "pulse_listing", + wagtail.blocks.StructBlock( + [ + ( + "search_terms", + wagtail.blocks.CharBlock( + help_text="Test your search at mozillapulse.org/search", + label="Search", + required=False, + ), + ), + ( + "max_number_of_results", + wagtail.blocks.IntegerBlock( + default=6, + help_text="Choose 1-12. If you want visitors to see more, link to a search or tag on Pulse.", + max_value=12, + min_value=0, + required=True, + ), + ), + ( + "only_featured_entries", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Featured items are selected by Pulse moderators.", + label="Display only featured entries", + required=False, + ), + ), + ( + "newest_first", + wagtail.blocks.ChoiceBlock( + choices=[ + ("True", "Show newer entries first"), + ("False", "Show older entries first"), + ], + label="Sort", + ), + ), + ( + "advanced_filter_header", + wagtail.blocks.static_block.StaticBlock( + admin_text="-------- ADVANCED FILTERS: OPTIONS TO DISPLAY FEWER, MORE TARGETED RESULTS. --------", + label=" ", + ), + ), + ( + "issues", + wagtail.blocks.ChoiceBlock( + choices=[ + ("all", "All"), + ("Decentralization", "Decentralization"), + ("Digital Inclusion", "Digital Inclusion"), + ("Online Privacy & Security", "Online Privacy & Security"), + ("Open Innovation", "Open Innovation"), + ("Web Literacy", "Web Literacy"), + ] + ), + ), + ( + "help", + wagtail.blocks.ChoiceBlock( + choices=[ + ("all", "All"), + ("Attend", "Attend"), + ("Create content", "Create content"), + ("Code", "Code"), + ("Design", "Design"), + ("Fundraise", "Fundraise"), + ("Join community", "Join community"), + ("Localize & translate", "Localize & translate"), + ("Mentor", "Mentor"), + ("Plan & organize", "Plan & organize"), + ("Promote", "Promote"), + ("Take action", "Take action"), + ("Test & feedback", "Test & feedback"), + ("Write documentation", "Write documentation"), + ], + label="Type of help needed", + ), + ), + ( + "direct_link", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Checked: user goes to project link. Unchecked: user goes to pulse entry", + label="Direct link", + required=False, + ), + ), + ] + ), + ), + ( + "profile_listing", + wagtail.blocks.StructBlock( + [ + ( + "max_number_of_results", + wagtail.blocks.IntegerBlock( + default=12, + help_text="Pick up to 48 profiles.", + max_value=48, + min_value=1, + required=True, + ), + ), + ( + "advanced_filter_header", + wagtail.blocks.static_block.StaticBlock( + admin_text="-------- ADVANCED FILTERS: OPTIONS TO DISPLAY FEWER, MORE TARGETED RESULTS. --------", + label=" ", + ), + ), + ( + "profile_type", + wagtail.blocks.CharBlock(default="", help_text="Example: Fellow.", required=False), + ), + ( + "program_type", + wagtail.blocks.CharBlock( + default="", help_text="Example: Tech Policy.", required=False + ), + ), + ("year", wagtail.blocks.CharBlock(default="", required=False)), + ] + ), + ), + ( + "profile_by_id", + wagtail.blocks.StructBlock( + [ + ( + "ids", + wagtail.blocks.CharBlock( + help_text="Show profiles for pulse users with specific profile ids (mozillapulse.org/profile/[##]). For multiple profiles, specify a comma separated list (e.g. 85,105,332).", + label="Profile by ID", + ), + ) + ] + ), + ), + ( + "profile_directory", + wagtail.blocks.StructBlock( + [ + ( + "max_number_of_results", + wagtail.blocks.IntegerBlock( + default=12, + help_text="Pick up to 48 profiles.", + max_value=48, + min_value=1, + required=True, + ), + ), + ( + "advanced_filter_header", + wagtail.blocks.static_block.StaticBlock( + admin_text="-------- ADVANCED FILTERS: OPTIONS TO DISPLAY FEWER, MORE TARGETED RESULTS. --------", + label=" ", + ), + ), + ( + "profile_type", + wagtail.blocks.CharBlock(default="", help_text="Example: Fellow.", required=False), + ), + ( + "program_type", + wagtail.blocks.CharBlock( + default="", help_text="Example: Tech Policy.", required=False + ), + ), + ("year", wagtail.blocks.CharBlock(default="", required=False)), + ( + "filter_values", + wagtail.blocks.CharBlock( + default="2019,2018,2017,2016,2015,2014,2013", + help_text="Example: 2019,2018,2017,2016,2015,2014,2013", + required=True, + ), + ), + ] + ), + ), + ( + "recent_blog_entries", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock(required=False)), + ( + "tag_filter", + wagtail.blocks.CharBlock( + help_text="Test this filter at foundation.mozilla.org/blog/tags/", + label="Filter by Tag", + required=False, + ), + ), + ( + "topic_filter", + wagtail.blocks.ChoiceBlock( + choices=networkapi.wagtailpages.pagemodels.blog.blog_topic.BlogPageTopic.get_topics, + help_text="Test this filter at foundation.mozilla.org/blog/topic/", + label="Filter by Topic", + required=False, + ), + ), + ( + "top_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider above content block.", required=False + ), + ), + ( + "bottom_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider below content block.", required=False + ), + ), + ] + ), + ), + ( + "blog_set", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock()), + ( + "top_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider above content block.", required=False + ), + ), + ( + "bottom_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider below content block.", required=False + ), + ), + ( + "blog_pages", + wagtail.blocks.ListBlock( + wagtail.blocks.PageChooserBlock(page_type=["wagtailpages.BlogPage"]) + ), + ), + ] + ), + ), + ( + "airtable", + wagtail.blocks.StructBlock( + [ + ( + "url", + wagtail.blocks.URLBlock( + help_text="Copied from the Airtable embed code. The word 'embed' will be in the url" + ), + ), + ( + "height", + wagtail.blocks.IntegerBlock( + default=533, + help_text="The pixel height on desktop view, usually copied from the Airtable embed code", + ), + ), + ] + ), + ), + ( + "typeform", + wagtail.blocks.StructBlock( + [ + ( + "embed_id", + wagtail.blocks.CharBlock( + help_text="The embed id of your Typeform page (e.g. if the form is on admin.typeform.com/form/e8zScc6t, the id will be: e8zScc6t)", + required=True, + ), + ), + ( + "button_type", + wagtail.blocks.ChoiceBlock( + choices=[ + ("btn-primary", "Primary button"), + ("btn-secondary", "Secondary button"), + ] + ), + ), + ( + "button_text", + wagtail.blocks.CharBlock( + help_text="This is a text prompt for users to open the typeform content", + required=True, + ), + ), + ] + ), + ), + ( + "datawrapper", + wagtail.embeds.blocks.EmbedBlock( + help_text='Enter the "visualization only" link of the Datawrapper chart. It looks something like this: https://datawrapper.dwcdn.net/KwSKp/1/', + icon="image", + template="wagtailpages/blocks/datawrapper_block.html", + ), + ), + ( + "listing", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock(help_text="Heading for the block.", required=False), + ), + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Alt text for card's image.", required=False + ), + ), + ("title", wagtail.blocks.CharBlock(help_text="Heading for the card.")), + ( + "highlighted_metadata", + wagtail.blocks.CharBlock( + help_text="Metadata to highlight on the card.", required=False + ), + ), + ( + "metadata", + wagtail.blocks.CharBlock( + help_text="Generic metadata.", required=False + ), + ), + ( + "body", + wagtail.blocks.RichTextBlock( + features=["bold"], + help_text="Body text of the card.", + required=False, + ), + ), + ( + "link_page", + wagtail.blocks.PageChooserBlock( + help_text="Page that this should link out to.", required=False + ), + ), + ( + "link_url", + wagtail.blocks.CharBlock( + help_text="Optional URL that the header should link out to.", + required=False, + ), + ), + ] + ), + help_text="Please use a minimum of 2 cards.", + min_num=2, + ), + ), + ( + "cards_per_row", + wagtail.blocks.ChoiceBlock( + choices=[(2, "2"), (3, "3")], + help_text="Number of cards per row. Note: this is a max and fewer might be used if is less space is available.", + required=False, + ), + ), + ] + ), + ), + ( + "profiles", + wagtail.blocks.StructBlock( + [ + ( + "profiles", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "profile", + wagtail.snippets.blocks.SnippetChooserBlock( + networkapi.wagtailpages.pagemodels.profiles.Profile + ), + ) + ] + ), + min_num=1, + ), + ) + ] + ), + ), + ( + "article_teaser_block", + wagtail.blocks.StructBlock( + [ + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "article", + wagtail.blocks.PageChooserBlock( + help_text="Page that this should link out to.", + page_type=["wagtailpages.ArticlePage"], + required=False, + ), + ) + ] + ), + help_text="Please use a minimum of 3 cards.", + min_num=3, + ), + ) + ] + ), + ), + ( + "group_listing_block", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + help_text="Heading for the group of cards.", required=False + ), + ), + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Alt text for card's image.", required=False + ), + ), + ( + "meta_data", + wagtail.blocks.CharBlock( + help_text="Optional meta data information for the card.", + required=False, + ), + ), + ("title", wagtail.blocks.CharBlock(help_text="Heading for the card.")), + ( + "body", + wagtail.blocks.RichTextBlock( + features=["bold", "link"], help_text="Body text of the card." + ), + ), + ( + "url", + wagtail.blocks.CharBlock( + help_text="The URL this card should link to.", required=False + ), + ), + ( + "link", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock( + label="Page", required=False + ), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", required=False + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False + ), + ), + ] + ), + help_text="Optional link that this card should link to.", + max_num=1, + min_num=0, + ), + ), + ] + ) + ), + ), + ] + ), + ), + ( + "image_feature", + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "alt_text", + wagtail.blocks.CharBlock(help_text="Image description (for screen readers)."), + ), + ("metadata", wagtail.blocks.CharBlock(required=False)), + ("title", wagtail.blocks.CharBlock(help_text="Heading for the card.")), + ( + "title_link", + wagtail.blocks.PageChooserBlock( + help_text="Page that the title should link out to.", required=False + ), + ), + ("body", wagtail.blocks.CharBlock(required=False)), + ] + ), + ), + ( + "image_teaser_block", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock(help_text="Heading for the card.")), + ("text", wagtail.blocks.RichTextBlock(features=["bold"])), + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "altText", + wagtail.blocks.CharBlock( + help_text="Image description (for screen readers).", required=True + ), + ), + ( + "link_button", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("label", wagtail.blocks.CharBlock()), + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock(label="Page", required=False), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", required=False + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False + ), + ), + ( + "styling", + wagtail.blocks.ChoiceBlock( + choices=[ + ("btn-primary", "Primary button"), + ("btn-secondary", "Secondary button"), + ] + ), + ), + ] + ), + help_text="Optional link button", + max_num=1, + min_num=0, + ), + ), + ( + "top_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider above content block.", required=False + ), + ), + ( + "bottom_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider below content block.", required=False + ), + ), + ] + ), + ), + ( + "text_only_teaser", + wagtail.blocks.StructBlock( + [ + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock(help_text="Heading for the card."), + ), + ( + "link_page", + wagtail.blocks.PageChooserBlock( + help_text="Page that the header should link out to.", + required=False, + ), + ), + ( + "link_url", + wagtail.blocks.CharBlock( + help_text="Optional URL that the header should link out to.", + required=False, + ), + ), + ("meta_data", wagtail.blocks.CharBlock(max_length=500)), + ( + "body", + wagtail.blocks.TextBlock( + help_text="Body text of the card.", + max_length=200, + required=False, + ), + ), + ] + ), + help_text="Please use a minimum of 3 cards.", + min_num=3, + ), + ) + ] + ), + ), + ( + "block_with_aside", + wagtail.blocks.StructBlock( + [ + ( + "content", + wagtail.blocks.StreamBlock( + [ + ( + "listing", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + help_text="Heading for the block.", required=False + ), + ), + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "image", + wagtail.images.blocks.ImageChooserBlock(), + ), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Alt text for card's image.", + required=False, + ), + ), + ( + "title", + wagtail.blocks.CharBlock( + help_text="Heading for the card." + ), + ), + ( + "highlighted_metadata", + wagtail.blocks.CharBlock( + help_text="Metadata to highlight on the card.", + required=False, + ), + ), + ( + "metadata", + wagtail.blocks.CharBlock( + help_text="Generic metadata.", + required=False, + ), + ), + ( + "body", + wagtail.blocks.RichTextBlock( + features=["bold"], + help_text="Body text of the card.", + required=False, + ), + ), + ( + "link_page", + wagtail.blocks.PageChooserBlock( + help_text="Page that this should link out to.", + required=False, + ), + ), + ( + "link_url", + wagtail.blocks.CharBlock( + help_text="Optional URL that the header should link out to.", + required=False, + ), + ), + ] + ), + help_text="Please use a minimum of 2 cards.", + min_num=2, + ), + ), + ( + "cards_per_row", + wagtail.blocks.ChoiceBlock( + choices=[(2, "2"), (3, "3")], + help_text="Number of cards per row. Note: this is a max and fewer might be used if is less space is available.", + required=False, + ), + ), + ] + ), + ), + ( + "paragraph", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "h2", + "h3", + "h4", + "h5", + "ol", + "ul", + "hr", + "document-link", + ] + ), + ), + ], + help_text="The wider block that appears on the left on desktop", + icon="doc-full", + max_num=1, + ), + ), + ( + "aside", + wagtail.blocks.StreamBlock( + [ + ( + "aside_content", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + help_text="Heading for the card.", required=False + ), + ), + ( + "body", + wagtail.blocks.TextBlock( + help_text="Body text of the card.", required=False + ), + ), + ] + ), + ), + ( + "linkbutton", + wagtail.blocks.StructBlock( + [ + ("label", wagtail.blocks.CharBlock()), + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock( + label="Page", required=False + ), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", required=False + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False + ), + ), + ( + "styling", + wagtail.blocks.ChoiceBlock( + choices=[ + ("btn-primary", "Primary button"), + ("btn-secondary", "Secondary button"), + ] + ), + ), + ] + ), + ), + ( + "spacer", + wagtail.blocks.StructBlock( + [ + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("1", "quarter spacing"), + ("2", "half spacing"), + ("3", "single spacing"), + ("4", "one and a half spacing"), + ("5", "triple spacing"), + ] + ), + ) + ] + ), + ), + ], + help_text="Elements here will appear in the column on the right side of the page on desktop. This can be left blank if you would just like a 2/3 column on the left", + icon="doc-full", + required=False, + ), + ), + ] + ), + ), + ( + "accordion", + wagtail.blocks.StructBlock( + [ + ( + "accordion_items", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + help_text="Heading for the Accordion Item" + ), + ), + ( + "content", + wagtail.blocks.StreamBlock( + [ + ( + "rich_text", + wagtail.blocks.RichTextBlock( + blank=True, + features=[ + "bold", + "italic", + "link", + "ul", + "ol", + "document-link", + ], + ), + ), + ( + "datawrapper", + wagtail.embeds.blocks.EmbedBlock( + help_text='Enter the "visualization only" link of the Datawrapper chart. It looks something like this: https://datawrapper.dwcdn.net/KwSKp/1/', + icon="image", + template="wagtailpages/blocks/datawrapper_block.html", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "image", + wagtail.images.blocks.ImageChooserBlock(), + ), + ( + "altText", + wagtail.blocks.CharBlock( + help_text="Image description (for screen readers).", + required=True, + ), + ), + ] + ), + ), + ( + "video", + wagtail.blocks.StructBlock( + [ + ( + "url", + wagtail.blocks.URLBlock( + help_text="For YouTube: go to your YouTube video and click “Share,” then “Embed,” and then copy and paste the provided URL only. For example: https://www.youtube.com/embed/3FIVXBawyQw For Vimeo: follow similar steps to grab the embed URL. For example: https://player.vimeo.com/video/9004979", + label="Embed URL", + ), + ), + ( + "caption", + wagtail.blocks.CharBlock(required=False), + ), + ( + "caption_url", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ( + "external_url", + "External URL", + ), + ( + "relative_url", + "Relative URL", + ), + ("email", "Email"), + ( + "anchor", + "Anchor", + ), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock( + label="Page", + required=False, + ), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ( + "email", + wagtail.blocks.EmailBlock( + required=False + ), + ), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", + required=False, + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", + max_length=30, + required=False, + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", + required=False, + ), + ), + ] + ), + help_text="Optional URL that this caption should link out to.", + max_num=1, + min_num=0, + ), + ), + ( + "video_width", + wagtail.blocks.ChoiceBlock( + choices=[ + ("normal", "Normal"), + ("wide", "Wide"), + ("full_width", "Full Width"), + ], + help_text="Wide videos are col-12, Full-Width videos reach both ends of the screen.", + ), + ), + ] + ), + ), + ] + ), + ), + ] + ) + ), + ) + ] + ), + ), + ], + use_json_field=True, + ), + ), + migrations.AlterField( + model_name="primarypage", + name="body", + field=wagtail.fields.StreamField( + [ + ( + "paragraph", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "h2", + "h3", + "h4", + "h5", + "ol", + "ul", + "hr", + "document-link", + "large", + ], + template="wagtailpages/blocks/rich_text_block.html", + ), + ), + ( + "card_grid", + wagtail.blocks.StructBlock( + [ + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Alt text for card's image.", required=False + ), + ), + ("title", wagtail.blocks.CharBlock(help_text="Heading for the card.")), + ("body", wagtail.blocks.TextBlock(help_text="Body text of the card.")), + ( + "link_url", + wagtail.blocks.CharBlock( + help_text="Optional URL that this card should link out to. (Note: If left blank, link will not render.) ", + required=False, + ), + ), + ( + "link_label", + wagtail.blocks.CharBlock( + help_text="Optional Label for the URL link above. (Note: If left blank, link will not render.) ", + required=False, + ), + ), + ] + ), + help_text="Please use a minimum of 2 cards.", + ), + ) + ] + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "altText", + wagtail.blocks.CharBlock( + help_text="Image description (for screen readers).", required=True + ), + ), + ("caption", wagtail.blocks.CharBlock(required=False)), + ( + "caption_url", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock(label="Page", required=False), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", required=False + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False + ), + ), + ] + ), + help_text="Optional URL that this caption should link out to.", + max_num=1, + min_num=0, + ), + ), + ( + "image_width", + wagtail.blocks.ChoiceBlock( + choices=[("normal", "Normal"), ("wide", "Wide"), ("full_width", "Full Width")], + help_text="Wide images are col-12, Full-Width Images reach both ends of the screen (16:6 images recommended for full width)", + ), + ), + ] + ), + ), + ( + "image_text", + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "altText", + wagtail.blocks.CharBlock( + help_text="Image description (for screen readers).", required=True + ), + ), + ( + "text", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "h2", + "h3", + "h4", + "h5", + "ol", + "ul", + "hr", + "document-link", + ] + ), + ), + ( + "url", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock(label="Page", required=False), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", required=False + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False + ), + ), + ] + ), + help_text="Optional URL that this image should link out to.", + max_num=1, + min_num=0, + ), + ), + ( + "top_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider above content block.", required=False + ), + ), + ( + "bottom_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider below content block.", required=False + ), + ), + ] + ), + ), + ( + "image_text_mini", + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "altText", + wagtail.blocks.CharBlock( + help_text="Image description (for screen readers).", required=True + ), + ), + ("text", wagtail.blocks.RichTextBlock(features=["bold", "italic", "link"])), + ] + ), + ), + ( + "image_grid", + wagtail.blocks.StructBlock( + [ + ( + "grid_items", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Alt text for this image.", required=False + ), + ), + ( + "caption", + wagtail.blocks.CharBlock( + help_text="Please remember to properly attribute any images we use.", + required=False, + ), + ), + ( + "url", + wagtail.blocks.CharBlock( + help_text="Optional URL that this figure should link out to.", + required=False, + ), + ), + ( + "square_image", + wagtail.blocks.BooleanBlock( + default=True, + help_text="If left checked, the image will be cropped to be square.", + required=False, + ), + ), + ] + ) + ), + ) + ] + ), + ), + ( + "video", + wagtail.blocks.StructBlock( + [ + ( + "url", + wagtail.blocks.URLBlock( + help_text="For YouTube: go to your YouTube video and click “Share,” then “Embed,” and then copy and paste the provided URL only. For example: https://www.youtube.com/embed/3FIVXBawyQw For Vimeo: follow similar steps to grab the embed URL. For example: https://player.vimeo.com/video/9004979", + label="Embed URL", + ), + ), + ("caption", wagtail.blocks.CharBlock(required=False)), + ( + "caption_url", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock(label="Page", required=False), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", required=False + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False + ), + ), + ] + ), + help_text="Optional URL that this caption should link out to.", + max_num=1, + min_num=0, + ), + ), + ( + "video_width", + wagtail.blocks.ChoiceBlock( + choices=[("normal", "Normal"), ("wide", "Wide"), ("full_width", "Full Width")], + help_text="Wide videos are col-12, Full-Width videos reach both ends of the screen.", + ), + ), + ] + ), + ), + ( + "iframe", + wagtail.blocks.StructBlock( + [ + ( + "url", + wagtail.blocks.CharBlock( + help_text="Please note that only URLs from allow-listed domains will work." + ), + ), + ( + "height", + wagtail.blocks.IntegerBlock( + help_text="Optional integer pixel value for custom iFrame height", + required=False, + ), + ), + ("caption", wagtail.blocks.CharBlock(required=False)), + ( + "caption_url", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock(label="Page", required=False), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", required=False + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False + ), + ), + ] + ), + help_text="Optional URL that this caption should link out to.", + max_num=1, + min_num=0, + ), + ), + ( + "iframe_width", + wagtail.blocks.ChoiceBlock( + choices=[("normal", "Normal"), ("wide", "Wide"), ("full_width", "Full Width")], + help_text="Wide iframes are col-12, Full-Width iframes reach both ends of the screen", + ), + ), + ( + "disable_scroll", + wagtail.blocks.BooleanBlock( + default=False, + help_text='Checking this will add "scrolling=no" to the iframe. Use this if your iframe is rendering an unnecessary scroll bar or whitespace below it.', + required=False, + ), + ), + ] + ), + ), + ( + "linkbutton", + wagtail.blocks.StructBlock( + [ + ("label", wagtail.blocks.CharBlock()), + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ("page", wagtail.blocks.PageChooserBlock(label="Page", required=False)), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[networkapi.wagtailpages.validators.RelativeURLValidator()], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[networkapi.wagtailpages.validators.AnchorLinkValidator()], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ("file", wagtail.documents.blocks.DocumentChooserBlock(label="File", required=False)), + ("phone", wagtail.blocks.CharBlock(label="Phone", max_length=30, required=False)), + ( + "new_window", + wagtail.blocks.BooleanBlock(label="Open in new window", required=False), + ), + ( + "styling", + wagtail.blocks.ChoiceBlock( + choices=[ + ("btn-primary", "Primary button"), + ("btn-secondary", "Secondary button"), + ] + ), + ), + ] + ), + ), + ( + "spacer", + wagtail.blocks.StructBlock( + [ + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("1", "quarter spacing"), + ("2", "half spacing"), + ("3", "single spacing"), + ("4", "one and a half spacing"), + ("5", "triple spacing"), + ] + ), + ) + ] + ), + ), + ( + "single_quote", + wagtail.blocks.StructBlock( + [ + ("quote", wagtail.blocks.RichTextBlock(features=["bold"])), + ("attribution", wagtail.blocks.CharBlock(required=False)), + ( + "attribution_info", + wagtail.blocks.RichTextBlock(features=["bold", "link", "large"], required=False), + ), + ] + ), + ), + ( + "pulse_listing", + wagtail.blocks.StructBlock( + [ + ( + "search_terms", + wagtail.blocks.CharBlock( + help_text="Test your search at mozillapulse.org/search", + label="Search", + required=False, + ), + ), + ( + "max_number_of_results", + wagtail.blocks.IntegerBlock( + default=6, + help_text="Choose 1-12. If you want visitors to see more, link to a search or tag on Pulse.", + max_value=12, + min_value=0, + required=True, + ), + ), + ( + "only_featured_entries", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Featured items are selected by Pulse moderators.", + label="Display only featured entries", + required=False, + ), + ), + ( + "newest_first", + wagtail.blocks.ChoiceBlock( + choices=[ + ("True", "Show newer entries first"), + ("False", "Show older entries first"), + ], + label="Sort", + ), + ), + ( + "advanced_filter_header", + wagtail.blocks.static_block.StaticBlock( + admin_text="-------- ADVANCED FILTERS: OPTIONS TO DISPLAY FEWER, MORE TARGETED RESULTS. --------", + label=" ", + ), + ), + ( + "issues", + wagtail.blocks.ChoiceBlock( + choices=[ + ("all", "All"), + ("Decentralization", "Decentralization"), + ("Digital Inclusion", "Digital Inclusion"), + ("Online Privacy & Security", "Online Privacy & Security"), + ("Open Innovation", "Open Innovation"), + ("Web Literacy", "Web Literacy"), + ] + ), + ), + ( + "help", + wagtail.blocks.ChoiceBlock( + choices=[ + ("all", "All"), + ("Attend", "Attend"), + ("Create content", "Create content"), + ("Code", "Code"), + ("Design", "Design"), + ("Fundraise", "Fundraise"), + ("Join community", "Join community"), + ("Localize & translate", "Localize & translate"), + ("Mentor", "Mentor"), + ("Plan & organize", "Plan & organize"), + ("Promote", "Promote"), + ("Take action", "Take action"), + ("Test & feedback", "Test & feedback"), + ("Write documentation", "Write documentation"), + ], + label="Type of help needed", + ), + ), + ( + "direct_link", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Checked: user goes to project link. Unchecked: user goes to pulse entry", + label="Direct link", + required=False, + ), + ), + ] + ), + ), + ( + "profile_listing", + wagtail.blocks.StructBlock( + [ + ( + "max_number_of_results", + wagtail.blocks.IntegerBlock( + default=12, + help_text="Pick up to 48 profiles.", + max_value=48, + min_value=1, + required=True, + ), + ), + ( + "advanced_filter_header", + wagtail.blocks.static_block.StaticBlock( + admin_text="-------- ADVANCED FILTERS: OPTIONS TO DISPLAY FEWER, MORE TARGETED RESULTS. --------", + label=" ", + ), + ), + ( + "profile_type", + wagtail.blocks.CharBlock(default="", help_text="Example: Fellow.", required=False), + ), + ( + "program_type", + wagtail.blocks.CharBlock( + default="", help_text="Example: Tech Policy.", required=False + ), + ), + ("year", wagtail.blocks.CharBlock(default="", required=False)), + ] + ), + ), + ( + "profile_by_id", + wagtail.blocks.StructBlock( + [ + ( + "ids", + wagtail.blocks.CharBlock( + help_text="Show profiles for pulse users with specific profile ids (mozillapulse.org/profile/[##]). For multiple profiles, specify a comma separated list (e.g. 85,105,332).", + label="Profile by ID", + ), + ) + ] + ), + ), + ( + "profile_directory", + wagtail.blocks.StructBlock( + [ + ( + "max_number_of_results", + wagtail.blocks.IntegerBlock( + default=12, + help_text="Pick up to 48 profiles.", + max_value=48, + min_value=1, + required=True, + ), + ), + ( + "advanced_filter_header", + wagtail.blocks.static_block.StaticBlock( + admin_text="-------- ADVANCED FILTERS: OPTIONS TO DISPLAY FEWER, MORE TARGETED RESULTS. --------", + label=" ", + ), + ), + ( + "profile_type", + wagtail.blocks.CharBlock(default="", help_text="Example: Fellow.", required=False), + ), + ( + "program_type", + wagtail.blocks.CharBlock( + default="", help_text="Example: Tech Policy.", required=False + ), + ), + ("year", wagtail.blocks.CharBlock(default="", required=False)), + ( + "filter_values", + wagtail.blocks.CharBlock( + default="2019,2018,2017,2016,2015,2014,2013", + help_text="Example: 2019,2018,2017,2016,2015,2014,2013", + required=True, + ), + ), + ] + ), + ), + ( + "recent_blog_entries", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock(required=False)), + ( + "tag_filter", + wagtail.blocks.CharBlock( + help_text="Test this filter at foundation.mozilla.org/blog/tags/", + label="Filter by Tag", + required=False, + ), + ), + ( + "topic_filter", + wagtail.blocks.ChoiceBlock( + choices=networkapi.wagtailpages.pagemodels.blog.blog_topic.BlogPageTopic.get_topics, + help_text="Test this filter at foundation.mozilla.org/blog/topic/", + label="Filter by Topic", + required=False, + ), + ), + ( + "top_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider above content block.", required=False + ), + ), + ( + "bottom_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider below content block.", required=False + ), + ), + ] + ), + ), + ( + "blog_set", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock()), + ( + "top_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider above content block.", required=False + ), + ), + ( + "bottom_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider below content block.", required=False + ), + ), + ( + "blog_pages", + wagtail.blocks.ListBlock( + wagtail.blocks.PageChooserBlock(page_type=["wagtailpages.BlogPage"]) + ), + ), + ] + ), + ), + ( + "airtable", + wagtail.blocks.StructBlock( + [ + ( + "url", + wagtail.blocks.URLBlock( + help_text="Copied from the Airtable embed code. The word 'embed' will be in the url" + ), + ), + ( + "height", + wagtail.blocks.IntegerBlock( + default=533, + help_text="The pixel height on desktop view, usually copied from the Airtable embed code", + ), + ), + ] + ), + ), + ( + "typeform", + wagtail.blocks.StructBlock( + [ + ( + "embed_id", + wagtail.blocks.CharBlock( + help_text="The embed id of your Typeform page (e.g. if the form is on admin.typeform.com/form/e8zScc6t, the id will be: e8zScc6t)", + required=True, + ), + ), + ( + "button_type", + wagtail.blocks.ChoiceBlock( + choices=[ + ("btn-primary", "Primary button"), + ("btn-secondary", "Secondary button"), + ] + ), + ), + ( + "button_text", + wagtail.blocks.CharBlock( + help_text="This is a text prompt for users to open the typeform content", + required=True, + ), + ), + ] + ), + ), + ( + "datawrapper", + wagtail.embeds.blocks.EmbedBlock( + help_text='Enter the "visualization only" link of the Datawrapper chart. It looks something like this: https://datawrapper.dwcdn.net/KwSKp/1/', + icon="image", + template="wagtailpages/blocks/datawrapper_block.html", + ), + ), + ( + "listing", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock(help_text="Heading for the block.", required=False), + ), + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Alt text for card's image.", required=False + ), + ), + ("title", wagtail.blocks.CharBlock(help_text="Heading for the card.")), + ( + "highlighted_metadata", + wagtail.blocks.CharBlock( + help_text="Metadata to highlight on the card.", required=False + ), + ), + ( + "metadata", + wagtail.blocks.CharBlock( + help_text="Generic metadata.", required=False + ), + ), + ( + "body", + wagtail.blocks.RichTextBlock( + features=["bold"], + help_text="Body text of the card.", + required=False, + ), + ), + ( + "link_page", + wagtail.blocks.PageChooserBlock( + help_text="Page that this should link out to.", required=False + ), + ), + ( + "link_url", + wagtail.blocks.CharBlock( + help_text="Optional URL that the header should link out to.", + required=False, + ), + ), + ] + ), + help_text="Please use a minimum of 2 cards.", + min_num=2, + ), + ), + ( + "cards_per_row", + wagtail.blocks.ChoiceBlock( + choices=[(2, "2"), (3, "3")], + help_text="Number of cards per row. Note: this is a max and fewer might be used if is less space is available.", + required=False, + ), + ), + ] + ), + ), + ( + "profiles", + wagtail.blocks.StructBlock( + [ + ( + "profiles", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "profile", + wagtail.snippets.blocks.SnippetChooserBlock( + networkapi.wagtailpages.pagemodels.profiles.Profile + ), + ) + ] + ), + min_num=1, + ), + ) + ] + ), + ), + ( + "article_teaser_block", + wagtail.blocks.StructBlock( + [ + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "article", + wagtail.blocks.PageChooserBlock( + help_text="Page that this should link out to.", + page_type=["wagtailpages.ArticlePage"], + required=False, + ), + ) + ] + ), + help_text="Please use a minimum of 3 cards.", + min_num=3, + ), + ) + ] + ), + ), + ( + "group_listing_block", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + help_text="Heading for the group of cards.", required=False + ), + ), + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Alt text for card's image.", required=False + ), + ), + ( + "meta_data", + wagtail.blocks.CharBlock( + help_text="Optional meta data information for the card.", + required=False, + ), + ), + ("title", wagtail.blocks.CharBlock(help_text="Heading for the card.")), + ( + "body", + wagtail.blocks.RichTextBlock( + features=["bold", "link"], help_text="Body text of the card." + ), + ), + ( + "url", + wagtail.blocks.CharBlock( + help_text="The URL this card should link to.", required=False + ), + ), + ( + "link", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock( + label="Page", required=False + ), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", required=False + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False + ), + ), + ] + ), + help_text="Optional link that this card should link to.", + max_num=1, + min_num=0, + ), + ), + ] + ) + ), + ), + ] + ), + ), + ( + "image_feature", + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "alt_text", + wagtail.blocks.CharBlock(help_text="Image description (for screen readers)."), + ), + ("metadata", wagtail.blocks.CharBlock(required=False)), + ("title", wagtail.blocks.CharBlock(help_text="Heading for the card.")), + ( + "title_link", + wagtail.blocks.PageChooserBlock( + help_text="Page that the title should link out to.", required=False + ), + ), + ("body", wagtail.blocks.CharBlock(required=False)), + ] + ), + ), + ( + "image_teaser_block", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock(help_text="Heading for the card.")), + ("text", wagtail.blocks.RichTextBlock(features=["bold"])), + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "altText", + wagtail.blocks.CharBlock( + help_text="Image description (for screen readers).", required=True + ), + ), + ( + "link_button", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("label", wagtail.blocks.CharBlock()), + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock(label="Page", required=False), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", required=False + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False + ), + ), + ( + "styling", + wagtail.blocks.ChoiceBlock( + choices=[ + ("btn-primary", "Primary button"), + ("btn-secondary", "Secondary button"), + ] + ), + ), + ] + ), + help_text="Optional link button", + max_num=1, + min_num=0, + ), + ), + ( + "top_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider above content block.", required=False + ), + ), + ( + "bottom_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider below content block.", required=False + ), + ), + ] + ), + ), + ( + "text_only_teaser", + wagtail.blocks.StructBlock( + [ + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock(help_text="Heading for the card."), + ), + ( + "link_page", + wagtail.blocks.PageChooserBlock( + help_text="Page that the header should link out to.", + required=False, + ), + ), + ( + "link_url", + wagtail.blocks.CharBlock( + help_text="Optional URL that the header should link out to.", + required=False, + ), + ), + ("meta_data", wagtail.blocks.CharBlock(max_length=500)), + ( + "body", + wagtail.blocks.TextBlock( + help_text="Body text of the card.", + max_length=200, + required=False, + ), + ), + ] + ), + help_text="Please use a minimum of 3 cards.", + min_num=3, + ), + ) + ] + ), + ), + ( + "block_with_aside", + wagtail.blocks.StructBlock( + [ + ( + "content", + wagtail.blocks.StreamBlock( + [ + ( + "listing", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + help_text="Heading for the block.", required=False + ), + ), + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "image", + wagtail.images.blocks.ImageChooserBlock(), + ), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Alt text for card's image.", + required=False, + ), + ), + ( + "title", + wagtail.blocks.CharBlock( + help_text="Heading for the card." + ), + ), + ( + "highlighted_metadata", + wagtail.blocks.CharBlock( + help_text="Metadata to highlight on the card.", + required=False, + ), + ), + ( + "metadata", + wagtail.blocks.CharBlock( + help_text="Generic metadata.", + required=False, + ), + ), + ( + "body", + wagtail.blocks.RichTextBlock( + features=["bold"], + help_text="Body text of the card.", + required=False, + ), + ), + ( + "link_page", + wagtail.blocks.PageChooserBlock( + help_text="Page that this should link out to.", + required=False, + ), + ), + ( + "link_url", + wagtail.blocks.CharBlock( + help_text="Optional URL that the header should link out to.", + required=False, + ), + ), + ] + ), + help_text="Please use a minimum of 2 cards.", + min_num=2, + ), + ), + ( + "cards_per_row", + wagtail.blocks.ChoiceBlock( + choices=[(2, "2"), (3, "3")], + help_text="Number of cards per row. Note: this is a max and fewer might be used if is less space is available.", + required=False, + ), + ), + ] + ), + ), + ( + "paragraph", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "h2", + "h3", + "h4", + "h5", + "ol", + "ul", + "hr", + "document-link", + ] + ), + ), + ], + help_text="The wider block that appears on the left on desktop", + icon="doc-full", + max_num=1, + ), + ), + ( + "aside", + wagtail.blocks.StreamBlock( + [ + ( + "aside_content", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + help_text="Heading for the card.", required=False + ), + ), + ( + "body", + wagtail.blocks.TextBlock( + help_text="Body text of the card.", required=False + ), + ), + ] + ), + ), + ( + "linkbutton", + wagtail.blocks.StructBlock( + [ + ("label", wagtail.blocks.CharBlock()), + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock( + label="Page", required=False + ), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", required=False + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False + ), + ), + ( + "styling", + wagtail.blocks.ChoiceBlock( + choices=[ + ("btn-primary", "Primary button"), + ("btn-secondary", "Secondary button"), + ] + ), + ), + ] + ), + ), + ( + "spacer", + wagtail.blocks.StructBlock( + [ + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("1", "quarter spacing"), + ("2", "half spacing"), + ("3", "single spacing"), + ("4", "one and a half spacing"), + ("5", "triple spacing"), + ] + ), + ) + ] + ), + ), + ], + help_text="Elements here will appear in the column on the right side of the page on desktop. This can be left blank if you would just like a 2/3 column on the left", + icon="doc-full", + required=False, + ), + ), + ] + ), + ), + ( + "accordion", + wagtail.blocks.StructBlock( + [ + ( + "accordion_items", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + help_text="Heading for the Accordion Item" + ), + ), + ( + "content", + wagtail.blocks.StreamBlock( + [ + ( + "rich_text", + wagtail.blocks.RichTextBlock( + blank=True, + features=[ + "bold", + "italic", + "link", + "ul", + "ol", + "document-link", + ], + ), + ), + ( + "datawrapper", + wagtail.embeds.blocks.EmbedBlock( + help_text='Enter the "visualization only" link of the Datawrapper chart. It looks something like this: https://datawrapper.dwcdn.net/KwSKp/1/', + icon="image", + template="wagtailpages/blocks/datawrapper_block.html", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "image", + wagtail.images.blocks.ImageChooserBlock(), + ), + ( + "altText", + wagtail.blocks.CharBlock( + help_text="Image description (for screen readers).", + required=True, + ), + ), + ] + ), + ), + ( + "video", + wagtail.blocks.StructBlock( + [ + ( + "url", + wagtail.blocks.URLBlock( + help_text="For YouTube: go to your YouTube video and click “Share,” then “Embed,” and then copy and paste the provided URL only. For example: https://www.youtube.com/embed/3FIVXBawyQw For Vimeo: follow similar steps to grab the embed URL. For example: https://player.vimeo.com/video/9004979", + label="Embed URL", + ), + ), + ( + "caption", + wagtail.blocks.CharBlock(required=False), + ), + ( + "caption_url", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ( + "external_url", + "External URL", + ), + ( + "relative_url", + "Relative URL", + ), + ("email", "Email"), + ( + "anchor", + "Anchor", + ), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock( + label="Page", + required=False, + ), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ( + "email", + wagtail.blocks.EmailBlock( + required=False + ), + ), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", + required=False, + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", + max_length=30, + required=False, + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", + required=False, + ), + ), + ] + ), + help_text="Optional URL that this caption should link out to.", + max_num=1, + min_num=0, + ), + ), + ( + "video_width", + wagtail.blocks.ChoiceBlock( + choices=[ + ("normal", "Normal"), + ("wide", "Wide"), + ("full_width", "Full Width"), + ], + help_text="Wide videos are col-12, Full-Width videos reach both ends of the screen.", + ), + ), + ] + ), + ), + ] + ), + ), + ] + ) + ), + ) + ] + ), + ), + ], + use_json_field=True, + ), + ), + MigrateStreamData( + app_name="wagtailpages", + model_name="modularpage", + field_name="body", + operations_and_block_paths=[ + ( + AlterStreamChildBlockDataOperation( + block="group_listing_block", operation=migrate_group_listing_block_cards + ), + "", + ), + ], + ), + MigrateStreamData( + app_name="wagtailpages", + model_name="primarypage", + field_name="body", + operations_and_block_paths=[ + ( + AlterStreamChildBlockDataOperation( + block="group_listing_block", operation=migrate_group_listing_block_cards + ), + "", + ), + ], + ), + migrations.AlterField( + model_name="modularpage", + name="body", + field=wagtail.fields.StreamField( + [ + ( + "paragraph", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "h2", + "h3", + "h4", + "h5", + "ol", + "ul", + "hr", + "document-link", + "large", + ], + template="wagtailpages/blocks/rich_text_block.html", + ), + ), + ( + "card_grid", + wagtail.blocks.StructBlock( + [ + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Alt text for card's image.", required=False + ), + ), + ("title", wagtail.blocks.CharBlock(help_text="Heading for the card.")), + ("body", wagtail.blocks.TextBlock(help_text="Body text of the card.")), + ( + "link_url", + wagtail.blocks.CharBlock( + help_text="Optional URL that this card should link out to. (Note: If left blank, link will not render.) ", + required=False, + ), + ), + ( + "link_label", + wagtail.blocks.CharBlock( + help_text="Optional Label for the URL link above. (Note: If left blank, link will not render.) ", + required=False, + ), + ), + ] + ), + help_text="Please use a minimum of 2 cards.", + ), + ) + ] + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "altText", + wagtail.blocks.CharBlock( + help_text="Image description (for screen readers).", required=True + ), + ), + ("caption", wagtail.blocks.CharBlock(required=False)), + ( + "caption_url", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock(label="Page", required=False), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", required=False + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False + ), + ), + ] + ), + help_text="Optional URL that this caption should link out to.", + max_num=1, + min_num=0, + ), + ), + ( + "image_width", + wagtail.blocks.ChoiceBlock( + choices=[("normal", "Normal"), ("wide", "Wide"), ("full_width", "Full Width")], + help_text="Wide images are col-12, Full-Width Images reach both ends of the screen (16:6 images recommended for full width)", + ), + ), + ] + ), + ), + ( + "image_text", + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "altText", + wagtail.blocks.CharBlock( + help_text="Image description (for screen readers).", required=True + ), + ), + ( + "text", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "h2", + "h3", + "h4", + "h5", + "ol", + "ul", + "hr", + "document-link", + ] + ), + ), + ( + "url", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock(label="Page", required=False), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", required=False + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False + ), + ), + ] + ), + help_text="Optional URL that this image should link out to.", + max_num=1, + min_num=0, + ), + ), + ( + "top_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider above content block.", required=False + ), + ), + ( + "bottom_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider below content block.", required=False + ), + ), + ] + ), + ), + ( + "image_text_mini", + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "altText", + wagtail.blocks.CharBlock( + help_text="Image description (for screen readers).", required=True + ), + ), + ("text", wagtail.blocks.RichTextBlock(features=["bold", "italic", "link"])), + ] + ), + ), + ( + "image_grid", + wagtail.blocks.StructBlock( + [ + ( + "grid_items", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Alt text for this image.", required=False + ), + ), + ( + "caption", + wagtail.blocks.CharBlock( + help_text="Please remember to properly attribute any images we use.", + required=False, + ), + ), + ( + "url", + wagtail.blocks.CharBlock( + help_text="Optional URL that this figure should link out to.", + required=False, + ), + ), + ( + "square_image", + wagtail.blocks.BooleanBlock( + default=True, + help_text="If left checked, the image will be cropped to be square.", + required=False, + ), + ), + ] + ) + ), + ) + ] + ), + ), + ( + "video", + wagtail.blocks.StructBlock( + [ + ( + "url", + wagtail.blocks.URLBlock( + help_text="For YouTube: go to your YouTube video and click “Share,” then “Embed,” and then copy and paste the provided URL only. For example: https://www.youtube.com/embed/3FIVXBawyQw For Vimeo: follow similar steps to grab the embed URL. For example: https://player.vimeo.com/video/9004979", + label="Embed URL", + ), + ), + ("caption", wagtail.blocks.CharBlock(required=False)), + ( + "caption_url", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock(label="Page", required=False), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", required=False + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False + ), + ), + ] + ), + help_text="Optional URL that this caption should link out to.", + max_num=1, + min_num=0, + ), + ), + ( + "video_width", + wagtail.blocks.ChoiceBlock( + choices=[("normal", "Normal"), ("wide", "Wide"), ("full_width", "Full Width")], + help_text="Wide videos are col-12, Full-Width videos reach both ends of the screen.", + ), + ), + ] + ), + ), + ( + "iframe", + wagtail.blocks.StructBlock( + [ + ( + "url", + wagtail.blocks.CharBlock( + help_text="Please note that only URLs from allow-listed domains will work." + ), + ), + ( + "height", + wagtail.blocks.IntegerBlock( + help_text="Optional integer pixel value for custom iFrame height", + required=False, + ), + ), + ("caption", wagtail.blocks.CharBlock(required=False)), + ( + "caption_url", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock(label="Page", required=False), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", required=False + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False + ), + ), + ] + ), + help_text="Optional URL that this caption should link out to.", + max_num=1, + min_num=0, + ), + ), + ( + "iframe_width", + wagtail.blocks.ChoiceBlock( + choices=[("normal", "Normal"), ("wide", "Wide"), ("full_width", "Full Width")], + help_text="Wide iframes are col-12, Full-Width iframes reach both ends of the screen", + ), + ), + ( + "disable_scroll", + wagtail.blocks.BooleanBlock( + default=False, + help_text='Checking this will add "scrolling=no" to the iframe. Use this if your iframe is rendering an unnecessary scroll bar or whitespace below it.', + required=False, + ), + ), + ] + ), + ), + ( + "linkbutton", + wagtail.blocks.StructBlock( + [ + ("label", wagtail.blocks.CharBlock()), + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ("page", wagtail.blocks.PageChooserBlock(label="Page", required=False)), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[networkapi.wagtailpages.validators.RelativeURLValidator()], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[networkapi.wagtailpages.validators.AnchorLinkValidator()], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ("file", wagtail.documents.blocks.DocumentChooserBlock(label="File", required=False)), + ("phone", wagtail.blocks.CharBlock(label="Phone", max_length=30, required=False)), + ( + "new_window", + wagtail.blocks.BooleanBlock(label="Open in new window", required=False), + ), + ( + "styling", + wagtail.blocks.ChoiceBlock( + choices=[ + ("btn-primary", "Primary button"), + ("btn-secondary", "Secondary button"), + ] + ), + ), + ] + ), + ), + ( + "spacer", + wagtail.blocks.StructBlock( + [ + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("1", "quarter spacing"), + ("2", "half spacing"), + ("3", "single spacing"), + ("4", "one and a half spacing"), + ("5", "triple spacing"), + ] + ), + ) + ] + ), + ), + ( + "single_quote", + wagtail.blocks.StructBlock( + [ + ("quote", wagtail.blocks.RichTextBlock(features=["bold"])), + ("attribution", wagtail.blocks.CharBlock(required=False)), + ( + "attribution_info", + wagtail.blocks.RichTextBlock(features=["bold", "link", "large"], required=False), + ), + ] + ), + ), + ( + "pulse_listing", + wagtail.blocks.StructBlock( + [ + ( + "search_terms", + wagtail.blocks.CharBlock( + help_text="Test your search at mozillapulse.org/search", + label="Search", + required=False, + ), + ), + ( + "max_number_of_results", + wagtail.blocks.IntegerBlock( + default=6, + help_text="Choose 1-12. If you want visitors to see more, link to a search or tag on Pulse.", + max_value=12, + min_value=0, + required=True, + ), + ), + ( + "only_featured_entries", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Featured items are selected by Pulse moderators.", + label="Display only featured entries", + required=False, + ), + ), + ( + "newest_first", + wagtail.blocks.ChoiceBlock( + choices=[ + ("True", "Show newer entries first"), + ("False", "Show older entries first"), + ], + label="Sort", + ), + ), + ( + "advanced_filter_header", + wagtail.blocks.static_block.StaticBlock( + admin_text="-------- ADVANCED FILTERS: OPTIONS TO DISPLAY FEWER, MORE TARGETED RESULTS. --------", + label=" ", + ), + ), + ( + "issues", + wagtail.blocks.ChoiceBlock( + choices=[ + ("all", "All"), + ("Decentralization", "Decentralization"), + ("Digital Inclusion", "Digital Inclusion"), + ("Online Privacy & Security", "Online Privacy & Security"), + ("Open Innovation", "Open Innovation"), + ("Web Literacy", "Web Literacy"), + ] + ), + ), + ( + "help", + wagtail.blocks.ChoiceBlock( + choices=[ + ("all", "All"), + ("Attend", "Attend"), + ("Create content", "Create content"), + ("Code", "Code"), + ("Design", "Design"), + ("Fundraise", "Fundraise"), + ("Join community", "Join community"), + ("Localize & translate", "Localize & translate"), + ("Mentor", "Mentor"), + ("Plan & organize", "Plan & organize"), + ("Promote", "Promote"), + ("Take action", "Take action"), + ("Test & feedback", "Test & feedback"), + ("Write documentation", "Write documentation"), + ], + label="Type of help needed", + ), + ), + ( + "direct_link", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Checked: user goes to project link. Unchecked: user goes to pulse entry", + label="Direct link", + required=False, + ), + ), + ] + ), + ), + ( + "profile_listing", + wagtail.blocks.StructBlock( + [ + ( + "max_number_of_results", + wagtail.blocks.IntegerBlock( + default=12, + help_text="Pick up to 48 profiles.", + max_value=48, + min_value=1, + required=True, + ), + ), + ( + "advanced_filter_header", + wagtail.blocks.static_block.StaticBlock( + admin_text="-------- ADVANCED FILTERS: OPTIONS TO DISPLAY FEWER, MORE TARGETED RESULTS. --------", + label=" ", + ), + ), + ( + "profile_type", + wagtail.blocks.CharBlock(default="", help_text="Example: Fellow.", required=False), + ), + ( + "program_type", + wagtail.blocks.CharBlock( + default="", help_text="Example: Tech Policy.", required=False + ), + ), + ("year", wagtail.blocks.CharBlock(default="", required=False)), + ] + ), + ), + ( + "profile_by_id", + wagtail.blocks.StructBlock( + [ + ( + "ids", + wagtail.blocks.CharBlock( + help_text="Show profiles for pulse users with specific profile ids (mozillapulse.org/profile/[##]). For multiple profiles, specify a comma separated list (e.g. 85,105,332).", + label="Profile by ID", + ), + ) + ] + ), + ), + ( + "profile_directory", + wagtail.blocks.StructBlock( + [ + ( + "max_number_of_results", + wagtail.blocks.IntegerBlock( + default=12, + help_text="Pick up to 48 profiles.", + max_value=48, + min_value=1, + required=True, + ), + ), + ( + "advanced_filter_header", + wagtail.blocks.static_block.StaticBlock( + admin_text="-------- ADVANCED FILTERS: OPTIONS TO DISPLAY FEWER, MORE TARGETED RESULTS. --------", + label=" ", + ), + ), + ( + "profile_type", + wagtail.blocks.CharBlock(default="", help_text="Example: Fellow.", required=False), + ), + ( + "program_type", + wagtail.blocks.CharBlock( + default="", help_text="Example: Tech Policy.", required=False + ), + ), + ("year", wagtail.blocks.CharBlock(default="", required=False)), + ( + "filter_values", + wagtail.blocks.CharBlock( + default="2019,2018,2017,2016,2015,2014,2013", + help_text="Example: 2019,2018,2017,2016,2015,2014,2013", + required=True, + ), + ), + ] + ), + ), + ( + "recent_blog_entries", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock(required=False)), + ( + "tag_filter", + wagtail.blocks.CharBlock( + help_text="Test this filter at foundation.mozilla.org/blog/tags/", + label="Filter by Tag", + required=False, + ), + ), + ( + "topic_filter", + wagtail.blocks.ChoiceBlock( + choices=networkapi.wagtailpages.pagemodels.blog.blog_topic.BlogPageTopic.get_topics, + help_text="Test this filter at foundation.mozilla.org/blog/topic/", + label="Filter by Topic", + required=False, + ), + ), + ( + "top_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider above content block.", required=False + ), + ), + ( + "bottom_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider below content block.", required=False + ), + ), + ] + ), + ), + ( + "blog_set", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock()), + ( + "top_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider above content block.", required=False + ), + ), + ( + "bottom_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider below content block.", required=False + ), + ), + ( + "blog_pages", + wagtail.blocks.ListBlock( + wagtail.blocks.PageChooserBlock(page_type=["wagtailpages.BlogPage"]) + ), + ), + ] + ), + ), + ( + "airtable", + wagtail.blocks.StructBlock( + [ + ( + "url", + wagtail.blocks.URLBlock( + help_text="Copied from the Airtable embed code. The word 'embed' will be in the url" + ), + ), + ( + "height", + wagtail.blocks.IntegerBlock( + default=533, + help_text="The pixel height on desktop view, usually copied from the Airtable embed code", + ), + ), + ] + ), + ), + ( + "typeform", + wagtail.blocks.StructBlock( + [ + ( + "embed_id", + wagtail.blocks.CharBlock( + help_text="The embed id of your Typeform page (e.g. if the form is on admin.typeform.com/form/e8zScc6t, the id will be: e8zScc6t)", + required=True, + ), + ), + ( + "button_type", + wagtail.blocks.ChoiceBlock( + choices=[ + ("btn-primary", "Primary button"), + ("btn-secondary", "Secondary button"), + ] + ), + ), + ( + "button_text", + wagtail.blocks.CharBlock( + help_text="This is a text prompt for users to open the typeform content", + required=True, + ), + ), + ] + ), + ), + ( + "datawrapper", + wagtail.embeds.blocks.EmbedBlock( + help_text='Enter the "visualization only" link of the Datawrapper chart. It looks something like this: https://datawrapper.dwcdn.net/KwSKp/1/', + icon="image", + template="wagtailpages/blocks/datawrapper_block.html", + ), + ), + ( + "listing", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock(help_text="Heading for the block.", required=False), + ), + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Alt text for card's image.", required=False + ), + ), + ("title", wagtail.blocks.CharBlock(help_text="Heading for the card.")), + ( + "highlighted_metadata", + wagtail.blocks.CharBlock( + help_text="Metadata to highlight on the card.", required=False + ), + ), + ( + "metadata", + wagtail.blocks.CharBlock( + help_text="Generic metadata.", required=False + ), + ), + ( + "body", + wagtail.blocks.RichTextBlock( + features=["bold"], + help_text="Body text of the card.", + required=False, + ), + ), + ( + "link_page", + wagtail.blocks.PageChooserBlock( + help_text="Page that this should link out to.", required=False + ), + ), + ( + "link_url", + wagtail.blocks.CharBlock( + help_text="Optional URL that the header should link out to.", + required=False, + ), + ), + ] + ), + help_text="Please use a minimum of 2 cards.", + min_num=2, + ), + ), + ( + "cards_per_row", + wagtail.blocks.ChoiceBlock( + choices=[(2, "2"), (3, "3")], + help_text="Number of cards per row. Note: this is a max and fewer might be used if is less space is available.", + required=False, + ), + ), + ] + ), + ), + ( + "profiles", + wagtail.blocks.StructBlock( + [ + ( + "profiles", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "profile", + wagtail.snippets.blocks.SnippetChooserBlock( + networkapi.wagtailpages.pagemodels.profiles.Profile + ), + ) + ] + ), + min_num=1, + ), + ) + ] + ), + ), + ( + "article_teaser_block", + wagtail.blocks.StructBlock( + [ + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "article", + wagtail.blocks.PageChooserBlock( + help_text="Page that this should link out to.", + page_type=["wagtailpages.ArticlePage"], + required=False, + ), + ) + ] + ), + help_text="Please use a minimum of 3 cards.", + min_num=3, + ), + ) + ] + ), + ), + ( + "group_listing_block", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + help_text="Heading for the group of cards.", required=False + ), + ), + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Alt text for card's image.", required=False + ), + ), + ( + "meta_data", + wagtail.blocks.CharBlock( + help_text="Optional meta data information for the card.", + required=False, + ), + ), + ("title", wagtail.blocks.CharBlock(help_text="Heading for the card.")), + ( + "body", + wagtail.blocks.RichTextBlock( + features=["bold", "link"], help_text="Body text of the card." + ), + ), + ( + "link", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock( + label="Page", required=False + ), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", required=False + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False + ), + ), + ] + ), + help_text="Optional link that this card should link to.", + max_num=1, + min_num=0, + ), + ), + ] + ) + ), + ), + ] + ), + ), + ( + "image_feature", + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "alt_text", + wagtail.blocks.CharBlock(help_text="Image description (for screen readers)."), + ), + ("metadata", wagtail.blocks.CharBlock(required=False)), + ("title", wagtail.blocks.CharBlock(help_text="Heading for the card.")), + ( + "title_link", + wagtail.blocks.PageChooserBlock( + help_text="Page that the title should link out to.", required=False + ), + ), + ("body", wagtail.blocks.CharBlock(required=False)), + ] + ), + ), + ( + "image_teaser_block", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock(help_text="Heading for the card.")), + ("text", wagtail.blocks.RichTextBlock(features=["bold"])), + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "altText", + wagtail.blocks.CharBlock( + help_text="Image description (for screen readers).", required=True + ), + ), + ( + "link_button", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("label", wagtail.blocks.CharBlock()), + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock(label="Page", required=False), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", required=False + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False + ), + ), + ( + "styling", + wagtail.blocks.ChoiceBlock( + choices=[ + ("btn-primary", "Primary button"), + ("btn-secondary", "Secondary button"), + ] + ), + ), + ] + ), + help_text="Optional link button", + max_num=1, + min_num=0, + ), + ), + ( + "top_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider above content block.", required=False + ), + ), + ( + "bottom_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider below content block.", required=False + ), + ), + ] + ), + ), + ( + "text_only_teaser", + wagtail.blocks.StructBlock( + [ + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock(help_text="Heading for the card."), + ), + ( + "link_page", + wagtail.blocks.PageChooserBlock( + help_text="Page that the header should link out to.", + required=False, + ), + ), + ( + "link_url", + wagtail.blocks.CharBlock( + help_text="Optional URL that the header should link out to.", + required=False, + ), + ), + ("meta_data", wagtail.blocks.CharBlock(max_length=500)), + ( + "body", + wagtail.blocks.TextBlock( + help_text="Body text of the card.", + max_length=200, + required=False, + ), + ), + ] + ), + help_text="Please use a minimum of 3 cards.", + min_num=3, + ), + ) + ] + ), + ), + ( + "block_with_aside", + wagtail.blocks.StructBlock( + [ + ( + "content", + wagtail.blocks.StreamBlock( + [ + ( + "listing", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + help_text="Heading for the block.", required=False + ), + ), + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "image", + wagtail.images.blocks.ImageChooserBlock(), + ), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Alt text for card's image.", + required=False, + ), + ), + ( + "title", + wagtail.blocks.CharBlock( + help_text="Heading for the card." + ), + ), + ( + "highlighted_metadata", + wagtail.blocks.CharBlock( + help_text="Metadata to highlight on the card.", + required=False, + ), + ), + ( + "metadata", + wagtail.blocks.CharBlock( + help_text="Generic metadata.", + required=False, + ), + ), + ( + "body", + wagtail.blocks.RichTextBlock( + features=["bold"], + help_text="Body text of the card.", + required=False, + ), + ), + ( + "link_page", + wagtail.blocks.PageChooserBlock( + help_text="Page that this should link out to.", + required=False, + ), + ), + ( + "link_url", + wagtail.blocks.CharBlock( + help_text="Optional URL that the header should link out to.", + required=False, + ), + ), + ] + ), + help_text="Please use a minimum of 2 cards.", + min_num=2, + ), + ), + ( + "cards_per_row", + wagtail.blocks.ChoiceBlock( + choices=[(2, "2"), (3, "3")], + help_text="Number of cards per row. Note: this is a max and fewer might be used if is less space is available.", + required=False, + ), + ), + ] + ), + ), + ( + "paragraph", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "h2", + "h3", + "h4", + "h5", + "ol", + "ul", + "hr", + "document-link", + ] + ), + ), + ], + help_text="The wider block that appears on the left on desktop", + icon="doc-full", + max_num=1, + ), + ), + ( + "aside", + wagtail.blocks.StreamBlock( + [ + ( + "aside_content", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + help_text="Heading for the card.", required=False + ), + ), + ( + "body", + wagtail.blocks.TextBlock( + help_text="Body text of the card.", required=False + ), + ), + ] + ), + ), + ( + "linkbutton", + wagtail.blocks.StructBlock( + [ + ("label", wagtail.blocks.CharBlock()), + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock( + label="Page", required=False + ), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", required=False + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False + ), + ), + ( + "styling", + wagtail.blocks.ChoiceBlock( + choices=[ + ("btn-primary", "Primary button"), + ("btn-secondary", "Secondary button"), + ] + ), + ), + ] + ), + ), + ( + "spacer", + wagtail.blocks.StructBlock( + [ + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("1", "quarter spacing"), + ("2", "half spacing"), + ("3", "single spacing"), + ("4", "one and a half spacing"), + ("5", "triple spacing"), + ] + ), + ) + ] + ), + ), + ], + help_text="Elements here will appear in the column on the right side of the page on desktop. This can be left blank if you would just like a 2/3 column on the left", + icon="doc-full", + required=False, + ), + ), + ] + ), + ), + ( + "accordion", + wagtail.blocks.StructBlock( + [ + ( + "accordion_items", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + help_text="Heading for the Accordion Item" + ), + ), + ( + "content", + wagtail.blocks.StreamBlock( + [ + ( + "rich_text", + wagtail.blocks.RichTextBlock( + blank=True, + features=[ + "bold", + "italic", + "link", + "ul", + "ol", + "document-link", + ], + ), + ), + ( + "datawrapper", + wagtail.embeds.blocks.EmbedBlock( + help_text='Enter the "visualization only" link of the Datawrapper chart. It looks something like this: https://datawrapper.dwcdn.net/KwSKp/1/', + icon="image", + template="wagtailpages/blocks/datawrapper_block.html", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "image", + wagtail.images.blocks.ImageChooserBlock(), + ), + ( + "altText", + wagtail.blocks.CharBlock( + help_text="Image description (for screen readers).", + required=True, + ), + ), + ] + ), + ), + ( + "video", + wagtail.blocks.StructBlock( + [ + ( + "url", + wagtail.blocks.URLBlock( + help_text="For YouTube: go to your YouTube video and click “Share,” then “Embed,” and then copy and paste the provided URL only. For example: https://www.youtube.com/embed/3FIVXBawyQw For Vimeo: follow similar steps to grab the embed URL. For example: https://player.vimeo.com/video/9004979", + label="Embed URL", + ), + ), + ( + "caption", + wagtail.blocks.CharBlock(required=False), + ), + ( + "caption_url", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ( + "external_url", + "External URL", + ), + ( + "relative_url", + "Relative URL", + ), + ("email", "Email"), + ( + "anchor", + "Anchor", + ), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock( + label="Page", + required=False, + ), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ( + "email", + wagtail.blocks.EmailBlock( + required=False + ), + ), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", + required=False, + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", + max_length=30, + required=False, + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", + required=False, + ), + ), + ] + ), + help_text="Optional URL that this caption should link out to.", + max_num=1, + min_num=0, + ), + ), + ( + "video_width", + wagtail.blocks.ChoiceBlock( + choices=[ + ("normal", "Normal"), + ("wide", "Wide"), + ("full_width", "Full Width"), + ], + help_text="Wide videos are col-12, Full-Width videos reach both ends of the screen.", + ), + ), + ] + ), + ), + ] + ), + ), + ] + ) + ), + ) + ] + ), + ), + ], + use_json_field=True, + ), + ), + migrations.AlterField( + model_name="primarypage", + name="body", + field=wagtail.fields.StreamField( + [ + ( + "paragraph", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "h2", + "h3", + "h4", + "h5", + "ol", + "ul", + "hr", + "document-link", + "large", + ], + template="wagtailpages/blocks/rich_text_block.html", + ), + ), + ( + "card_grid", + wagtail.blocks.StructBlock( + [ + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Alt text for card's image.", required=False + ), + ), + ("title", wagtail.blocks.CharBlock(help_text="Heading for the card.")), + ("body", wagtail.blocks.TextBlock(help_text="Body text of the card.")), + ( + "link_url", + wagtail.blocks.CharBlock( + help_text="Optional URL that this card should link out to. (Note: If left blank, link will not render.) ", + required=False, + ), + ), + ( + "link_label", + wagtail.blocks.CharBlock( + help_text="Optional Label for the URL link above. (Note: If left blank, link will not render.) ", + required=False, + ), + ), + ] + ), + help_text="Please use a minimum of 2 cards.", + ), + ) + ] + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "altText", + wagtail.blocks.CharBlock( + help_text="Image description (for screen readers).", required=True + ), + ), + ("caption", wagtail.blocks.CharBlock(required=False)), + ( + "caption_url", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock(label="Page", required=False), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", required=False + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False + ), + ), + ] + ), + help_text="Optional URL that this caption should link out to.", + max_num=1, + min_num=0, + ), + ), + ( + "image_width", + wagtail.blocks.ChoiceBlock( + choices=[("normal", "Normal"), ("wide", "Wide"), ("full_width", "Full Width")], + help_text="Wide images are col-12, Full-Width Images reach both ends of the screen (16:6 images recommended for full width)", + ), + ), + ] + ), + ), + ( + "image_text", + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "altText", + wagtail.blocks.CharBlock( + help_text="Image description (for screen readers).", required=True + ), + ), + ( + "text", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "h2", + "h3", + "h4", + "h5", + "ol", + "ul", + "hr", + "document-link", + ] + ), + ), + ( + "url", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock(label="Page", required=False), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", required=False + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False + ), + ), + ] + ), + help_text="Optional URL that this image should link out to.", + max_num=1, + min_num=0, + ), + ), + ( + "top_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider above content block.", required=False + ), + ), + ( + "bottom_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider below content block.", required=False + ), + ), + ] + ), + ), + ( + "image_text_mini", + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "altText", + wagtail.blocks.CharBlock( + help_text="Image description (for screen readers).", required=True + ), + ), + ("text", wagtail.blocks.RichTextBlock(features=["bold", "italic", "link"])), + ] + ), + ), + ( + "image_grid", + wagtail.blocks.StructBlock( + [ + ( + "grid_items", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Alt text for this image.", required=False + ), + ), + ( + "caption", + wagtail.blocks.CharBlock( + help_text="Please remember to properly attribute any images we use.", + required=False, + ), + ), + ( + "url", + wagtail.blocks.CharBlock( + help_text="Optional URL that this figure should link out to.", + required=False, + ), + ), + ( + "square_image", + wagtail.blocks.BooleanBlock( + default=True, + help_text="If left checked, the image will be cropped to be square.", + required=False, + ), + ), + ] + ) + ), + ) + ] + ), + ), + ( + "video", + wagtail.blocks.StructBlock( + [ + ( + "url", + wagtail.blocks.URLBlock( + help_text="For YouTube: go to your YouTube video and click “Share,” then “Embed,” and then copy and paste the provided URL only. For example: https://www.youtube.com/embed/3FIVXBawyQw For Vimeo: follow similar steps to grab the embed URL. For example: https://player.vimeo.com/video/9004979", + label="Embed URL", + ), + ), + ("caption", wagtail.blocks.CharBlock(required=False)), + ( + "caption_url", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock(label="Page", required=False), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", required=False + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False + ), + ), + ] + ), + help_text="Optional URL that this caption should link out to.", + max_num=1, + min_num=0, + ), + ), + ( + "video_width", + wagtail.blocks.ChoiceBlock( + choices=[("normal", "Normal"), ("wide", "Wide"), ("full_width", "Full Width")], + help_text="Wide videos are col-12, Full-Width videos reach both ends of the screen.", + ), + ), + ] + ), + ), + ( + "iframe", + wagtail.blocks.StructBlock( + [ + ( + "url", + wagtail.blocks.CharBlock( + help_text="Please note that only URLs from allow-listed domains will work." + ), + ), + ( + "height", + wagtail.blocks.IntegerBlock( + help_text="Optional integer pixel value for custom iFrame height", + required=False, + ), + ), + ("caption", wagtail.blocks.CharBlock(required=False)), + ( + "caption_url", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock(label="Page", required=False), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", required=False + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False + ), + ), + ] + ), + help_text="Optional URL that this caption should link out to.", + max_num=1, + min_num=0, + ), + ), + ( + "iframe_width", + wagtail.blocks.ChoiceBlock( + choices=[("normal", "Normal"), ("wide", "Wide"), ("full_width", "Full Width")], + help_text="Wide iframes are col-12, Full-Width iframes reach both ends of the screen", + ), + ), + ( + "disable_scroll", + wagtail.blocks.BooleanBlock( + default=False, + help_text='Checking this will add "scrolling=no" to the iframe. Use this if your iframe is rendering an unnecessary scroll bar or whitespace below it.', + required=False, + ), + ), + ] + ), + ), + ( + "linkbutton", + wagtail.blocks.StructBlock( + [ + ("label", wagtail.blocks.CharBlock()), + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ("page", wagtail.blocks.PageChooserBlock(label="Page", required=False)), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[networkapi.wagtailpages.validators.RelativeURLValidator()], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[networkapi.wagtailpages.validators.AnchorLinkValidator()], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ("file", wagtail.documents.blocks.DocumentChooserBlock(label="File", required=False)), + ("phone", wagtail.blocks.CharBlock(label="Phone", max_length=30, required=False)), + ( + "new_window", + wagtail.blocks.BooleanBlock(label="Open in new window", required=False), + ), + ( + "styling", + wagtail.blocks.ChoiceBlock( + choices=[ + ("btn-primary", "Primary button"), + ("btn-secondary", "Secondary button"), + ] + ), + ), + ] + ), + ), + ( + "spacer", + wagtail.blocks.StructBlock( + [ + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("1", "quarter spacing"), + ("2", "half spacing"), + ("3", "single spacing"), + ("4", "one and a half spacing"), + ("5", "triple spacing"), + ] + ), + ) + ] + ), + ), + ( + "single_quote", + wagtail.blocks.StructBlock( + [ + ("quote", wagtail.blocks.RichTextBlock(features=["bold"])), + ("attribution", wagtail.blocks.CharBlock(required=False)), + ( + "attribution_info", + wagtail.blocks.RichTextBlock(features=["bold", "link", "large"], required=False), + ), + ] + ), + ), + ( + "pulse_listing", + wagtail.blocks.StructBlock( + [ + ( + "search_terms", + wagtail.blocks.CharBlock( + help_text="Test your search at mozillapulse.org/search", + label="Search", + required=False, + ), + ), + ( + "max_number_of_results", + wagtail.blocks.IntegerBlock( + default=6, + help_text="Choose 1-12. If you want visitors to see more, link to a search or tag on Pulse.", + max_value=12, + min_value=0, + required=True, + ), + ), + ( + "only_featured_entries", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Featured items are selected by Pulse moderators.", + label="Display only featured entries", + required=False, + ), + ), + ( + "newest_first", + wagtail.blocks.ChoiceBlock( + choices=[ + ("True", "Show newer entries first"), + ("False", "Show older entries first"), + ], + label="Sort", + ), + ), + ( + "advanced_filter_header", + wagtail.blocks.static_block.StaticBlock( + admin_text="-------- ADVANCED FILTERS: OPTIONS TO DISPLAY FEWER, MORE TARGETED RESULTS. --------", + label=" ", + ), + ), + ( + "issues", + wagtail.blocks.ChoiceBlock( + choices=[ + ("all", "All"), + ("Decentralization", "Decentralization"), + ("Digital Inclusion", "Digital Inclusion"), + ("Online Privacy & Security", "Online Privacy & Security"), + ("Open Innovation", "Open Innovation"), + ("Web Literacy", "Web Literacy"), + ] + ), + ), + ( + "help", + wagtail.blocks.ChoiceBlock( + choices=[ + ("all", "All"), + ("Attend", "Attend"), + ("Create content", "Create content"), + ("Code", "Code"), + ("Design", "Design"), + ("Fundraise", "Fundraise"), + ("Join community", "Join community"), + ("Localize & translate", "Localize & translate"), + ("Mentor", "Mentor"), + ("Plan & organize", "Plan & organize"), + ("Promote", "Promote"), + ("Take action", "Take action"), + ("Test & feedback", "Test & feedback"), + ("Write documentation", "Write documentation"), + ], + label="Type of help needed", + ), + ), + ( + "direct_link", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Checked: user goes to project link. Unchecked: user goes to pulse entry", + label="Direct link", + required=False, + ), + ), + ] + ), + ), + ( + "profile_listing", + wagtail.blocks.StructBlock( + [ + ( + "max_number_of_results", + wagtail.blocks.IntegerBlock( + default=12, + help_text="Pick up to 48 profiles.", + max_value=48, + min_value=1, + required=True, + ), + ), + ( + "advanced_filter_header", + wagtail.blocks.static_block.StaticBlock( + admin_text="-------- ADVANCED FILTERS: OPTIONS TO DISPLAY FEWER, MORE TARGETED RESULTS. --------", + label=" ", + ), + ), + ( + "profile_type", + wagtail.blocks.CharBlock(default="", help_text="Example: Fellow.", required=False), + ), + ( + "program_type", + wagtail.blocks.CharBlock( + default="", help_text="Example: Tech Policy.", required=False + ), + ), + ("year", wagtail.blocks.CharBlock(default="", required=False)), + ] + ), + ), + ( + "profile_by_id", + wagtail.blocks.StructBlock( + [ + ( + "ids", + wagtail.blocks.CharBlock( + help_text="Show profiles for pulse users with specific profile ids (mozillapulse.org/profile/[##]). For multiple profiles, specify a comma separated list (e.g. 85,105,332).", + label="Profile by ID", + ), + ) + ] + ), + ), + ( + "profile_directory", + wagtail.blocks.StructBlock( + [ + ( + "max_number_of_results", + wagtail.blocks.IntegerBlock( + default=12, + help_text="Pick up to 48 profiles.", + max_value=48, + min_value=1, + required=True, + ), + ), + ( + "advanced_filter_header", + wagtail.blocks.static_block.StaticBlock( + admin_text="-------- ADVANCED FILTERS: OPTIONS TO DISPLAY FEWER, MORE TARGETED RESULTS. --------", + label=" ", + ), + ), + ( + "profile_type", + wagtail.blocks.CharBlock(default="", help_text="Example: Fellow.", required=False), + ), + ( + "program_type", + wagtail.blocks.CharBlock( + default="", help_text="Example: Tech Policy.", required=False + ), + ), + ("year", wagtail.blocks.CharBlock(default="", required=False)), + ( + "filter_values", + wagtail.blocks.CharBlock( + default="2019,2018,2017,2016,2015,2014,2013", + help_text="Example: 2019,2018,2017,2016,2015,2014,2013", + required=True, + ), + ), + ] + ), + ), + ( + "recent_blog_entries", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock(required=False)), + ( + "tag_filter", + wagtail.blocks.CharBlock( + help_text="Test this filter at foundation.mozilla.org/blog/tags/", + label="Filter by Tag", + required=False, + ), + ), + ( + "topic_filter", + wagtail.blocks.ChoiceBlock( + choices=networkapi.wagtailpages.pagemodels.blog.blog_topic.BlogPageTopic.get_topics, + help_text="Test this filter at foundation.mozilla.org/blog/topic/", + label="Filter by Topic", + required=False, + ), + ), + ( + "top_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider above content block.", required=False + ), + ), + ( + "bottom_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider below content block.", required=False + ), + ), + ] + ), + ), + ( + "blog_set", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock()), + ( + "top_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider above content block.", required=False + ), + ), + ( + "bottom_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider below content block.", required=False + ), + ), + ( + "blog_pages", + wagtail.blocks.ListBlock( + wagtail.blocks.PageChooserBlock(page_type=["wagtailpages.BlogPage"]) + ), + ), + ] + ), + ), + ( + "airtable", + wagtail.blocks.StructBlock( + [ + ( + "url", + wagtail.blocks.URLBlock( + help_text="Copied from the Airtable embed code. The word 'embed' will be in the url" + ), + ), + ( + "height", + wagtail.blocks.IntegerBlock( + default=533, + help_text="The pixel height on desktop view, usually copied from the Airtable embed code", + ), + ), + ] + ), + ), + ( + "typeform", + wagtail.blocks.StructBlock( + [ + ( + "embed_id", + wagtail.blocks.CharBlock( + help_text="The embed id of your Typeform page (e.g. if the form is on admin.typeform.com/form/e8zScc6t, the id will be: e8zScc6t)", + required=True, + ), + ), + ( + "button_type", + wagtail.blocks.ChoiceBlock( + choices=[ + ("btn-primary", "Primary button"), + ("btn-secondary", "Secondary button"), + ] + ), + ), + ( + "button_text", + wagtail.blocks.CharBlock( + help_text="This is a text prompt for users to open the typeform content", + required=True, + ), + ), + ] + ), + ), + ( + "datawrapper", + wagtail.embeds.blocks.EmbedBlock( + help_text='Enter the "visualization only" link of the Datawrapper chart. It looks something like this: https://datawrapper.dwcdn.net/KwSKp/1/', + icon="image", + template="wagtailpages/blocks/datawrapper_block.html", + ), + ), + ( + "listing", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock(help_text="Heading for the block.", required=False), + ), + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Alt text for card's image.", required=False + ), + ), + ("title", wagtail.blocks.CharBlock(help_text="Heading for the card.")), + ( + "highlighted_metadata", + wagtail.blocks.CharBlock( + help_text="Metadata to highlight on the card.", required=False + ), + ), + ( + "metadata", + wagtail.blocks.CharBlock( + help_text="Generic metadata.", required=False + ), + ), + ( + "body", + wagtail.blocks.RichTextBlock( + features=["bold"], + help_text="Body text of the card.", + required=False, + ), + ), + ( + "link_page", + wagtail.blocks.PageChooserBlock( + help_text="Page that this should link out to.", required=False + ), + ), + ( + "link_url", + wagtail.blocks.CharBlock( + help_text="Optional URL that the header should link out to.", + required=False, + ), + ), + ] + ), + help_text="Please use a minimum of 2 cards.", + min_num=2, + ), + ), + ( + "cards_per_row", + wagtail.blocks.ChoiceBlock( + choices=[(2, "2"), (3, "3")], + help_text="Number of cards per row. Note: this is a max and fewer might be used if is less space is available.", + required=False, + ), + ), + ] + ), + ), + ( + "profiles", + wagtail.blocks.StructBlock( + [ + ( + "profiles", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "profile", + wagtail.snippets.blocks.SnippetChooserBlock( + networkapi.wagtailpages.pagemodels.profiles.Profile + ), + ) + ] + ), + min_num=1, + ), + ) + ] + ), + ), + ( + "article_teaser_block", + wagtail.blocks.StructBlock( + [ + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "article", + wagtail.blocks.PageChooserBlock( + help_text="Page that this should link out to.", + page_type=["wagtailpages.ArticlePage"], + required=False, + ), + ) + ] + ), + help_text="Please use a minimum of 3 cards.", + min_num=3, + ), + ) + ] + ), + ), + ( + "group_listing_block", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + help_text="Heading for the group of cards.", required=False + ), + ), + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Alt text for card's image.", required=False + ), + ), + ( + "meta_data", + wagtail.blocks.CharBlock( + help_text="Optional meta data information for the card.", + required=False, + ), + ), + ("title", wagtail.blocks.CharBlock(help_text="Heading for the card.")), + ( + "body", + wagtail.blocks.RichTextBlock( + features=["bold", "link"], help_text="Body text of the card." + ), + ), + ( + "link", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock( + label="Page", required=False + ), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", required=False + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False + ), + ), + ] + ), + help_text="Optional link that this card should link to.", + max_num=1, + min_num=0, + ), + ), + ] + ) + ), + ), + ] + ), + ), + ( + "image_feature", + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "alt_text", + wagtail.blocks.CharBlock(help_text="Image description (for screen readers)."), + ), + ("metadata", wagtail.blocks.CharBlock(required=False)), + ("title", wagtail.blocks.CharBlock(help_text="Heading for the card.")), + ( + "title_link", + wagtail.blocks.PageChooserBlock( + help_text="Page that the title should link out to.", required=False + ), + ), + ("body", wagtail.blocks.CharBlock(required=False)), + ] + ), + ), + ( + "image_teaser_block", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock(help_text="Heading for the card.")), + ("text", wagtail.blocks.RichTextBlock(features=["bold"])), + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "altText", + wagtail.blocks.CharBlock( + help_text="Image description (for screen readers).", required=True + ), + ), + ( + "link_button", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("label", wagtail.blocks.CharBlock()), + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock(label="Page", required=False), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", required=False + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False + ), + ), + ( + "styling", + wagtail.blocks.ChoiceBlock( + choices=[ + ("btn-primary", "Primary button"), + ("btn-secondary", "Secondary button"), + ] + ), + ), + ] + ), + help_text="Optional link button", + max_num=1, + min_num=0, + ), + ), + ( + "top_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider above content block.", required=False + ), + ), + ( + "bottom_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider below content block.", required=False + ), + ), + ] + ), + ), + ( + "text_only_teaser", + wagtail.blocks.StructBlock( + [ + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock(help_text="Heading for the card."), + ), + ( + "link_page", + wagtail.blocks.PageChooserBlock( + help_text="Page that the header should link out to.", + required=False, + ), + ), + ( + "link_url", + wagtail.blocks.CharBlock( + help_text="Optional URL that the header should link out to.", + required=False, + ), + ), + ("meta_data", wagtail.blocks.CharBlock(max_length=500)), + ( + "body", + wagtail.blocks.TextBlock( + help_text="Body text of the card.", + max_length=200, + required=False, + ), + ), + ] + ), + help_text="Please use a minimum of 3 cards.", + min_num=3, + ), + ) + ] + ), + ), + ( + "block_with_aside", + wagtail.blocks.StructBlock( + [ + ( + "content", + wagtail.blocks.StreamBlock( + [ + ( + "listing", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + help_text="Heading for the block.", required=False + ), + ), + ( + "cards", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "image", + wagtail.images.blocks.ImageChooserBlock(), + ), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Alt text for card's image.", + required=False, + ), + ), + ( + "title", + wagtail.blocks.CharBlock( + help_text="Heading for the card." + ), + ), + ( + "highlighted_metadata", + wagtail.blocks.CharBlock( + help_text="Metadata to highlight on the card.", + required=False, + ), + ), + ( + "metadata", + wagtail.blocks.CharBlock( + help_text="Generic metadata.", + required=False, + ), + ), + ( + "body", + wagtail.blocks.RichTextBlock( + features=["bold"], + help_text="Body text of the card.", + required=False, + ), + ), + ( + "link_page", + wagtail.blocks.PageChooserBlock( + help_text="Page that this should link out to.", + required=False, + ), + ), + ( + "link_url", + wagtail.blocks.CharBlock( + help_text="Optional URL that the header should link out to.", + required=False, + ), + ), + ] + ), + help_text="Please use a minimum of 2 cards.", + min_num=2, + ), + ), + ( + "cards_per_row", + wagtail.blocks.ChoiceBlock( + choices=[(2, "2"), (3, "3")], + help_text="Number of cards per row. Note: this is a max and fewer might be used if is less space is available.", + required=False, + ), + ), + ] + ), + ), + ( + "paragraph", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "h2", + "h3", + "h4", + "h5", + "ol", + "ul", + "hr", + "document-link", + ] + ), + ), + ], + help_text="The wider block that appears on the left on desktop", + icon="doc-full", + max_num=1, + ), + ), + ( + "aside", + wagtail.blocks.StreamBlock( + [ + ( + "aside_content", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + help_text="Heading for the card.", required=False + ), + ), + ( + "body", + wagtail.blocks.TextBlock( + help_text="Body text of the card.", required=False + ), + ), + ] + ), + ), + ( + "linkbutton", + wagtail.blocks.StructBlock( + [ + ("label", wagtail.blocks.CharBlock()), + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ("external_url", "External URL"), + ("relative_url", "Relative URL"), + ("email", "Email"), + ("anchor", "Anchor"), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock( + label="Page", required=False + ), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ("email", wagtail.blocks.EmailBlock(required=False)), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", required=False + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False + ), + ), + ( + "styling", + wagtail.blocks.ChoiceBlock( + choices=[ + ("btn-primary", "Primary button"), + ("btn-secondary", "Secondary button"), + ] + ), + ), + ] + ), + ), + ( + "spacer", + wagtail.blocks.StructBlock( + [ + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("1", "quarter spacing"), + ("2", "half spacing"), + ("3", "single spacing"), + ("4", "one and a half spacing"), + ("5", "triple spacing"), + ] + ), + ) + ] + ), + ), + ], + help_text="Elements here will appear in the column on the right side of the page on desktop. This can be left blank if you would just like a 2/3 column on the left", + icon="doc-full", + required=False, + ), + ), + ] + ), + ), + ( + "accordion", + wagtail.blocks.StructBlock( + [ + ( + "accordion_items", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + help_text="Heading for the Accordion Item" + ), + ), + ( + "content", + wagtail.blocks.StreamBlock( + [ + ( + "rich_text", + wagtail.blocks.RichTextBlock( + blank=True, + features=[ + "bold", + "italic", + "link", + "ul", + "ol", + "document-link", + ], + ), + ), + ( + "datawrapper", + wagtail.embeds.blocks.EmbedBlock( + help_text='Enter the "visualization only" link of the Datawrapper chart. It looks something like this: https://datawrapper.dwcdn.net/KwSKp/1/', + icon="image", + template="wagtailpages/blocks/datawrapper_block.html", + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "image", + wagtail.images.blocks.ImageChooserBlock(), + ), + ( + "altText", + wagtail.blocks.CharBlock( + help_text="Image description (for screen readers).", + required=True, + ), + ), + ] + ), + ), + ( + "video", + wagtail.blocks.StructBlock( + [ + ( + "url", + wagtail.blocks.URLBlock( + help_text="For YouTube: go to your YouTube video and click “Share,” then “Embed,” and then copy and paste the provided URL only. For example: https://www.youtube.com/embed/3FIVXBawyQw For Vimeo: follow similar steps to grab the embed URL. For example: https://player.vimeo.com/video/9004979", + label="Embed URL", + ), + ), + ( + "caption", + wagtail.blocks.CharBlock(required=False), + ), + ( + "caption_url", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "link_to", + wagtail.blocks.ChoiceBlock( + choices=[ + ("page", "Page"), + ( + "external_url", + "External URL", + ), + ( + "relative_url", + "Relative URL", + ), + ("email", "Email"), + ( + "anchor", + "Anchor", + ), + ("file", "File"), + ("phone", "Phone"), + ], + label="Link to", + ), + ), + ( + "page", + wagtail.blocks.PageChooserBlock( + label="Page", + required=False, + ), + ), + ( + "external_url", + wagtail.blocks.URLBlock( + help_text="Enter a full URL including http:// or https://", + label="External URL", + max_length=300, + required=False, + ), + ), + ( + "relative_url", + wagtail.blocks.CharBlock( + help_text='A path relative to this domain. For example, "/foo/bar"', + label="Relative URL", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.RelativeURLValidator() + ], + ), + ), + ( + "anchor", + wagtail.blocks.CharBlock( + help_text='An id attribute of an element on the current page. For example, "#section-1"', + label="#", + max_length=300, + required=False, + validators=[ + networkapi.wagtailpages.validators.AnchorLinkValidator() + ], + ), + ), + ( + "email", + wagtail.blocks.EmailBlock( + required=False + ), + ), + ( + "file", + wagtail.documents.blocks.DocumentChooserBlock( + label="File", + required=False, + ), + ), + ( + "phone", + wagtail.blocks.CharBlock( + label="Phone", + max_length=30, + required=False, + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", + required=False, + ), + ), + ] + ), + help_text="Optional URL that this caption should link out to.", + max_num=1, + min_num=0, + ), + ), + ( + "video_width", + wagtail.blocks.ChoiceBlock( + choices=[ + ("normal", "Normal"), + ("wide", "Wide"), + ("full_width", "Full Width"), + ], + help_text="Wide videos are col-12, Full-Width videos reach both ends of the screen.", + ), + ), + ] + ), + ), + ] + ), + ), + ] + ) + ), + ) + ] + ), + ), + ], + use_json_field=True, + ), + ), + ] diff --git a/network-api/networkapi/wagtailpages/pagemodels/customblocks/group_listing.py b/network-api/networkapi/wagtailpages/pagemodels/customblocks/group_listing.py index 9e602aa5caf..b1f5e110c29 100644 --- a/network-api/networkapi/wagtailpages/pagemodels/customblocks/group_listing.py +++ b/network-api/networkapi/wagtailpages/pagemodels/customblocks/group_listing.py @@ -1,6 +1,10 @@ from wagtail import blocks from wagtail.images.blocks import ImageChooserBlock +from networkapi.wagtailpages.pagemodels.customblocks.link_block import ( + LinkWithoutLabelBlock, +) + class GroupListingCard(blocks.StructBlock): image = ImageChooserBlock() @@ -12,7 +16,10 @@ class GroupListingCard(blocks.StructBlock): title = blocks.CharBlock(help_text="Heading for the card.") body = blocks.RichTextBlock(features=["bold", "link"], help_text="Body text of the card.") - url = blocks.CharBlock(required=False, help_text="The URL this card should link to.") + + link = blocks.ListBlock( + LinkWithoutLabelBlock(), min_num=0, max_num=1, help_text="Optional link that this card should link to." + ) class GroupListingBlock(blocks.StructBlock): diff --git a/network-api/networkapi/wagtailpages/templates/wagtailpages/blocks/group_listing_block.html b/network-api/networkapi/wagtailpages/templates/wagtailpages/blocks/group_listing_block.html index ee36cc5384a..b120f6782ac 100644 --- a/network-api/networkapi/wagtailpages/templates/wagtailpages/blocks/group_listing_block.html +++ b/network-api/networkapi/wagtailpages/templates/wagtailpages/blocks/group_listing_block.html @@ -14,24 +14,28 @@

{{ self.ti {% image card.image fill-690x388 as img %}
{{ card.meta_data }} - {% if card.url %} - + {% if card.link %} + {% with link=card.link.0 %} + + {% endwith %} {% endif %}

{{ card.title }}

- {% if card.url %} + {% if card.link %}
{% endif %} {# Adjust font sizes of rich text elements using [&_p,li,ul] to select them #}