From 0dcf887107b1bdb7396812603762e558cd0b7761 Mon Sep 17 00:00:00 2001 From: danielfmiranda Date: Wed, 12 Jun 2024 14:16:35 -0700 Subject: [PATCH 01/11] introduction of LinkBlockWithoutLabel class --- .../wagtailpages/pagemodels/customblocks/link_block.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/network-api/networkapi/wagtailpages/pagemodels/customblocks/link_block.py b/network-api/networkapi/wagtailpages/pagemodels/customblocks/link_block.py index b661520635d..be91896b50a 100644 --- a/network-api/networkapi/wagtailpages/pagemodels/customblocks/link_block.py +++ b/network-api/networkapi/wagtailpages/pagemodels/customblocks/link_block.py @@ -66,3 +66,13 @@ class Meta: register(BaseLinkBlockAdapter(), LinkBlock) + + +class LinkBlockWithoutLabel(LinkBlock): + def __init__(self, local_blocks=None, **kwargs): + super().__init__(local_blocks, **kwargs) + self.child_blocks = self.base_blocks.copy() + self.child_blocks.pop("label") + + +register(BaseLinkBlockAdapter(), LinkBlockWithoutLabel) \ No newline at end of file From 35e7ed875ca396885378919e597e81566d1db6e1 Mon Sep 17 00:00:00 2001 From: danielfmiranda Date: Wed, 12 Jun 2024 15:32:30 -0700 Subject: [PATCH 02/11] add new caption_url linkblock field + migrations + newline --- .../0012_alter_donatehelppage_body.py | 1431 ++++ .../0052_alter_mozfestprimarypage_body.py | 1897 ++++++ .../0138_alter_blogpage_body_and_more.py | 5749 +++++++++++++++++ .../customblocks/annotated_image_block.py | 4 + .../pagemodels/customblocks/link_block.py | 2 +- 5 files changed, 9082 insertions(+), 1 deletion(-) create mode 100644 network-api/networkapi/donate/migrations/0012_alter_donatehelppage_body.py create mode 100644 network-api/networkapi/mozfest/migrations/0052_alter_mozfestprimarypage_body.py create mode 100644 network-api/networkapi/wagtailpages/migrations/0138_alter_blogpage_body_and_more.py diff --git a/network-api/networkapi/donate/migrations/0012_alter_donatehelppage_body.py b/network-api/networkapi/donate/migrations/0012_alter_donatehelppage_body.py new file mode 100644 index 00000000000..248b43d3e83 --- /dev/null +++ b/network-api/networkapi/donate/migrations/0012_alter_donatehelppage_body.py @@ -0,0 +1,1431 @@ +# Generated by Django 4.2.11 on 2024-06-12 21:42 + +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 + +import networkapi.wagtailpages.pagemodels.blog.blog_topic +import networkapi.wagtailpages.pagemodels.profiles +import networkapi.wagtailpages.validators + + +class Migration(migrations.Migration): + + dependencies = [ + ("donate", "0011_update_donatehelppage_notice"), + ] + + 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)), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL that this caption should link out to.", 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.CharBlock( + help_text="Optional URL that this image should link out to.", 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 + ), + ), + ] + ), + ), + ( + "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.CharBlock( + 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)), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL for caption to link to.", required=False + ), + ), + ( + "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)), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL that this caption should link out to.", required=False + ), + ), + ( + "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 + ), + ), + ] + ) + ), + ), + ] + ), + ), + ( + "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 + ), + ), + ("url_label", wagtail.blocks.CharBlock(required=False)), + ("url", wagtail.blocks.CharBlock(required=False)), + ( + "styling", + wagtail.blocks.ChoiceBlock( + choices=[ + ("btn-primary", "Primary button"), + ("btn-secondary", "Secondary button"), + ] + ), + ), + ( + "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.CharBlock( + 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), + ), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL for caption to link to.", + required=False, + ), + ), + ( + "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/0052_alter_mozfestprimarypage_body.py b/network-api/networkapi/mozfest/migrations/0052_alter_mozfestprimarypage_body.py new file mode 100644 index 00000000000..86565bd9381 --- /dev/null +++ b/network-api/networkapi/mozfest/migrations/0052_alter_mozfestprimarypage_body.py @@ -0,0 +1,1897 @@ +# Generated by Django 4.2.11 on 2024-06-12 21:42 + +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 + +import networkapi.wagtailpages.pagemodels.blog.blog_topic +import networkapi.wagtailpages.pagemodels.profiles +import networkapi.wagtailpages.validators + + +class Migration(migrations.Migration): + + dependencies = [ + ("mozfest", "0051_alter_mozfestprimarypage_body"), + ] + + 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)), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL that this caption should link out to.", 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.CharBlock( + help_text="Optional URL that this image should link out to.", 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 + ), + ), + ] + ), + ), + ( + "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.CharBlock( + 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)), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL for caption to link to.", required=False + ), + ), + ( + "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)), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL that this caption should link out to.", required=False + ), + ), + ( + "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 + ), + ), + ] + ) + ), + ), + ] + ), + ), + ( + "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 + ), + ), + ("url_label", wagtail.blocks.CharBlock(required=False)), + ("url", wagtail.blocks.CharBlock(required=False)), + ( + "styling", + wagtail.blocks.ChoiceBlock( + choices=[ + ("btn-primary", "Primary button"), + ("btn-secondary", "Secondary button"), + ] + ), + ), + ( + "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.CharBlock( + 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), + ), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL for caption to link to.", + required=False, + ), + ), + ( + "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/0138_alter_blogpage_body_and_more.py b/network-api/networkapi/wagtailpages/migrations/0138_alter_blogpage_body_and_more.py new file mode 100644 index 00000000000..58a84289cb2 --- /dev/null +++ b/network-api/networkapi/wagtailpages/migrations/0138_alter_blogpage_body_and_more.py @@ -0,0 +1,5749 @@ +# Generated by Django 4.2.11 on 2024-06-12 21:42 + +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 + +import networkapi.wagtailpages.pagemodels.blog.blog_topic +import networkapi.wagtailpages.pagemodels.profiles +import networkapi.wagtailpages.validators + + +class Migration(migrations.Migration): + + dependencies = [ + ("wagtailpages", "0137_blogsignup_privacy_notice_cta_privacy_notice"), + ] + + operations = [ + migrations.AlterField( + model_name="blogpage", + name="body", + field=wagtail.fields.StreamField( + [ + ( + "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.CharBlock( + 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), + ), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL for caption to link to.", + required=False, + ), + ), + ( + "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.", + ), + ), + ] + ), + ), + ] + ), + ), + ] + ) + ), + ) + ] + ), + ), + ( + "paragraph", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "h2", + "h3", + "h4", + "h5", + "ol", + "ul", + "hr", + "document-link", + ], + 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.", + ), + ) + ] + ), + ), + ( + "CTA_card", + wagtail.blocks.StructBlock( + [ + ( + "style", + wagtail.blocks.ChoiceBlock( + choices=[("pop", "Pop"), ("outline", "Outline"), ("filled", "Filled")] + ), + ), + ( + "title", + wagtail.blocks.CharBlock( + help_text="Optional title for the card.", max_length=100, required=False + ), + ), + ( + "body", + wagtail.blocks.RichTextBlock( + features=["bold", "italic", "link", "hr", "h4", "h5", "ul", "ol"], + help_text="Body text of the card.", + ), + ), + ( + "image", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "altText", + wagtail.blocks.CharBlock( + help_text="Image description (for screen readers).", + required=True, + ), + ), + ] + ), + default=[], + max_num=1, + min_num=0, + ), + ), + ( + "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"), + ] + ), + ), + ] + ), + default=[], + max_num=1, + min_num=0, + ), + ), + ] + ), + ), + ( + "CTA_card_with_text", + wagtail.blocks.StructBlock( + [ + ( + "alignment", + wagtail.blocks.ChoiceBlock( + choices=[("right", "Right"), ("left", "Left")], + help_text="For full-width cards, please use a regular Blog CTA Card block with a separate paragraph.", + ), + ), + ( + "card", + wagtail.blocks.StructBlock( + [ + ( + "style", + wagtail.blocks.ChoiceBlock( + choices=[ + ("pop", "Pop"), + ("outline", "Outline"), + ("filled", "Filled"), + ] + ), + ), + ( + "title", + wagtail.blocks.CharBlock( + help_text="Optional title for the card.", + max_length=100, + required=False, + ), + ), + ( + "body", + wagtail.blocks.RichTextBlock( + features=["bold", "italic", "link", "hr", "h4", "h5", "ul", "ol"], + help_text="Body text of the card.", + ), + ), + ( + "image", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "altText", + wagtail.blocks.CharBlock( + help_text="Image description (for screen readers).", + required=True, + ), + ), + ] + ), + default=[], + max_num=1, + min_num=0, + ), + ), + ( + "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"), + ] + ), + ), + ] + ), + default=[], + max_num=1, + min_num=0, + ), + ), + ], + required=True, + template="wagtailpages/blocks/blog_cta_card_block_regular.html", + ), + ), + ( + "paragraph", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "h2", + "h3", + "h4", + "h5", + "ol", + "ul", + "hr", + "document-link", + ], + help_text="Text to be displayed next to the card.", + template="wagtailpages/blocks/rich_text_block.html", + ), + ), + ] + ), + ), + ( + "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, + ), + ), + ] + ) + ), + ) + ] + ), + ), + ( + "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)), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL that this caption should link out to.", required=False + ), + ), + ( + "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, + ), + ), + ] + ), + ), + ( + "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)), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL that this caption should link out to.", 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)", + ), + ), + ] + ), + ), + ( + "audio", + wagtail.blocks.StructBlock( + [ + ("audio", wagtailmedia.blocks.AudioChooserBlock()), + ("caption", wagtail.blocks.CharBlock(required=False)), + ] + ), + ), + ( + "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.CharBlock( + help_text="Optional URL that this image should link out to.", 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 + ), + ), + ] + ), + ), + ( + "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"])), + ] + ), + ), + ( + "video", + wagtail.blocks.StructBlock( + [ + ( + "url", + wagtail.blocks.CharBlock( + 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)), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL for caption to link to.", required=False + ), + ), + ( + "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.", + ), + ), + ] + ), + ), + ( + "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"), + ] + ), + ), + ] + ), + ), + ( + "looping_video", + wagtail.blocks.StructBlock( + [ + ( + "video_url", + wagtail.blocks.CharBlock( + help_text='Log into Vimeo using 1Password and upload the desired video. Then select the video and click "Advanced", "Distribution", and "Video File Links". Copy and paste the link here.', + label="Embed URL", + ), + ) + ] + ), + ), + ( + "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, + ), + ), + ] + ), + ), + ( + "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), + ), + ] + ), + ), + ( + "slider", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock(help_text="Heading for the slider.", required=False), + ), + ( + "slides", + wagtail.blocks.StreamBlock( + [ + ( + "slide", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + help_text="Heading of the card.", required=False + ), + ), + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + help_text="The image associated with this event." + ), + ), + ( + "caption", + wagtail.blocks.TextBlock( + help_text="Caption for slider image", required=False + ), + ), + ( + "body", + wagtail.blocks.RichTextBlock( + blank=True, + features=["bold", "italic", "link", "large"], + required=False, + ), + ), + ( + "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, + required=False, + ), + ), + ] + ), + ) + ], + help_text="A list of slides.", + ), + ), + ] + ), + ), + ( + "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"), + ] + ), + ) + ] + ), + ), + ( + "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", + ), + ), + ] + ), + ), + ( + "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", + ), + ), + ( + "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, + ), + ), + ] + ), + ), + ( + "newsletter_signup", + wagtail.blocks.StructBlock( + [("signup", wagtail.snippets.blocks.SnippetChooserBlock("wagtailpages.BlogSignup"))] + ), + ), + ], + use_json_field=True, + ), + ), + migrations.AlterField( + model_name="buyersguidearticlepage", + name="body", + field=wagtail.fields.StreamField( + [ + ( + "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.CharBlock( + 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), + ), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL for caption to link to.", + required=False, + ), + ), + ( + "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.", + ), + ), + ] + ), + ), + ] + ), + ), + ] + ) + ), + ) + ] + ), + ), + ( + "paragraph", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "h2", + "h3", + "h4", + "h5", + "ol", + "ul", + "hr", + "document-link", + ], + 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_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, + ), + ), + ] + ) + ), + ) + ] + ), + ), + ( + "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)), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL that this caption should link out to.", required=False + ), + ), + ( + "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, + ), + ), + ] + ), + ), + ( + "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)), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL that this caption should link out to.", 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)", + ), + ), + ] + ), + ), + ( + "audio", + wagtail.blocks.StructBlock( + [ + ("audio", wagtailmedia.blocks.AudioChooserBlock()), + ("caption", wagtail.blocks.CharBlock(required=False)), + ] + ), + ), + ( + "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.CharBlock( + help_text="Optional URL that this image should link out to.", 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 + ), + ), + ] + ), + ), + ( + "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"])), + ] + ), + ), + ( + "video", + wagtail.blocks.StructBlock( + [ + ( + "url", + wagtail.blocks.CharBlock( + 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)), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL for caption to link to.", required=False + ), + ), + ( + "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.", + ), + ), + ] + ), + ), + ( + "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"), + ] + ), + ), + ] + ), + ), + ( + "looping_video", + wagtail.blocks.StructBlock( + [ + ( + "video_url", + wagtail.blocks.CharBlock( + help_text='Log into Vimeo using 1Password and upload the desired video. Then select the video and click "Advanced", "Distribution", and "Video File Links". Copy and paste the link here.', + label="Embed URL", + ), + ) + ] + ), + ), + ( + "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, + ), + ), + ] + ), + ), + ( + "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), + ), + ] + ), + ), + ( + "slider", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock(help_text="Heading for the slider.", required=False), + ), + ( + "slides", + wagtail.blocks.StreamBlock( + [ + ( + "slide", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + help_text="Heading of the card.", required=False + ), + ), + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + help_text="The image associated with this event." + ), + ), + ( + "caption", + wagtail.blocks.TextBlock( + help_text="Caption for slider image", required=False + ), + ), + ( + "body", + wagtail.blocks.RichTextBlock( + blank=True, + features=["bold", "italic", "link", "large"], + required=False, + ), + ), + ( + "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, + required=False, + ), + ), + ] + ), + ) + ], + help_text="A list of slides.", + ), + ), + ] + ), + ), + ( + "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"), + ] + ), + ) + ] + ), + ), + ( + "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", + ), + ), + ] + ), + ), + ( + "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", + ), + ), + ( + "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, + ), + ), + ] + ), + ), + ], + null=True, + use_json_field=True, + ), + ), + migrations.AlterField( + model_name="buyersguidecampaignpage", + name="body", + field=wagtail.fields.StreamField( + [ + ( + "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.CharBlock( + 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), + ), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL for caption to link to.", + required=False, + ), + ), + ( + "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.", + ), + ), + ] + ), + ), + ] + ), + ), + ] + ) + ), + ) + ] + ), + ), + ( + "paragraph", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "h2", + "h3", + "h4", + "h5", + "ol", + "ul", + "hr", + "document-link", + ], + 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_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, + ), + ), + ] + ) + ), + ) + ] + ), + ), + ( + "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)), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL that this caption should link out to.", required=False + ), + ), + ( + "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, + ), + ), + ] + ), + ), + ( + "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)), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL that this caption should link out to.", 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)", + ), + ), + ] + ), + ), + ( + "audio", + wagtail.blocks.StructBlock( + [ + ("audio", wagtailmedia.blocks.AudioChooserBlock()), + ("caption", wagtail.blocks.CharBlock(required=False)), + ] + ), + ), + ( + "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.CharBlock( + help_text="Optional URL that this image should link out to.", 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 + ), + ), + ] + ), + ), + ( + "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"])), + ] + ), + ), + ( + "video", + wagtail.blocks.StructBlock( + [ + ( + "url", + wagtail.blocks.CharBlock( + 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)), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL for caption to link to.", required=False + ), + ), + ( + "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.", + ), + ), + ] + ), + ), + ( + "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"), + ] + ), + ), + ] + ), + ), + ( + "looping_video", + wagtail.blocks.StructBlock( + [ + ( + "video_url", + wagtail.blocks.CharBlock( + help_text='Log into Vimeo using 1Password and upload the desired video. Then select the video and click "Advanced", "Distribution", and "Video File Links". Copy and paste the link here.', + label="Embed URL", + ), + ) + ] + ), + ), + ( + "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, + ), + ), + ] + ), + ), + ( + "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), + ), + ] + ), + ), + ( + "slider", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock(help_text="Heading for the slider.", required=False), + ), + ( + "slides", + wagtail.blocks.StreamBlock( + [ + ( + "slide", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + help_text="Heading of the card.", required=False + ), + ), + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + help_text="The image associated with this event." + ), + ), + ( + "caption", + wagtail.blocks.TextBlock( + help_text="Caption for slider image", required=False + ), + ), + ( + "body", + wagtail.blocks.RichTextBlock( + blank=True, + features=["bold", "italic", "link", "large"], + required=False, + ), + ), + ( + "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, + required=False, + ), + ), + ] + ), + ) + ], + help_text="A list of slides.", + ), + ), + ] + ), + ), + ( + "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"), + ] + ), + ) + ] + ), + ), + ( + "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", + ), + ), + ] + ), + ), + ( + "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", + ), + ), + ( + "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, + ), + ), + ] + ), + ), + ], + use_json_field=True, + ), + ), + 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)), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL that this caption should link out to.", 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.CharBlock( + help_text="Optional URL that this image should link out to.", 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 + ), + ), + ] + ), + ), + ( + "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.CharBlock( + 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)), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL for caption to link to.", required=False + ), + ), + ( + "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)), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL that this caption should link out to.", required=False + ), + ), + ( + "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 + ), + ), + ] + ) + ), + ), + ] + ), + ), + ( + "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 + ), + ), + ("url_label", wagtail.blocks.CharBlock(required=False)), + ("url", wagtail.blocks.CharBlock(required=False)), + ( + "styling", + wagtail.blocks.ChoiceBlock( + choices=[ + ("btn-primary", "Primary button"), + ("btn-secondary", "Secondary button"), + ] + ), + ), + ( + "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.CharBlock( + 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), + ), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL for caption to link to.", + required=False, + ), + ), + ( + "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)), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL that this caption should link out to.", 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.CharBlock( + help_text="Optional URL that this image should link out to.", 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 + ), + ), + ] + ), + ), + ( + "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.CharBlock( + 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)), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL for caption to link to.", required=False + ), + ), + ( + "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)), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL that this caption should link out to.", required=False + ), + ), + ( + "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 + ), + ), + ] + ) + ), + ), + ] + ), + ), + ( + "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 + ), + ), + ("url_label", wagtail.blocks.CharBlock(required=False)), + ("url", wagtail.blocks.CharBlock(required=False)), + ( + "styling", + wagtail.blocks.ChoiceBlock( + choices=[ + ("btn-primary", "Primary button"), + ("btn-secondary", "Secondary button"), + ] + ), + ), + ( + "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.CharBlock( + 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), + ), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL for caption to link to.", + required=False, + ), + ), + ( + "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/annotated_image_block.py b/network-api/networkapi/wagtailpages/pagemodels/customblocks/annotated_image_block.py index fd97af8fb90..5500bfda764 100644 --- a/network-api/networkapi/wagtailpages/pagemodels/customblocks/annotated_image_block.py +++ b/network-api/networkapi/wagtailpages/pagemodels/customblocks/annotated_image_block.py @@ -2,6 +2,7 @@ from wagtail import blocks from .image_block import ImageBlock +from .link_block import LinkBlockWithoutLabel class RadioSelectBlock(blocks.ChoiceBlock): @@ -13,6 +14,9 @@ def __init__(self, *args, **kwargs): class AnnotatedImageBlock(ImageBlock): caption = blocks.CharBlock(required=False) captionURL = blocks.CharBlock(required=False, help_text="Optional URL that this caption should link out to.") + caption_url = blocks.ListBlock( + LinkBlockWithoutLabel(), min_num=0, max_num=1, help_text="Optional URL that this caption should link out to." + ) image_width = RadioSelectBlock( choices=( ("normal", "Normal"), diff --git a/network-api/networkapi/wagtailpages/pagemodels/customblocks/link_block.py b/network-api/networkapi/wagtailpages/pagemodels/customblocks/link_block.py index be91896b50a..1e4d82c2da7 100644 --- a/network-api/networkapi/wagtailpages/pagemodels/customblocks/link_block.py +++ b/network-api/networkapi/wagtailpages/pagemodels/customblocks/link_block.py @@ -75,4 +75,4 @@ def __init__(self, local_blocks=None, **kwargs): self.child_blocks.pop("label") -register(BaseLinkBlockAdapter(), LinkBlockWithoutLabel) \ No newline at end of file +register(BaseLinkBlockAdapter(), LinkBlockWithoutLabel) From 88f7bca5162f242a0b36df921a85c11735ffa80b Mon Sep 17 00:00:00 2001 From: danielfmiranda Date: Wed, 12 Jun 2024 15:34:36 -0700 Subject: [PATCH 03/11] migrations to copy over old data to new linkblock field --- ...013_copy_old_link_data_to_new_linkblock.py | 44 +++++++++++++++++++ ...053_copy_old_link_data_to_new_linkblock.py | 44 +++++++++++++++++++ ...139_copy_old_link_data_to_new_linkblock.py | 44 +++++++++++++++++++ 3 files changed, 132 insertions(+) create mode 100644 network-api/networkapi/donate/migrations/0013_copy_old_link_data_to_new_linkblock.py create mode 100644 network-api/networkapi/mozfest/migrations/0053_copy_old_link_data_to_new_linkblock.py create mode 100644 network-api/networkapi/wagtailpages/migrations/0139_copy_old_link_data_to_new_linkblock.py diff --git a/network-api/networkapi/donate/migrations/0013_copy_old_link_data_to_new_linkblock.py b/network-api/networkapi/donate/migrations/0013_copy_old_link_data_to_new_linkblock.py new file mode 100644 index 00000000000..c7f6d1db3b1 --- /dev/null +++ b/network-api/networkapi/donate/migrations/0013_copy_old_link_data_to_new_linkblock.py @@ -0,0 +1,44 @@ +# Generated by Django 4.2.10 on 2024-02-27 12:28 +from django.db import migrations +from wagtail.blocks.migrations.migrate_operation import MigrateStreamData + +from networkapi.utility.migration.operations import AlterStreamChildBlockDataOperation + + +def migrate_image_block(source_block): + new_value = { + "image": source_block["value"]["image"], + "altText": source_block["value"]["altText"], + "caption": source_block["value"]["caption"], + "caption_url": [], + } + if "captionURL" in source_block["value"] and source_block["value"]["captionURL"]: + new_value["caption_url"] = [ + { + "link_to": "external_url", + "external_url": source_block["value"]["captionURL"], + "new_window": True, + } + ] + return { + **source_block, + "value": new_value, + } + + +class Migration(migrations.Migration): + + dependencies = [ + ("donate", "0012_alter_donatehelppage_body"), + ] + + operations = [ + MigrateStreamData( + app_name="donate", + model_name="DonateHelpPage", + field_name="body", + operations_and_block_paths=[ + (AlterStreamChildBlockDataOperation(block="image", operation=migrate_image_block), ""), + ], + ), + ] diff --git a/network-api/networkapi/mozfest/migrations/0053_copy_old_link_data_to_new_linkblock.py b/network-api/networkapi/mozfest/migrations/0053_copy_old_link_data_to_new_linkblock.py new file mode 100644 index 00000000000..4934e2bf90a --- /dev/null +++ b/network-api/networkapi/mozfest/migrations/0053_copy_old_link_data_to_new_linkblock.py @@ -0,0 +1,44 @@ +# Generated by Django 4.2.10 on 2024-02-27 12:28 +from django.db import migrations +from wagtail.blocks.migrations.migrate_operation import MigrateStreamData + +from networkapi.utility.migration.operations import AlterStreamChildBlockDataOperation + + +def migrate_image_block(source_block): + new_value = { + "image": source_block["value"]["image"], + "altText": source_block["value"]["altText"], + "caption": source_block["value"]["caption"], + "caption_url": [], + } + if "captionURL" in source_block["value"] and source_block["value"]["captionURL"]: + new_value["caption_url"] = [ + { + "link_to": "external_url", + "external_url": source_block["value"]["captionURL"], + "new_window": True, + } + ] + return { + **source_block, + "value": new_value, + } + + +class Migration(migrations.Migration): + + dependencies = [ + ("mozfest", "0052_alter_mozfestprimarypage_body"), + ] + + operations = [ + MigrateStreamData( + app_name="mozfest", + model_name="mozfestprimarypage", + field_name="body", + operations_and_block_paths=[ + (AlterStreamChildBlockDataOperation(block="image", operation=migrate_image_block), ""), + ], + ), + ] diff --git a/network-api/networkapi/wagtailpages/migrations/0139_copy_old_link_data_to_new_linkblock.py b/network-api/networkapi/wagtailpages/migrations/0139_copy_old_link_data_to_new_linkblock.py new file mode 100644 index 00000000000..69ab035c7fe --- /dev/null +++ b/network-api/networkapi/wagtailpages/migrations/0139_copy_old_link_data_to_new_linkblock.py @@ -0,0 +1,44 @@ +# Generated by Django 4.2.10 on 2024-02-27 12:28 +from django.db import migrations +from wagtail.blocks.migrations.migrate_operation import MigrateStreamData + +from networkapi.utility.migration.operations import AlterStreamChildBlockDataOperation + + +def migrate_image_block(source_block): + new_value = { + "image": source_block["value"]["image"], + "altText": source_block["value"]["altText"], + "caption": source_block["value"]["caption"], + "caption_url": [], + } + if "captionURL" in source_block["value"] and source_block["value"]["captionURL"]: + new_value["caption_url"] = [ + { + "link_to": "external_url", + "external_url": source_block["value"]["captionURL"], + "new_window": True, + } + ] + return { + **source_block, + "value": new_value, + } + + +class Migration(migrations.Migration): + + dependencies = [ + ("wagtailpages", "0138_alter_blogpage_body_and_more"), + ] + + operations = [ + MigrateStreamData( + app_name="wagtailpages", + model_name="blogpage", + field_name="body", + operations_and_block_paths=[ + (AlterStreamChildBlockDataOperation(block="image", operation=migrate_image_block), ""), + ], + ), + ] From f79c565081c5072bc253abab89312ee4672ad816 Mon Sep 17 00:00:00 2001 From: danielfmiranda Date: Wed, 12 Jun 2024 15:35:25 -0700 Subject: [PATCH 04/11] removing old captionURL field in place of caption_url --- .../0014_alter_donatehelppage_body.py | 1424 ++++ .../0054_alter_mozfestprimarypage_body.py | 1890 ++++++ .../0140_alter_blogpage_body_and_more.py | 5718 +++++++++++++++++ .../customblocks/annotated_image_block.py | 1 - 4 files changed, 9032 insertions(+), 1 deletion(-) create mode 100644 network-api/networkapi/donate/migrations/0014_alter_donatehelppage_body.py create mode 100644 network-api/networkapi/mozfest/migrations/0054_alter_mozfestprimarypage_body.py create mode 100644 network-api/networkapi/wagtailpages/migrations/0140_alter_blogpage_body_and_more.py diff --git a/network-api/networkapi/donate/migrations/0014_alter_donatehelppage_body.py b/network-api/networkapi/donate/migrations/0014_alter_donatehelppage_body.py new file mode 100644 index 00000000000..2806a04912c --- /dev/null +++ b/network-api/networkapi/donate/migrations/0014_alter_donatehelppage_body.py @@ -0,0 +1,1424 @@ +# Generated by Django 4.2.11 on 2024-06-12 22:34 + +from django.db import migrations +import networkapi.wagtailpages.pagemodels.blog.blog_topic +import networkapi.wagtailpages.pagemodels.profiles +import networkapi.wagtailpages.validators +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 + + +class Migration(migrations.Migration): + + dependencies = [ + ("donate", "0013_copy_old_link_data_to_new_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.CharBlock( + help_text="Optional URL that this image should link out to.", 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 + ), + ), + ] + ), + ), + ( + "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.CharBlock( + 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)), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL for caption to link to.", required=False + ), + ), + ( + "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)), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL that this caption should link out to.", required=False + ), + ), + ( + "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 + ), + ), + ] + ) + ), + ), + ] + ), + ), + ( + "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 + ), + ), + ("url_label", wagtail.blocks.CharBlock(required=False)), + ("url", wagtail.blocks.CharBlock(required=False)), + ( + "styling", + wagtail.blocks.ChoiceBlock( + choices=[ + ("btn-primary", "Primary button"), + ("btn-secondary", "Secondary button"), + ] + ), + ), + ( + "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.CharBlock( + 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), + ), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL for caption to link to.", + required=False, + ), + ), + ( + "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/0054_alter_mozfestprimarypage_body.py b/network-api/networkapi/mozfest/migrations/0054_alter_mozfestprimarypage_body.py new file mode 100644 index 00000000000..eb8bc0951fd --- /dev/null +++ b/network-api/networkapi/mozfest/migrations/0054_alter_mozfestprimarypage_body.py @@ -0,0 +1,1890 @@ +# Generated by Django 4.2.11 on 2024-06-12 22:34 + +from django.db import migrations +import networkapi.wagtailpages.pagemodels.blog.blog_topic +import networkapi.wagtailpages.pagemodels.profiles +import networkapi.wagtailpages.validators +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 + + +class Migration(migrations.Migration): + + dependencies = [ + ("mozfest", "0053_copy_old_link_data_to_new_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.CharBlock( + help_text="Optional URL that this image should link out to.", 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 + ), + ), + ] + ), + ), + ( + "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.CharBlock( + 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)), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL for caption to link to.", required=False + ), + ), + ( + "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)), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL that this caption should link out to.", required=False + ), + ), + ( + "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 + ), + ), + ] + ) + ), + ), + ] + ), + ), + ( + "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 + ), + ), + ("url_label", wagtail.blocks.CharBlock(required=False)), + ("url", wagtail.blocks.CharBlock(required=False)), + ( + "styling", + wagtail.blocks.ChoiceBlock( + choices=[ + ("btn-primary", "Primary button"), + ("btn-secondary", "Secondary button"), + ] + ), + ), + ( + "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.CharBlock( + 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), + ), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL for caption to link to.", + required=False, + ), + ), + ( + "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/0140_alter_blogpage_body_and_more.py b/network-api/networkapi/wagtailpages/migrations/0140_alter_blogpage_body_and_more.py new file mode 100644 index 00000000000..4708fc64777 --- /dev/null +++ b/network-api/networkapi/wagtailpages/migrations/0140_alter_blogpage_body_and_more.py @@ -0,0 +1,5718 @@ +# Generated by Django 4.2.11 on 2024-06-12 22:34 + +from django.db import migrations +import networkapi.wagtailpages.pagemodels.blog.blog_topic +import networkapi.wagtailpages.pagemodels.profiles +import networkapi.wagtailpages.validators +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 + + +class Migration(migrations.Migration): + + dependencies = [ + ("wagtailpages", "0139_copy_old_link_data_to_new_linkblock"), + ] + + operations = [ + migrations.AlterField( + model_name="blogpage", + name="body", + field=wagtail.fields.StreamField( + [ + ( + "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.CharBlock( + 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), + ), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL for caption to link to.", + required=False, + ), + ), + ( + "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.", + ), + ), + ] + ), + ), + ] + ), + ), + ] + ) + ), + ) + ] + ), + ), + ( + "paragraph", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "h2", + "h3", + "h4", + "h5", + "ol", + "ul", + "hr", + "document-link", + ], + 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.", + ), + ) + ] + ), + ), + ( + "CTA_card", + wagtail.blocks.StructBlock( + [ + ( + "style", + wagtail.blocks.ChoiceBlock( + choices=[("pop", "Pop"), ("outline", "Outline"), ("filled", "Filled")] + ), + ), + ( + "title", + wagtail.blocks.CharBlock( + help_text="Optional title for the card.", max_length=100, required=False + ), + ), + ( + "body", + wagtail.blocks.RichTextBlock( + features=["bold", "italic", "link", "hr", "h4", "h5", "ul", "ol"], + help_text="Body text of the card.", + ), + ), + ( + "image", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "altText", + wagtail.blocks.CharBlock( + help_text="Image description (for screen readers).", + required=True, + ), + ), + ] + ), + default=[], + max_num=1, + min_num=0, + ), + ), + ( + "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"), + ] + ), + ), + ] + ), + default=[], + max_num=1, + min_num=0, + ), + ), + ] + ), + ), + ( + "CTA_card_with_text", + wagtail.blocks.StructBlock( + [ + ( + "alignment", + wagtail.blocks.ChoiceBlock( + choices=[("right", "Right"), ("left", "Left")], + help_text="For full-width cards, please use a regular Blog CTA Card block with a separate paragraph.", + ), + ), + ( + "card", + wagtail.blocks.StructBlock( + [ + ( + "style", + wagtail.blocks.ChoiceBlock( + choices=[ + ("pop", "Pop"), + ("outline", "Outline"), + ("filled", "Filled"), + ] + ), + ), + ( + "title", + wagtail.blocks.CharBlock( + help_text="Optional title for the card.", + max_length=100, + required=False, + ), + ), + ( + "body", + wagtail.blocks.RichTextBlock( + features=["bold", "italic", "link", "hr", "h4", "h5", "ul", "ol"], + help_text="Body text of the card.", + ), + ), + ( + "image", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "altText", + wagtail.blocks.CharBlock( + help_text="Image description (for screen readers).", + required=True, + ), + ), + ] + ), + default=[], + max_num=1, + min_num=0, + ), + ), + ( + "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"), + ] + ), + ), + ] + ), + default=[], + max_num=1, + min_num=0, + ), + ), + ], + required=True, + template="wagtailpages/blocks/blog_cta_card_block_regular.html", + ), + ), + ( + "paragraph", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "h2", + "h3", + "h4", + "h5", + "ol", + "ul", + "hr", + "document-link", + ], + help_text="Text to be displayed next to the card.", + template="wagtailpages/blocks/rich_text_block.html", + ), + ), + ] + ), + ), + ( + "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, + ), + ), + ] + ) + ), + ) + ] + ), + ), + ( + "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)), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL that this caption should link out to.", required=False + ), + ), + ( + "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, + ), + ), + ] + ), + ), + ( + "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)", + ), + ), + ] + ), + ), + ( + "audio", + wagtail.blocks.StructBlock( + [ + ("audio", wagtailmedia.blocks.AudioChooserBlock()), + ("caption", wagtail.blocks.CharBlock(required=False)), + ] + ), + ), + ( + "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.CharBlock( + help_text="Optional URL that this image should link out to.", 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 + ), + ), + ] + ), + ), + ( + "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"])), + ] + ), + ), + ( + "video", + wagtail.blocks.StructBlock( + [ + ( + "url", + wagtail.blocks.CharBlock( + 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)), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL for caption to link to.", required=False + ), + ), + ( + "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.", + ), + ), + ] + ), + ), + ( + "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"), + ] + ), + ), + ] + ), + ), + ( + "looping_video", + wagtail.blocks.StructBlock( + [ + ( + "video_url", + wagtail.blocks.CharBlock( + help_text='Log into Vimeo using 1Password and upload the desired video. Then select the video and click "Advanced", "Distribution", and "Video File Links". Copy and paste the link here.', + label="Embed URL", + ), + ) + ] + ), + ), + ( + "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, + ), + ), + ] + ), + ), + ( + "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), + ), + ] + ), + ), + ( + "slider", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock(help_text="Heading for the slider.", required=False), + ), + ( + "slides", + wagtail.blocks.StreamBlock( + [ + ( + "slide", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + help_text="Heading of the card.", required=False + ), + ), + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + help_text="The image associated with this event." + ), + ), + ( + "caption", + wagtail.blocks.TextBlock( + help_text="Caption for slider image", required=False + ), + ), + ( + "body", + wagtail.blocks.RichTextBlock( + blank=True, + features=["bold", "italic", "link", "large"], + required=False, + ), + ), + ( + "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, + required=False, + ), + ), + ] + ), + ) + ], + help_text="A list of slides.", + ), + ), + ] + ), + ), + ( + "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"), + ] + ), + ) + ] + ), + ), + ( + "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", + ), + ), + ] + ), + ), + ( + "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", + ), + ), + ( + "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, + ), + ), + ] + ), + ), + ( + "newsletter_signup", + wagtail.blocks.StructBlock( + [("signup", wagtail.snippets.blocks.SnippetChooserBlock("wagtailpages.BlogSignup"))] + ), + ), + ], + use_json_field=True, + ), + ), + migrations.AlterField( + model_name="buyersguidearticlepage", + name="body", + field=wagtail.fields.StreamField( + [ + ( + "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.CharBlock( + 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), + ), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL for caption to link to.", + required=False, + ), + ), + ( + "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.", + ), + ), + ] + ), + ), + ] + ), + ), + ] + ) + ), + ) + ] + ), + ), + ( + "paragraph", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "h2", + "h3", + "h4", + "h5", + "ol", + "ul", + "hr", + "document-link", + ], + 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_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, + ), + ), + ] + ) + ), + ) + ] + ), + ), + ( + "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)), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL that this caption should link out to.", required=False + ), + ), + ( + "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, + ), + ), + ] + ), + ), + ( + "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)", + ), + ), + ] + ), + ), + ( + "audio", + wagtail.blocks.StructBlock( + [ + ("audio", wagtailmedia.blocks.AudioChooserBlock()), + ("caption", wagtail.blocks.CharBlock(required=False)), + ] + ), + ), + ( + "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.CharBlock( + help_text="Optional URL that this image should link out to.", 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 + ), + ), + ] + ), + ), + ( + "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"])), + ] + ), + ), + ( + "video", + wagtail.blocks.StructBlock( + [ + ( + "url", + wagtail.blocks.CharBlock( + 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)), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL for caption to link to.", required=False + ), + ), + ( + "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.", + ), + ), + ] + ), + ), + ( + "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"), + ] + ), + ), + ] + ), + ), + ( + "looping_video", + wagtail.blocks.StructBlock( + [ + ( + "video_url", + wagtail.blocks.CharBlock( + help_text='Log into Vimeo using 1Password and upload the desired video. Then select the video and click "Advanced", "Distribution", and "Video File Links". Copy and paste the link here.', + label="Embed URL", + ), + ) + ] + ), + ), + ( + "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, + ), + ), + ] + ), + ), + ( + "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), + ), + ] + ), + ), + ( + "slider", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock(help_text="Heading for the slider.", required=False), + ), + ( + "slides", + wagtail.blocks.StreamBlock( + [ + ( + "slide", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + help_text="Heading of the card.", required=False + ), + ), + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + help_text="The image associated with this event." + ), + ), + ( + "caption", + wagtail.blocks.TextBlock( + help_text="Caption for slider image", required=False + ), + ), + ( + "body", + wagtail.blocks.RichTextBlock( + blank=True, + features=["bold", "italic", "link", "large"], + required=False, + ), + ), + ( + "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, + required=False, + ), + ), + ] + ), + ) + ], + help_text="A list of slides.", + ), + ), + ] + ), + ), + ( + "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"), + ] + ), + ) + ] + ), + ), + ( + "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", + ), + ), + ] + ), + ), + ( + "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", + ), + ), + ( + "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, + ), + ), + ] + ), + ), + ], + null=True, + use_json_field=True, + ), + ), + migrations.AlterField( + model_name="buyersguidecampaignpage", + name="body", + field=wagtail.fields.StreamField( + [ + ( + "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.CharBlock( + 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), + ), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL for caption to link to.", + required=False, + ), + ), + ( + "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.", + ), + ), + ] + ), + ), + ] + ), + ), + ] + ) + ), + ) + ] + ), + ), + ( + "paragraph", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "h2", + "h3", + "h4", + "h5", + "ol", + "ul", + "hr", + "document-link", + ], + 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_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, + ), + ), + ] + ) + ), + ) + ] + ), + ), + ( + "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)), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL that this caption should link out to.", required=False + ), + ), + ( + "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, + ), + ), + ] + ), + ), + ( + "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)", + ), + ), + ] + ), + ), + ( + "audio", + wagtail.blocks.StructBlock( + [ + ("audio", wagtailmedia.blocks.AudioChooserBlock()), + ("caption", wagtail.blocks.CharBlock(required=False)), + ] + ), + ), + ( + "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.CharBlock( + help_text="Optional URL that this image should link out to.", 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 + ), + ), + ] + ), + ), + ( + "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"])), + ] + ), + ), + ( + "video", + wagtail.blocks.StructBlock( + [ + ( + "url", + wagtail.blocks.CharBlock( + 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)), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL for caption to link to.", required=False + ), + ), + ( + "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.", + ), + ), + ] + ), + ), + ( + "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"), + ] + ), + ), + ] + ), + ), + ( + "looping_video", + wagtail.blocks.StructBlock( + [ + ( + "video_url", + wagtail.blocks.CharBlock( + help_text='Log into Vimeo using 1Password and upload the desired video. Then select the video and click "Advanced", "Distribution", and "Video File Links". Copy and paste the link here.', + label="Embed URL", + ), + ) + ] + ), + ), + ( + "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, + ), + ), + ] + ), + ), + ( + "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), + ), + ] + ), + ), + ( + "slider", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock(help_text="Heading for the slider.", required=False), + ), + ( + "slides", + wagtail.blocks.StreamBlock( + [ + ( + "slide", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + help_text="Heading of the card.", required=False + ), + ), + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + help_text="The image associated with this event." + ), + ), + ( + "caption", + wagtail.blocks.TextBlock( + help_text="Caption for slider image", required=False + ), + ), + ( + "body", + wagtail.blocks.RichTextBlock( + blank=True, + features=["bold", "italic", "link", "large"], + required=False, + ), + ), + ( + "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, + required=False, + ), + ), + ] + ), + ) + ], + help_text="A list of slides.", + ), + ), + ] + ), + ), + ( + "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"), + ] + ), + ) + ] + ), + ), + ( + "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", + ), + ), + ] + ), + ), + ( + "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", + ), + ), + ( + "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, + ), + ), + ] + ), + ), + ], + use_json_field=True, + ), + ), + 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.CharBlock( + help_text="Optional URL that this image should link out to.", 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 + ), + ), + ] + ), + ), + ( + "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.CharBlock( + 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)), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL for caption to link to.", required=False + ), + ), + ( + "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)), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL that this caption should link out to.", required=False + ), + ), + ( + "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 + ), + ), + ] + ) + ), + ), + ] + ), + ), + ( + "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 + ), + ), + ("url_label", wagtail.blocks.CharBlock(required=False)), + ("url", wagtail.blocks.CharBlock(required=False)), + ( + "styling", + wagtail.blocks.ChoiceBlock( + choices=[ + ("btn-primary", "Primary button"), + ("btn-secondary", "Secondary button"), + ] + ), + ), + ( + "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.CharBlock( + 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), + ), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL for caption to link to.", + required=False, + ), + ), + ( + "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.CharBlock( + help_text="Optional URL that this image should link out to.", 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 + ), + ), + ] + ), + ), + ( + "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.CharBlock( + 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)), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL for caption to link to.", required=False + ), + ), + ( + "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)), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL that this caption should link out to.", required=False + ), + ), + ( + "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 + ), + ), + ] + ) + ), + ), + ] + ), + ), + ( + "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 + ), + ), + ("url_label", wagtail.blocks.CharBlock(required=False)), + ("url", wagtail.blocks.CharBlock(required=False)), + ( + "styling", + wagtail.blocks.ChoiceBlock( + choices=[ + ("btn-primary", "Primary button"), + ("btn-secondary", "Secondary button"), + ] + ), + ), + ( + "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.CharBlock( + 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), + ), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL for caption to link to.", + required=False, + ), + ), + ( + "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/annotated_image_block.py b/network-api/networkapi/wagtailpages/pagemodels/customblocks/annotated_image_block.py index 5500bfda764..3e40c4e6f68 100644 --- a/network-api/networkapi/wagtailpages/pagemodels/customblocks/annotated_image_block.py +++ b/network-api/networkapi/wagtailpages/pagemodels/customblocks/annotated_image_block.py @@ -13,7 +13,6 @@ def __init__(self, *args, **kwargs): class AnnotatedImageBlock(ImageBlock): caption = blocks.CharBlock(required=False) - captionURL = blocks.CharBlock(required=False, help_text="Optional URL that this caption should link out to.") caption_url = blocks.ListBlock( LinkBlockWithoutLabel(), min_num=0, max_num=1, help_text="Optional URL that this caption should link out to." ) From ff9832e49f921529e5b736e8fec5556bc35a1274 Mon Sep 17 00:00:00 2001 From: danielfmiranda Date: Wed, 12 Jun 2024 15:49:12 -0700 Subject: [PATCH 05/11] updated template to work with linkblock --- .../wagtailpages/blocks/annotated_image_block.html | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/network-api/networkapi/wagtailpages/templates/wagtailpages/blocks/annotated_image_block.html b/network-api/networkapi/wagtailpages/templates/wagtailpages/blocks/annotated_image_block.html index 27b96d65e67..8afdc1e322a 100644 --- a/network-api/networkapi/wagtailpages/templates/wagtailpages/blocks/annotated_image_block.html +++ b/network-api/networkapi/wagtailpages/templates/wagtailpages/blocks/annotated_image_block.html @@ -23,9 +23,13 @@ {{ value.altText }} {% if value.caption %}
- {% if value.captionURL %}{% endif %} - {{ value.caption }} - {% if value.captionURL %}{% endif %} + {% if value.caption_url %} + {% with link=value.caption_url.0 %} + {{ value.caption }} + {% endwith %} + {% else %} + {{ value.caption }} + {% endif %}
{% endif %} From 47a5a9fd3ec276cf806c2349eed8ca24abae65c1 Mon Sep 17 00:00:00 2001 From: danielfmiranda Date: Wed, 12 Jun 2024 19:25:41 -0700 Subject: [PATCH 06/11] combine operations (add new field + copy data + delete old field) in single migration files --- .../0012_alter_donatehelppage_body.py | 1431 ---- ...ate_annotatedimageblock_with_linkblock.py} | 2012 ++++-- ...013_copy_old_link_data_to_new_linkblock.py | 44 - .../0014_alter_donatehelppage_body.py | 1424 ---- ...ate_annotatedimageblock_with_linkblock.py} | 6264 ++++++----------- ...053_copy_old_link_data_to_new_linkblock.py | 44 - .../0054_alter_mozfestprimarypage_body.py | 1890 ----- ...ate_annotatedimageblock_with_linkblock.py} | 5725 +++++++++++++++ ...139_copy_old_link_data_to_new_linkblock.py | 44 - 9 files changed, 9384 insertions(+), 9494 deletions(-) delete mode 100644 network-api/networkapi/donate/migrations/0012_alter_donatehelppage_body.py rename network-api/networkapi/{mozfest/migrations/0052_alter_mozfestprimarypage_body.py => donate/migrations/0012_update_annotatedimageblock_with_linkblock.py} (61%) delete mode 100644 network-api/networkapi/donate/migrations/0013_copy_old_link_data_to_new_linkblock.py delete mode 100644 network-api/networkapi/donate/migrations/0014_alter_donatehelppage_body.py rename network-api/networkapi/{wagtailpages/migrations/0140_alter_blogpage_body_and_more.py => mozfest/migrations/0052_update_annotatedimageblock_with_linkblock.py} (60%) delete mode 100644 network-api/networkapi/mozfest/migrations/0053_copy_old_link_data_to_new_linkblock.py delete mode 100644 network-api/networkapi/mozfest/migrations/0054_alter_mozfestprimarypage_body.py rename network-api/networkapi/wagtailpages/migrations/{0138_alter_blogpage_body_and_more.py => 0138_update_annotatedimageblock_with_linkblock.py} (50%) delete mode 100644 network-api/networkapi/wagtailpages/migrations/0139_copy_old_link_data_to_new_linkblock.py diff --git a/network-api/networkapi/donate/migrations/0012_alter_donatehelppage_body.py b/network-api/networkapi/donate/migrations/0012_alter_donatehelppage_body.py deleted file mode 100644 index 248b43d3e83..00000000000 --- a/network-api/networkapi/donate/migrations/0012_alter_donatehelppage_body.py +++ /dev/null @@ -1,1431 +0,0 @@ -# Generated by Django 4.2.11 on 2024-06-12 21:42 - -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 - -import networkapi.wagtailpages.pagemodels.blog.blog_topic -import networkapi.wagtailpages.pagemodels.profiles -import networkapi.wagtailpages.validators - - -class Migration(migrations.Migration): - - dependencies = [ - ("donate", "0011_update_donatehelppage_notice"), - ] - - 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)), - ( - "captionURL", - wagtail.blocks.CharBlock( - help_text="Optional URL that this caption should link out to.", 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.CharBlock( - help_text="Optional URL that this image should link out to.", 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 - ), - ), - ] - ), - ), - ( - "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.CharBlock( - 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)), - ( - "captionURL", - wagtail.blocks.CharBlock( - help_text="Optional URL for caption to link to.", required=False - ), - ), - ( - "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)), - ( - "captionURL", - wagtail.blocks.CharBlock( - help_text="Optional URL that this caption should link out to.", required=False - ), - ), - ( - "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 - ), - ), - ] - ) - ), - ), - ] - ), - ), - ( - "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 - ), - ), - ("url_label", wagtail.blocks.CharBlock(required=False)), - ("url", wagtail.blocks.CharBlock(required=False)), - ( - "styling", - wagtail.blocks.ChoiceBlock( - choices=[ - ("btn-primary", "Primary button"), - ("btn-secondary", "Secondary button"), - ] - ), - ), - ( - "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.CharBlock( - 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), - ), - ( - "captionURL", - wagtail.blocks.CharBlock( - help_text="Optional URL for caption to link to.", - required=False, - ), - ), - ( - "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/0052_alter_mozfestprimarypage_body.py b/network-api/networkapi/donate/migrations/0012_update_annotatedimageblock_with_linkblock.py similarity index 61% rename from network-api/networkapi/mozfest/migrations/0052_alter_mozfestprimarypage_body.py rename to network-api/networkapi/donate/migrations/0012_update_annotatedimageblock_with_linkblock.py index 86565bd9381..afabf16b8b4 100644 --- a/network-api/networkapi/mozfest/migrations/0052_alter_mozfestprimarypage_body.py +++ b/network-api/networkapi/donate/migrations/0012_update_annotatedimageblock_with_linkblock.py @@ -7,23 +7,45 @@ 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_image_block(source_block): + new_value = { + "image": source_block["value"]["image"], + "altText": source_block["value"]["altText"], + "caption": source_block["value"]["caption"], + "caption_url": [], + } + if "captionURL" in source_block["value"] and source_block["value"]["captionURL"]: + new_value["caption_url"] = [ + { + "link_to": "external_url", + "external_url": source_block["value"]["captionURL"], + "new_window": True, + } + ] + return { + **source_block, + "value": new_value, + } class Migration(migrations.Migration): dependencies = [ - ("mozfest", "0051_alter_mozfestprimarypage_body"), + ("donate", "0011_update_donatehelppage_notice"), ] operations = [ migrations.AlterField( - model_name="mozfestprimarypage", + model_name="donatehelppage", name="body", field=wagtail.fields.StreamField( [ @@ -479,6 +501,136 @@ class Migration(migrations.Migration): ] ), ), + ( + "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( @@ -599,6 +751,56 @@ class Migration(migrations.Migration): ] ), ), + ( + "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( @@ -701,6 +903,32 @@ class Migration(migrations.Migration): ] ), ), + ( + "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( @@ -1218,500 +1446,371 @@ class Migration(migrations.Migration): ] ), ), + ], + blank=True, + use_json_field=True, + ), + ), + MigrateStreamData( + app_name="donate", + model_name="DonateHelpPage", + field_name="body", + operations_and_block_paths=[ + (AlterStreamChildBlockDataOperation(block="image", operation=migrate_image_block), ""), + ], + ), + migrations.AlterField( + model_name="donatehelppage", + name="body", + field=wagtail.fields.StreamField( + [ ( - "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, - ), - ), - ] + "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", ), ), ( - "current_events_slider", + "card_grid", 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, - ), - ), - ] + 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 + ), ), - ) - ], - help_text="A list of Spaces Cards.", + ("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.", ), - ), + ) ] ), ), ( - "tito_widget", + "image", wagtail.blocks.StructBlock( [ + ("image", wagtail.images.blocks.ImageChooserBlock()), ( - "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", + "altText", wagtail.blocks.CharBlock( - help_text='Comma-separated list of ticket/release IDs to limit to, e.g. "3elajg6qcxu,6qiiw4socs4"', - required=False, + help_text="Image description (for screen readers).", required=True ), ), - ] - ), - ), - ( - "statistics", - wagtail.blocks.StructBlock( - [ + ("caption", wagtail.blocks.CharBlock(required=False)), ( - "statistics", + "caption_url", wagtail.blocks.ListBlock( wagtail.blocks.StructBlock( [ ( - "title", + "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="The statistic figure, e.g '1000+' or '10%'" + 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 ), ), ( - "description", + "phone", wagtail.blocks.CharBlock( - help_text="Context or description for the statistic" + label="Phone", max_length=30, required=False + ), + ), + ( + "new_window", + wagtail.blocks.BooleanBlock( + label="Open in new window", required=False ), ), ] ), - help_text="Please use a minimum of 2 cards.", - max_num=4, - min_num=2, + 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)", + ), + ), ] ), ), ( - "carousel_and_text", + "image_text", wagtail.blocks.StructBlock( [ + ("image", wagtail.images.blocks.ImageChooserBlock()), ( - "heading", - wagtail.blocks.CharBlock(help_text="Heading for the block.", required=False), + "altText", + wagtail.blocks.CharBlock( + help_text="Image description (for screen readers).", required=True + ), ), - ("text", wagtail.blocks.RichTextBlock(features=["bold", "italic", "link"])), ( - "link_url", - wagtail.blocks.URLBlock( - help_text="A CTA URL for a link displayed", required=False + "text", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "h2", + "h3", + "h4", + "h5", + "ol", + "ul", + "hr", + "document-link", + ] + ), + ), + ( + "url", + wagtail.blocks.CharBlock( + help_text="Optional URL that this image should link out to.", required=False ), ), ( - "link_label", - wagtail.blocks.CharBlock(help_text="Label for the CTA link.", required=False), + "top_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider above content block.", 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, + "bottom_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider below content block.", required=False ), ), ] ), ), ( - "tickets", + "image_text_mini", wagtail.blocks.StructBlock( [ + ("image", wagtail.images.blocks.ImageChooserBlock()), ( - "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 + "altText", + wagtail.blocks.CharBlock( + help_text="Image description (for screen readers).", required=True ), ), + ("text", wagtail.blocks.RichTextBlock(features=["bold", "italic", "link"])), ] ), ), ( - "dark_quote", + "image_grid", 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), + "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.CharBlock( + 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)), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL for caption to link to.", required=False + ), + ), + ( + "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)), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL that this caption should link out to.", required=False + ), + ), + ( + "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, + ), ), ] ), ), ( - "cta", + "linkbutton", wagtail.blocks.StructBlock( [ ("label", wagtail.blocks.CharBlock()), @@ -1767,130 +1866,997 @@ class Migration(migrations.Migration): "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)), + ( + "styling", + wagtail.blocks.ChoiceBlock( + choices=[ + ("btn-primary", "Primary button"), + ("btn-secondary", "Secondary button"), + ] + ), + ), ] ), ), ( - "newsletter_signup", + "spacer", wagtail.blocks.StructBlock( [ ( - "snippet", - wagtail.snippets.blocks.SnippetChooserBlock( - "mozfest.NewsletterSignupWithBackground" + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("1", "quarter spacing"), + ("2", "half spacing"), + ("3", "single spacing"), + ("4", "one and a half spacing"), + ("5", "triple spacing"), + ] ), ) ] ), ), ( - "mixed_content", + "single_quote", wagtail.blocks.StructBlock( [ + ("quote", wagtail.blocks.RichTextBlock(features=["bold"])), + ("attribution", wagtail.blocks.CharBlock(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( - 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." - ), - ), + "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"), ] ), ), ( - "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, + "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, ), ), - ("link_url", wagtail.blocks.URLBlock(required=False)), - ("link_text", wagtail.blocks.CharBlock(max_length=50, 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 + ), + ), + ] + ) + ), + ), + ] + ), + ), + ( + "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 + ), + ), + ("url_label", wagtail.blocks.CharBlock(required=False)), + ("url", wagtail.blocks.CharBlock(required=False)), + ( + "styling", + wagtail.blocks.ChoiceBlock( + choices=[ + ("btn-primary", "Primary button"), + ("btn-secondary", "Secondary button"), + ] + ), + ), + ( + "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.CharBlock( + 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), + ), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL for caption to link to.", + required=False, + ), + ), + ( + "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/donate/migrations/0013_copy_old_link_data_to_new_linkblock.py b/network-api/networkapi/donate/migrations/0013_copy_old_link_data_to_new_linkblock.py deleted file mode 100644 index c7f6d1db3b1..00000000000 --- a/network-api/networkapi/donate/migrations/0013_copy_old_link_data_to_new_linkblock.py +++ /dev/null @@ -1,44 +0,0 @@ -# Generated by Django 4.2.10 on 2024-02-27 12:28 -from django.db import migrations -from wagtail.blocks.migrations.migrate_operation import MigrateStreamData - -from networkapi.utility.migration.operations import AlterStreamChildBlockDataOperation - - -def migrate_image_block(source_block): - new_value = { - "image": source_block["value"]["image"], - "altText": source_block["value"]["altText"], - "caption": source_block["value"]["caption"], - "caption_url": [], - } - if "captionURL" in source_block["value"] and source_block["value"]["captionURL"]: - new_value["caption_url"] = [ - { - "link_to": "external_url", - "external_url": source_block["value"]["captionURL"], - "new_window": True, - } - ] - return { - **source_block, - "value": new_value, - } - - -class Migration(migrations.Migration): - - dependencies = [ - ("donate", "0012_alter_donatehelppage_body"), - ] - - operations = [ - MigrateStreamData( - app_name="donate", - model_name="DonateHelpPage", - field_name="body", - operations_and_block_paths=[ - (AlterStreamChildBlockDataOperation(block="image", operation=migrate_image_block), ""), - ], - ), - ] diff --git a/network-api/networkapi/donate/migrations/0014_alter_donatehelppage_body.py b/network-api/networkapi/donate/migrations/0014_alter_donatehelppage_body.py deleted file mode 100644 index 2806a04912c..00000000000 --- a/network-api/networkapi/donate/migrations/0014_alter_donatehelppage_body.py +++ /dev/null @@ -1,1424 +0,0 @@ -# Generated by Django 4.2.11 on 2024-06-12 22:34 - -from django.db import migrations -import networkapi.wagtailpages.pagemodels.blog.blog_topic -import networkapi.wagtailpages.pagemodels.profiles -import networkapi.wagtailpages.validators -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 - - -class Migration(migrations.Migration): - - dependencies = [ - ("donate", "0013_copy_old_link_data_to_new_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.CharBlock( - help_text="Optional URL that this image should link out to.", 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 - ), - ), - ] - ), - ), - ( - "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.CharBlock( - 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)), - ( - "captionURL", - wagtail.blocks.CharBlock( - help_text="Optional URL for caption to link to.", required=False - ), - ), - ( - "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)), - ( - "captionURL", - wagtail.blocks.CharBlock( - help_text="Optional URL that this caption should link out to.", required=False - ), - ), - ( - "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 - ), - ), - ] - ) - ), - ), - ] - ), - ), - ( - "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 - ), - ), - ("url_label", wagtail.blocks.CharBlock(required=False)), - ("url", wagtail.blocks.CharBlock(required=False)), - ( - "styling", - wagtail.blocks.ChoiceBlock( - choices=[ - ("btn-primary", "Primary button"), - ("btn-secondary", "Secondary button"), - ] - ), - ), - ( - "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.CharBlock( - 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), - ), - ( - "captionURL", - wagtail.blocks.CharBlock( - help_text="Optional URL for caption to link to.", - required=False, - ), - ), - ( - "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/wagtailpages/migrations/0140_alter_blogpage_body_and_more.py b/network-api/networkapi/mozfest/migrations/0052_update_annotatedimageblock_with_linkblock.py similarity index 60% rename from network-api/networkapi/wagtailpages/migrations/0140_alter_blogpage_body_and_more.py rename to network-api/networkapi/mozfest/migrations/0052_update_annotatedimageblock_with_linkblock.py index 4708fc64777..8682cc01a8c 100644 --- a/network-api/networkapi/wagtailpages/migrations/0140_alter_blogpage_body_and_more.py +++ b/network-api/networkapi/mozfest/migrations/0052_update_annotatedimageblock_with_linkblock.py @@ -1,9 +1,5 @@ -# Generated by Django 4.2.11 on 2024-06-12 22:34 +# Generated by Django 4.2.11 on 2024-06-12 21:42 -from django.db import migrations -import networkapi.wagtailpages.pagemodels.blog.blog_topic -import networkapi.wagtailpages.pagemodels.profiles -import networkapi.wagtailpages.validators import wagtail.blocks import wagtail.blocks.static_block import wagtail.documents.blocks @@ -12,125 +8,48 @@ 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_image_block(source_block): + new_value = { + "image": source_block["value"]["image"], + "altText": source_block["value"]["altText"], + "caption": source_block["value"]["caption"], + "caption_url": [], + } + if "captionURL" in source_block["value"] and source_block["value"]["captionURL"]: + new_value["caption_url"] = [ + { + "link_to": "external_url", + "external_url": source_block["value"]["captionURL"], + "new_window": True, + } + ] + return { + **source_block, + "value": new_value, + } class Migration(migrations.Migration): dependencies = [ - ("wagtailpages", "0139_copy_old_link_data_to_new_linkblock"), + ("mozfest", "0051_alter_mozfestprimarypage_body"), ] operations = [ migrations.AlterField( - model_name="blogpage", + model_name="mozfestprimarypage", name="body", field=wagtail.fields.StreamField( [ - ( - "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.CharBlock( - 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), - ), - ( - "captionURL", - wagtail.blocks.CharBlock( - help_text="Optional URL for caption to link to.", - required=False, - ), - ), - ( - "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.", - ), - ), - ] - ), - ), - ] - ), - ), - ] - ) - ), - ) - ] - ), - ), ( "paragraph", wagtail.blocks.RichTextBlock( @@ -146,6 +65,7 @@ class Migration(migrations.Migration): "ul", "hr", "document-link", + "large", ], template="wagtailpages/blocks/rich_text_block.html", ), @@ -191,54 +111,28 @@ class Migration(migrations.Migration): ), ), ( - "CTA_card", + "image", wagtail.blocks.StructBlock( [ + ("image", wagtail.images.blocks.ImageChooserBlock()), ( - "style", - wagtail.blocks.ChoiceBlock( - choices=[("pop", "Pop"), ("outline", "Outline"), ("filled", "Filled")] - ), - ), - ( - "title", + "altText", wagtail.blocks.CharBlock( - help_text="Optional title for the card.", max_length=100, required=False - ), - ), - ( - "body", - wagtail.blocks.RichTextBlock( - features=["bold", "italic", "link", "hr", "h4", "h5", "ul", "ol"], - help_text="Body text of the card.", + help_text="Image description (for screen readers).", required=True ), ), + ("caption", wagtail.blocks.CharBlock(required=False)), ( - "image", - wagtail.blocks.ListBlock( - wagtail.blocks.StructBlock( - [ - ("image", wagtail.images.blocks.ImageChooserBlock()), - ( - "altText", - wagtail.blocks.CharBlock( - help_text="Image description (for screen readers).", - required=True, - ), - ), - ] - ), - default=[], - max_num=1, - min_num=0, + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL that this caption should link out to.", required=False ), ), ( - "button", + "caption_url", wagtail.blocks.ListBlock( wagtail.blocks.StructBlock( [ - ("label", wagtail.blocks.CharBlock()), ( "link_to", wagtail.blocks.ChoiceBlock( @@ -310,187 +204,36 @@ class Migration(migrations.Migration): label="Open in new window", required=False ), ), - ( - "styling", - wagtail.blocks.ChoiceBlock( - choices=[ - ("btn-primary", "Primary button"), - ("btn-secondary", "Secondary button"), - ] - ), - ), ] ), - default=[], + 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)", + ), + ), ] ), ), ( - "CTA_card_with_text", + "image_text", wagtail.blocks.StructBlock( [ + ("image", wagtail.images.blocks.ImageChooserBlock()), ( - "alignment", - wagtail.blocks.ChoiceBlock( - choices=[("right", "Right"), ("left", "Left")], - help_text="For full-width cards, please use a regular Blog CTA Card block with a separate paragraph.", - ), - ), - ( - "card", - wagtail.blocks.StructBlock( - [ - ( - "style", - wagtail.blocks.ChoiceBlock( - choices=[ - ("pop", "Pop"), - ("outline", "Outline"), - ("filled", "Filled"), - ] - ), - ), - ( - "title", - wagtail.blocks.CharBlock( - help_text="Optional title for the card.", - max_length=100, - required=False, - ), - ), - ( - "body", - wagtail.blocks.RichTextBlock( - features=["bold", "italic", "link", "hr", "h4", "h5", "ul", "ol"], - help_text="Body text of the card.", - ), - ), - ( - "image", - wagtail.blocks.ListBlock( - wagtail.blocks.StructBlock( - [ - ("image", wagtail.images.blocks.ImageChooserBlock()), - ( - "altText", - wagtail.blocks.CharBlock( - help_text="Image description (for screen readers).", - required=True, - ), - ), - ] - ), - default=[], - max_num=1, - min_num=0, - ), - ), - ( - "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"), - ] - ), - ), - ] - ), - default=[], - max_num=1, - min_num=0, - ), - ), - ], - required=True, - template="wagtailpages/blocks/blog_cta_card_block_regular.html", + "altText", + wagtail.blocks.CharBlock( + help_text="Image description (for screen readers).", required=True ), ), ( - "paragraph", + "text", wagtail.blocks.RichTextBlock( features=[ "bold", @@ -504,103 +247,32 @@ class Migration(migrations.Migration): "ul", "hr", "document-link", - ], - help_text="Text to be displayed next to the card.", - template="wagtailpages/blocks/rich_text_block.html", + ] ), ), - ] - ), - ), - ( - "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, - ), - ), - ] - ) - ), - ) - ] - ), - ), - ( - "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)), - ( - "captionURL", - wagtail.blocks.CharBlock( - help_text="Optional URL that this caption should link out to.", required=False + help_text="Optional URL that this image should link out to.", required=False ), ), ( - "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", + "top_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider above content block.", required=False ), ), ( - "disable_scroll", + "bottom_divider", 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, + help_text="Optional divider below content block.", required=False ), ), ] ), ), ( - "image", + "image_text_mini", wagtail.blocks.StructBlock( [ ("image", wagtail.images.blocks.ImageChooserBlock()), @@ -610,197 +282,120 @@ class Migration(migrations.Migration): help_text="Image description (for screen readers).", required=True ), ), - ("caption", wagtail.blocks.CharBlock(required=False)), + ("text", wagtail.blocks.RichTextBlock(features=["bold", "italic", "link"])), + ] + ), + ), + ( + "image_grid", + wagtail.blocks.StructBlock( + [ ( - "caption_url", + "grid_items", wagtail.blocks.ListBlock( wagtail.blocks.StructBlock( [ + ("image", wagtail.images.blocks.ImageChooserBlock()), ( - "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", + "alt_text", 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() - ], + help_text="Alt text for this image.", required=False ), ), ( - "anchor", + "caption", wagtail.blocks.CharBlock( - help_text='An id attribute of an element on the current page. For example, "#section-1"', - label="#", - max_length=300, + help_text="Please remember to properly attribute any images we use.", required=False, - validators=[ - networkapi.wagtailpages.validators.AnchorLinkValidator() - ], - ), - ), - ("email", wagtail.blocks.EmailBlock(required=False)), - ( - "file", - wagtail.documents.blocks.DocumentChooserBlock( - label="File", required=False ), ), ( - "phone", + "url", wagtail.blocks.CharBlock( - label="Phone", max_length=30, required=False + help_text="Optional URL that this figure should link out to.", + required=False, ), ), ( - "new_window", + "square_image", wagtail.blocks.BooleanBlock( - label="Open in new window", required=False + default=True, + help_text="If left checked, the image will be cropped to be square.", + 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)", + ) ), - ), - ] - ), - ), - ( - "audio", - wagtail.blocks.StructBlock( - [ - ("audio", wagtailmedia.blocks.AudioChooserBlock()), - ("caption", wagtail.blocks.CharBlock(required=False)), + ) ] ), ), ( - "image_text", + "video", 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.CharBlock( - help_text="Optional URL that this image should link out to.", required=False + 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)), ( - "top_divider", - wagtail.blocks.BooleanBlock( - help_text="Optional divider above content block.", required=False + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL for caption to link to.", required=False ), ), ( - "bottom_divider", - wagtail.blocks.BooleanBlock( - help_text="Optional divider below content block.", required=False + "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.", ), ), ] ), ), ( - "image_text_mini", + "iframe", wagtail.blocks.StructBlock( [ - ("image", wagtail.images.blocks.ImageChooserBlock()), ( - "altText", + "url", wagtail.blocks.CharBlock( - help_text="Image description (for screen readers).", required=True + help_text="Please note that only URLs from allow-listed domains will work." ), ), - ("text", wagtail.blocks.RichTextBlock(features=["bold", "italic", "link"])), - ] - ), - ), - ( - "video", - wagtail.blocks.StructBlock( - [ ( - "url", - wagtail.blocks.CharBlock( - 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", + "height", + wagtail.blocks.IntegerBlock( + help_text="Optional integer pixel value for custom iFrame height", + required=False, ), ), ("caption", wagtail.blocks.CharBlock(required=False)), ( "captionURL", wagtail.blocks.CharBlock( - help_text="Optional URL for caption to link to.", required=False + help_text="Optional URL that this caption should link out to.", required=False ), ), ( - "video_width", + "iframe_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.", + 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, ), ), ] @@ -876,60 +471,65 @@ class Migration(migrations.Migration): ), ), ( - "looping_video", + "spacer", wagtail.blocks.StructBlock( [ ( - "video_url", - wagtail.blocks.CharBlock( - help_text='Log into Vimeo using 1Password and upload the desired video. Then select the video and click "Advanced", "Distribution", and "Video File Links". Copy and paste the link here.', - label="Embed URL", - ), - ) - ] - ), - ), - ( - "pulse_listing", + "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( [ ( - "search_terms", + "ids", wagtail.blocks.CharBlock( - help_text="Test your search at mozillapulse.org/search", - label="Search", - required=False, + 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=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, + default=12, + help_text="Pick up to 48 profiles.", + max_value=48, + min_value=1, 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( @@ -938,219 +538,85 @@ class Migration(migrations.Migration): ), ), ( - "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"), - ] - ), + "profile_type", + wagtail.blocks.CharBlock(default="", help_text="Example: Fellow.", required=False), ), ( - "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", + "program_type", + wagtail.blocks.CharBlock( + default="", help_text="Example: Tech Policy.", required=False ), ), + ("year", wagtail.blocks.CharBlock(default="", required=False)), ( - "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, + "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, ), ), ] ), ), ( - "single_quote", + "recent_blog_entries", wagtail.blocks.StructBlock( [ - ("quote", wagtail.blocks.RichTextBlock(features=["bold"])), - ("attribution", wagtail.blocks.CharBlock(required=False)), + ("title", wagtail.blocks.CharBlock(required=False)), ( - "attribution_info", - wagtail.blocks.RichTextBlock(features=["bold", "link", "large"], required=False), + "tag_filter", + wagtail.blocks.CharBlock( + help_text="Test this filter at foundation.mozilla.org/blog/tags/", + label="Filter by Tag", + required=False, + ), ), - ] - ), - ), - ( - "slider", - wagtail.blocks.StructBlock( - [ ( - "title", - wagtail.blocks.CharBlock(help_text="Heading for the slider.", 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, + ), ), ( - "slides", - wagtail.blocks.StreamBlock( - [ - ( - "slide", - wagtail.blocks.StructBlock( - [ - ( - "title", - wagtail.blocks.CharBlock( - help_text="Heading of the card.", required=False - ), - ), - ( - "image", - wagtail.images.blocks.ImageChooserBlock( - help_text="The image associated with this event." - ), - ), - ( - "caption", - wagtail.blocks.TextBlock( - help_text="Caption for slider image", required=False - ), - ), - ( - "body", - wagtail.blocks.RichTextBlock( - blank=True, - features=["bold", "italic", "link", "large"], - required=False, - ), - ), - ( - "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, - required=False, - ), - ), - ] - ), - ) - ], - help_text="A list of slides.", + "top_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider above content block.", required=False ), ), - ] - ), - ), - ( - "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"), - ] + "bottom_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider below content block.", required=False ), - ) + ), ] ), ), ( - "airtable", + "blog_set", wagtail.blocks.StructBlock( [ + ("title", wagtail.blocks.CharBlock()), ( - "url", - wagtail.blocks.URLBlock( - help_text="Copied from the Airtable embed code. The word 'embed' will be in the url" + "top_divider", + wagtail.blocks.BooleanBlock( + help_text="Optional divider above content block.", required=False ), ), ( - "height", - wagtail.blocks.IntegerBlock( - default=533, - help_text="The pixel height on desktop view, usually copied from the Airtable embed code", + "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"]) ), ), ] @@ -1165,220 +631,111 @@ class Migration(migrations.Migration): ), ), ( - "typeform", + "listing", 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, - ), + "heading", + wagtail.blocks.CharBlock(help_text="Heading for the block.", required=False), ), ( - "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, - ), - ), - ] - ), - ), - ( - "newsletter_signup", - wagtail.blocks.StructBlock( - [("signup", wagtail.snippets.blocks.SnippetChooserBlock("wagtailpages.BlogSignup"))] - ), - ), - ], - use_json_field=True, - ), - ), - migrations.AlterField( - model_name="buyersguidearticlepage", - name="body", - field=wagtail.fields.StreamField( - [ - ( - "accordion", - wagtail.blocks.StructBlock( - [ - ( - "accordion_items", + "cards", wagtail.blocks.ListBlock( wagtail.blocks.StructBlock( [ + ("image", wagtail.images.blocks.ImageChooserBlock()), ( - "title", + "alt_text", wagtail.blocks.CharBlock( - help_text="Heading for the Accordion Item" + help_text="Alt text for card's image.", required=False ), ), + ("title", wagtail.blocks.CharBlock(help_text="Heading for the card.")), ( - "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.CharBlock( - 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), - ), - ( - "captionURL", - wagtail.blocks.CharBlock( - help_text="Optional URL for caption to link to.", - required=False, - ), - ), - ( - "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.", - ), - ), - ] - ), - ), - ] + "highlighted_metadata", + wagtail.blocks.CharBlock( + help_text="Metadata to highlight on the card.", required=False ), ), - ] - ) - ), - ) - ] - ), - ), - ( - "paragraph", - wagtail.blocks.RichTextBlock( - features=[ - "bold", - "italic", - "link", - "h2", - "h3", - "h4", - "h5", - "ol", - "ul", - "hr", - "document-link", - ], - 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", + "metadata", wagtail.blocks.CharBlock( - help_text="Alt text for card's image.", required=False + help_text="Generic metadata.", 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.) ", + "body", + wagtail.blocks.RichTextBlock( + features=["bold"], + help_text="Body text of the card.", required=False, ), ), ( - "link_label", + "link_page", + wagtail.blocks.PageChooserBlock( + help_text="Page that this should link out to.", required=False + ), + ), + ( + "link_url", wagtail.blocks.CharBlock( - help_text="Optional Label for the URL link above. (Note: If left blank, link will not render.) ", + 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, ), ) ] ), ), ( - "image_grid", + "group_listing_block", wagtail.blocks.StructBlock( [ ( - "grid_items", + "title", + wagtail.blocks.CharBlock( + help_text="Heading for the group of cards.", required=False + ), + ), + ( + "cards", wagtail.blocks.ListBlock( wagtail.blocks.StructBlock( [ @@ -1386,685 +743,399 @@ class Migration(migrations.Migration): ( "alt_text", wagtail.blocks.CharBlock( - help_text="Alt text for this image.", required=False + help_text="Alt text for card's image.", required=False ), ), ( - "caption", + "meta_data", wagtail.blocks.CharBlock( - help_text="Please remember to properly attribute any images we use.", + help_text="Optional meta data information for the card.", required=False, ), ), + ("title", wagtail.blocks.CharBlock(help_text="Heading for the card.")), ( - "url", - wagtail.blocks.CharBlock( - help_text="Optional URL that this figure should link out to.", - required=False, + "body", + wagtail.blocks.RichTextBlock( + features=["bold", "link"], help_text="Body text of the card." ), ), ( - "square_image", - wagtail.blocks.BooleanBlock( - default=True, - help_text="If left checked, the image will be cropped to be square.", - required=False, + "url", + wagtail.blocks.CharBlock( + help_text="The URL this card should link to.", required=False ), ), ] ) ), - ) + ), ] ), ), ( - "iframe", + "image_feature", wagtail.blocks.StructBlock( [ + ("image", wagtail.images.blocks.ImageChooserBlock()), ( - "url", - wagtail.blocks.CharBlock( - help_text="Please note that only URLs from allow-listed domains will work." - ), + "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.")), ( - "height", - wagtail.blocks.IntegerBlock( - help_text="Optional integer pixel value for custom iFrame height", - required=False, + "title_link", + wagtail.blocks.PageChooserBlock( + help_text="Page that the title should link out to.", required=False ), ), - ("caption", wagtail.blocks.CharBlock(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()), ( - "captionURL", + "altText", wagtail.blocks.CharBlock( - help_text="Optional URL that this caption should link out to.", required=False + help_text="Image description (for screen readers).", required=True ), ), + ("url_label", wagtail.blocks.CharBlock(required=False)), + ("url", wagtail.blocks.CharBlock(required=False)), ( - "iframe_width", + "styling", 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", + choices=[ + ("btn-primary", "Primary button"), + ("btn-secondary", "Secondary button"), + ] ), ), ( - "disable_scroll", + "top_divider", 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, + 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_only_teaser", 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", + "cards", 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), + "heading", + wagtail.blocks.CharBlock(help_text="Heading for the card."), ), ( - "external_url", - wagtail.blocks.URLBlock( - help_text="Enter a full URL including http:// or https://", - label="External URL", - max_length=300, + "link_page", + wagtail.blocks.PageChooserBlock( + help_text="Page that the header should link out to.", required=False, ), ), ( - "relative_url", + "link_url", wagtail.blocks.CharBlock( - help_text='A path relative to this domain. For example, "/foo/bar"', - label="Relative URL", - max_length=300, + help_text="Optional URL that the header should link out to.", required=False, - validators=[ - networkapi.wagtailpages.validators.RelativeURLValidator() - ], ), ), + ("meta_data", wagtail.blocks.CharBlock(max_length=500)), ( - "anchor", - wagtail.blocks.CharBlock( - help_text='An id attribute of an element on the current page. For example, "#section-1"', - label="#", - max_length=300, + "body", + wagtail.blocks.TextBlock( + help_text="Body text of the card.", + max_length=200, 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)", - ), - ), - ] - ), - ), - ( - "audio", - wagtail.blocks.StructBlock( - [ - ("audio", wagtailmedia.blocks.AudioChooserBlock()), - ("caption", wagtail.blocks.CharBlock(required=False)), - ] - ), - ), - ( - "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.CharBlock( - help_text="Optional URL that this image should link out to.", 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 - ), - ), - ] - ), - ), - ( - "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"])), - ] - ), - ), - ( - "video", - wagtail.blocks.StructBlock( - [ - ( - "url", - wagtail.blocks.CharBlock( - 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)), - ( - "captionURL", - wagtail.blocks.CharBlock( - help_text="Optional URL for caption to link to.", required=False - ), - ), - ( - "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.", + help_text="Please use a minimum of 3 cards.", + min_num=3, ), - ), + ) ] ), ), ( - "linkbutton", + "block_with_aside", 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"), - ] - ), - ), - ] - ), - ), - ( - "looping_video", - wagtail.blocks.StructBlock( - [ - ( - "video_url", - wagtail.blocks.CharBlock( - help_text='Log into Vimeo using 1Password and upload the desired video. Then select the video and click "Advanced", "Distribution", and "Video File Links". Copy and paste the link here.', - label="Embed URL", - ), - ) - ] - ), - ), - ( - "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, - ), - ), - ] - ), - ), - ( - "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), - ), - ] - ), - ), - ( - "slider", - wagtail.blocks.StructBlock( - [ - ( - "title", - wagtail.blocks.CharBlock(help_text="Heading for the slider.", required=False), - ), - ( - "slides", + "content", wagtail.blocks.StreamBlock( [ ( - "slide", + "listing", wagtail.blocks.StructBlock( [ ( - "title", + "heading", wagtail.blocks.CharBlock( - help_text="Heading of the card.", required=False + help_text="Heading for the block.", required=False ), ), ( - "image", - wagtail.images.blocks.ImageChooserBlock( - help_text="The image associated with this event." + "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, ), ), ( - "caption", - wagtail.blocks.TextBlock( - help_text="Caption for slider image", required=False + "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( + [ ( - "body", - wagtail.blocks.RichTextBlock( - blank=True, - features=["bold", "italic", "link", "large"], - required=False, + "title", + wagtail.blocks.CharBlock( + help_text="Heading for the card.", required=False ), ), ( - "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.', - ), - ), + "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"), ], - help_text="A list of buttons that will appear at the bottom of the card.", - max_num=2, + 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="A list of slides.", - ), - ), - ] - ), - ), - ( - "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"), - ] - ), - ) - ] - ), - ), - ( - "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", - ), - ), - ] - ), - ), - ( - "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", - ), - ), - ( - "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, + 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, ), ), ] ), ), - ], - null=True, - use_json_field=True, - ), - ), - migrations.AlterField( - model_name="buyersguidecampaignpage", - name="body", - field=wagtail.fields.StreamField( - [ ( "accordion", wagtail.blocks.StructBlock( @@ -2131,1524 +1202,413 @@ class Migration(migrations.Migration): ( "url", wagtail.blocks.CharBlock( - 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), - ), - ( - "captionURL", - wagtail.blocks.CharBlock( - help_text="Optional URL for caption to link to.", - required=False, - ), - ), - ( - "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.", - ), - ), - ] - ), - ), - ] - ), - ), - ] - ) - ), - ) - ] - ), - ), - ( - "paragraph", - wagtail.blocks.RichTextBlock( - features=[ - "bold", - "italic", - "link", - "h2", - "h3", - "h4", - "h5", - "ol", - "ul", - "hr", - "document-link", - ], - 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_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, - ), - ), - ] - ) - ), - ) - ] - ), - ), - ( - "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)), - ( - "captionURL", - wagtail.blocks.CharBlock( - help_text="Optional URL that this caption should link out to.", required=False - ), - ), - ( - "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, - ), - ), - ] - ), - ), - ( - "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)", - ), - ), - ] - ), - ), - ( - "audio", - wagtail.blocks.StructBlock( - [ - ("audio", wagtailmedia.blocks.AudioChooserBlock()), - ("caption", wagtail.blocks.CharBlock(required=False)), - ] - ), - ), - ( - "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.CharBlock( - help_text="Optional URL that this image should link out to.", 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 - ), - ), - ] - ), - ), - ( - "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"])), - ] - ), - ), - ( - "video", - wagtail.blocks.StructBlock( - [ - ( - "url", - wagtail.blocks.CharBlock( - 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)), - ( - "captionURL", - wagtail.blocks.CharBlock( - help_text="Optional URL for caption to link to.", required=False - ), - ), - ( - "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.", - ), - ), - ] - ), - ), - ( - "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"), - ] - ), - ), - ] - ), - ), - ( - "looping_video", - wagtail.blocks.StructBlock( - [ - ( - "video_url", - wagtail.blocks.CharBlock( - help_text='Log into Vimeo using 1Password and upload the desired video. Then select the video and click "Advanced", "Distribution", and "Video File Links". Copy and paste the link here.', - label="Embed URL", - ), - ) - ] - ), - ), - ( - "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, - ), - ), - ] - ), - ), - ( - "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), - ), - ] - ), - ), - ( - "slider", - wagtail.blocks.StructBlock( - [ - ( - "title", - wagtail.blocks.CharBlock(help_text="Heading for the slider.", required=False), - ), - ( - "slides", - wagtail.blocks.StreamBlock( - [ - ( - "slide", - wagtail.blocks.StructBlock( - [ - ( - "title", - wagtail.blocks.CharBlock( - help_text="Heading of the card.", required=False - ), - ), - ( - "image", - wagtail.images.blocks.ImageChooserBlock( - help_text="The image associated with this event." - ), - ), - ( - "caption", - wagtail.blocks.TextBlock( - help_text="Caption for slider image", required=False - ), - ), - ( - "body", - wagtail.blocks.RichTextBlock( - blank=True, - features=["bold", "italic", "link", "large"], - required=False, - ), - ), - ( - "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, - required=False, - ), - ), - ] - ), - ) - ], - help_text="A list of slides.", - ), - ), - ] - ), - ), - ( - "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"), - ] - ), - ) - ] - ), - ), - ( - "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", - ), - ), - ] - ), - ), - ( - "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", - ), - ), - ( - "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, - ), - ), - ] - ), - ), - ], - use_json_field=True, - ), - ), - 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.CharBlock( - help_text="Optional URL that this image should link out to.", 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 - ), - ), - ] - ), - ), - ( - "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.CharBlock( - 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)), - ( - "captionURL", - wagtail.blocks.CharBlock( - help_text="Optional URL for caption to link to.", required=False - ), - ), - ( - "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)), - ( - "captionURL", - wagtail.blocks.CharBlock( - help_text="Optional URL that this caption should link out to.", required=False - ), - ), - ( - "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", + 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), + ), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL for caption to link to.", + required=False, + ), + ), + ( + "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.", + ), + ), + ] + ), + ), + ] + ), + ), + ] + ) ), ) ] ), ), ( - "profile_directory", + "session_slider", wagtail.blocks.StructBlock( [ + ("title", wagtail.blocks.CharBlock(help_text="Heading for the slider.")), ( - "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 + "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.", ), ), - ("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, + "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, ), ), ] ), ), ( - "recent_blog_entries", + "current_events_slider", 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, - ), - ), + ("title", wagtail.blocks.CharBlock(help_text="Heading for the slider.")), ( - "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 + "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.", ), ), ] ), ), ( - "blog_set", + "spaces", 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", + "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.", ), ), ] ), ), ( - "typeform", + "tito_widget", 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_label", + wagtail.blocks.CharBlock(help_text="The text to show on the Tito button."), ), ( - "button_type", + "styling", wagtail.blocks.ChoiceBlock( choices=[ ("btn-primary", "Primary button"), @@ -3657,88 +1617,15 @@ class Migration(migrations.Migration): ), ), ( - "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, + "event", + wagtail.snippets.blocks.SnippetChooserBlock( + "events.TitoEvent", help_event="The Tito event to be displayed" ), ), ( - "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.", + "releases", + wagtail.blocks.CharBlock( + help_text='Comma-separated list of ticket/release IDs to limit to, e.g. "3elajg6qcxu,6qiiw4socs4"', required=False, ), ), @@ -3746,568 +1633,283 @@ class Migration(migrations.Migration): ), ), ( - "profiles", + "statistics", wagtail.blocks.StructBlock( [ ( - "profiles", + "statistics", wagtail.blocks.ListBlock( wagtail.blocks.StructBlock( [ ( - "profile", - wagtail.snippets.blocks.SnippetChooserBlock( - networkapi.wagtailpages.pagemodels.profiles.Profile + "title", + wagtail.blocks.CharBlock( + help_text="The statistic figure, e.g '1000+' or '10%'" ), - ) - ] - ), - 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, + ), + ( + "description", + wagtail.blocks.CharBlock( + help_text="Context or description for the statistic" ), - ) + ), ] ), - help_text="Please use a minimum of 3 cards.", - min_num=3, + help_text="Please use a minimum of 2 cards.", + max_num=4, + min_num=2, ), ) ] ), ), ( - "group_listing_block", + "carousel_and_text", wagtail.blocks.StructBlock( [ ( - "title", - wagtail.blocks.CharBlock( - help_text="Heading for the group of cards.", required=False + "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 ), ), ( - "cards", + "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()), ( - "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", + "altText", wagtail.blocks.CharBlock( - help_text="The URL this card should link to.", required=False + help_text="Image description (for screen readers).", + required=True, ), ), ] - ) + ), + max_num=4, ), ), ] ), ), ( - "image_feature", + "tickets", wagtail.blocks.StructBlock( [ - ("image", wagtail.images.blocks.ImageChooserBlock()), ( - "alt_text", - wagtail.blocks.CharBlock(help_text="Image description (for screen readers)."), + "heading", + wagtail.blocks.CharBlock(help_text="Heading for the block.", required=False), ), - ("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 + "tickets", + wagtail.blocks.ListBlock( + wagtail.snippets.blocks.SnippetChooserBlock("mozfest.Ticket"), max_num=3 ), ), - ("body", wagtail.blocks.CharBlock(required=False)), ] ), ), ( - "image_teaser_block", + "dark_quote", wagtail.blocks.StructBlock( [ - ("title", wagtail.blocks.CharBlock(help_text="Heading for the card.")), - ("text", wagtail.blocks.RichTextBlock(features=["bold"])), - ("image", wagtail.images.blocks.ImageChooserBlock()), + ("quote", wagtail.blocks.RichTextBlock(features=["bold"])), + ("attribution", wagtail.blocks.CharBlock(required=False)), ( - "altText", - wagtail.blocks.CharBlock( - help_text="Image description (for screen readers).", required=True - ), + "attribution_info", + wagtail.blocks.RichTextBlock(features=["bold", "link", "large"], required=False), ), - ("url_label", wagtail.blocks.CharBlock(required=False)), - ("url", wagtail.blocks.CharBlock(required=False)), + ] + ), + ), + ( + "cta", + wagtail.blocks.StructBlock( + [ + ("label", wagtail.blocks.CharBlock()), ( - "styling", + "link_to", wagtail.blocks.ChoiceBlock( choices=[ - ("btn-primary", "Primary button"), - ("btn-secondary", "Secondary button"), - ] + ("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)), ( - "top_divider", - wagtail.blocks.BooleanBlock( - help_text="Optional divider above content block.", 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, ), ), ( - "bottom_divider", - wagtail.blocks.BooleanBlock( - help_text="Optional divider below content block.", 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)), ] ), ), ( - "text_only_teaser", + "newsletter_signup", 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, + "snippet", + wagtail.snippets.blocks.SnippetChooserBlock( + "mozfest.NewsletterSignupWithBackground" ), ) ] ), ), ( - "block_with_aside", + "mixed_content", wagtail.blocks.StructBlock( [ ( - "content", - wagtail.blocks.StreamBlock( + "video", + wagtail.blocks.StructBlock( [ ( - "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, - ), - ), - ] + "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", ), ), ( - "paragraph", - wagtail.blocks.RichTextBlock( - features=[ - "bold", - "italic", - "link", - "h2", - "h3", - "h4", - "h5", - "ol", - "ul", - "hr", - "document-link", - ] + "caption", + wagtail.blocks.CharBlock( + help_text="Optional caption for the video, displayed next to the play button.", + max_length=25, + required=False, ), ), - ], - 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 - ), - ), - ] + "title", + wagtail.blocks.CharBlock( + help_text="Optional title for the video.", + max_length=50, + 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"), - ] - ), - ), - ] + "text", + wagtail.blocks.CharBlock( + help_text="Text content to display with the video title.", + required=False, ), ), ( - "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"), - ] - ), - ) - ] + "thumbnail", + wagtail.images.blocks.ImageChooserBlock( + help_text="The image to show before the video is played." ), ), - ], - 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", + "cards", wagtail.blocks.ListBlock( wagtail.blocks.StructBlock( [ + ("image", wagtail.images.blocks.ImageChooserBlock()), ( - "title", + "alt_text", wagtail.blocks.CharBlock( - help_text="Heading for the Accordion Item" + help_text="Alt text for card's image.", required=False ), ), + ("title", wagtail.blocks.CharBlock(help_text="Heading for the card.")), ( - "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.CharBlock( - 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), - ), - ( - "captionURL", - wagtail.blocks.CharBlock( - help_text="Optional URL for caption to link to.", - required=False, - ), - ), - ( - "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.", - ), - ), - ] - ), - ), - ] + "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)), ] ), ), @@ -4315,8 +1917,16 @@ class Migration(migrations.Migration): use_json_field=True, ), ), + MigrateStreamData( + app_name="mozfest", + model_name="mozfestprimarypage", + field_name="body", + operations_and_block_paths=[ + (AlterStreamChildBlockDataOperation(block="image", operation=migrate_image_block), ""), + ], + ), migrations.AlterField( - model_name="primarypage", + model_name="mozfestprimarypage", name="body", field=wagtail.fields.StreamField( [ @@ -4766,136 +2376,6 @@ class Migration(migrations.Migration): ] ), ), - ( - "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( @@ -5016,56 +2496,6 @@ class Migration(migrations.Migration): ] ), ), - ( - "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( @@ -5164,12 +2594,121 @@ class Migration(migrations.Migration): ), 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 + ), + ), + ] + ) + ), + ), + ] + ), + ), + ( + "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 + ), + ), + ("url_label", wagtail.blocks.CharBlock(required=False)), + ("url", wagtail.blocks.CharBlock(required=False)), + ( + "styling", + wagtail.blocks.ChoiceBlock( + choices=[ + ("btn-primary", "Primary button"), + ("btn-secondary", "Secondary button"), + ] + ), + ), + ( + "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 + ), + ), ] ), ), ( - "article_teaser_block", + "text_only_teaser", wagtail.blocks.StructBlock( [ ( @@ -5178,536 +2717,1073 @@ class Migration(migrations.Migration): wagtail.blocks.StructBlock( [ ( - "article", + "heading", + wagtail.blocks.CharBlock(help_text="Heading for the card."), + ), + ( + "link_page", wagtail.blocks.PageChooserBlock( - help_text="Page that this should link out to.", - page_type=["wagtailpages.ArticlePage"], + 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, + ), + ), ] ), ), ( - "group_listing_block", + "accordion", wagtail.blocks.StructBlock( [ ( - "title", - wagtail.blocks.CharBlock( - help_text="Heading for the group of cards.", required=False - ), - ), - ( - "cards", + "accordion_items", 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", + "title", 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." + help_text="Heading for the Accordion Item" ), ), ( - "url", - wagtail.blocks.CharBlock( - help_text="The URL this card should link to.", required=False + "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.CharBlock( + 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), + ), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL for caption to link to.", + required=False, + ), + ), + ( + "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.", + ), + ), + ] + ), + ), + ] ), ), ] ) ), - ), - ] - ), - ), - ( - "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", + "session_slider", 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 - ), - ), - ("url_label", wagtail.blocks.CharBlock(required=False)), - ("url", wagtail.blocks.CharBlock(required=False)), - ( - "styling", - wagtail.blocks.ChoiceBlock( - choices=[ - ("btn-primary", "Primary button"), - ("btn-secondary", "Secondary button"), - ] - ), - ), - ( - "top_divider", - wagtail.blocks.BooleanBlock( - help_text="Optional divider above content block.", required=False - ), - ), + ("title", wagtail.blocks.CharBlock(help_text="Heading for the slider.")), ( - "bottom_divider", - wagtail.blocks.BooleanBlock( - help_text="Optional divider below content block.", required=False + "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.", ), ), - ] - ), - ), - ( - "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, - ), + "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." + ), + ), + ] ), - ("meta_data", wagtail.blocks.CharBlock(max_length=500)), - ( - "body", - wagtail.blocks.TextBlock( - help_text="Body text of the card.", - max_length=200, - required=False, - ), + ), + ( + "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="Please use a minimum of 3 cards.", - min_num=3, + ), + ], + help_text="Button that appears below the slider.", + max_num=1, + required=False, ), - ) + ), ] ), ), ( - "block_with_aside", + "current_events_slider", wagtail.blocks.StructBlock( [ + ("title", wagtail.blocks.CharBlock(help_text="Heading for the slider.")), ( - "content", + "current_events", wagtail.blocks.StreamBlock( [ ( - "listing", + "current_event", wagtail.blocks.StructBlock( [ ( - "heading", - wagtail.blocks.CharBlock( - help_text="Heading for the block.", required=False - ), + "title", + wagtail.blocks.CharBlock(help_text="Heading of the card."), ), ( - "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, - ), + "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." + ), + ), + ] ), - ( - "link_url", - wagtail.blocks.CharBlock( - help_text="Optional URL that the header should link out to.", - required=False, - ), + ), + ( + "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="Please use a minimum of 2 cards.", - min_num=2, + ), + ], + help_text="The link that appears below the card heading.", + max_num=1, + required=False, ), ), ( - "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, + "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, ), ), ] ), - ), - ( - "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, + help_text="A list of current events in the slider.", ), ), + ] + ), + ), + ( + "spaces", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock()), ( - "aside", + "cards", wagtail.blocks.StreamBlock( [ ( - "aside_content", + "space_card", wagtail.blocks.StructBlock( [ + ("image", wagtail.images.blocks.ImageChooserBlock()), ( "title", wagtail.blocks.CharBlock( - help_text="Heading for the card.", required=False + help_text="Heading for the card." ), ), ( "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() - ], + help_text="Body text of the card." ), ), ( - "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() + "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." + ), + ) + ] + ), + ), ], - ), - ), - ("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="Page or external URL this card will link out to.", + max_num=1, ), ), ] ), - ), - ( - "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="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"), ], - 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", + 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)), ] ), ), ( - "accordion", + "newsletter_signup", wagtail.blocks.StructBlock( [ ( - "accordion_items", + "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()), ( - "title", + "alt_text", wagtail.blocks.CharBlock( - help_text="Heading for the Accordion Item" + help_text="Alt text for card's image.", required=False ), ), + ("title", wagtail.blocks.CharBlock(help_text="Heading for the card.")), ( - "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.CharBlock( - 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), - ), - ( - "captionURL", - wagtail.blocks.CharBlock( - help_text="Optional URL for caption to link to.", - required=False, - ), - ), - ( - "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.", - ), - ), - ] - ), - ), - ] + "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)), ] ), ), diff --git a/network-api/networkapi/mozfest/migrations/0053_copy_old_link_data_to_new_linkblock.py b/network-api/networkapi/mozfest/migrations/0053_copy_old_link_data_to_new_linkblock.py deleted file mode 100644 index 4934e2bf90a..00000000000 --- a/network-api/networkapi/mozfest/migrations/0053_copy_old_link_data_to_new_linkblock.py +++ /dev/null @@ -1,44 +0,0 @@ -# Generated by Django 4.2.10 on 2024-02-27 12:28 -from django.db import migrations -from wagtail.blocks.migrations.migrate_operation import MigrateStreamData - -from networkapi.utility.migration.operations import AlterStreamChildBlockDataOperation - - -def migrate_image_block(source_block): - new_value = { - "image": source_block["value"]["image"], - "altText": source_block["value"]["altText"], - "caption": source_block["value"]["caption"], - "caption_url": [], - } - if "captionURL" in source_block["value"] and source_block["value"]["captionURL"]: - new_value["caption_url"] = [ - { - "link_to": "external_url", - "external_url": source_block["value"]["captionURL"], - "new_window": True, - } - ] - return { - **source_block, - "value": new_value, - } - - -class Migration(migrations.Migration): - - dependencies = [ - ("mozfest", "0052_alter_mozfestprimarypage_body"), - ] - - operations = [ - MigrateStreamData( - app_name="mozfest", - model_name="mozfestprimarypage", - field_name="body", - operations_and_block_paths=[ - (AlterStreamChildBlockDataOperation(block="image", operation=migrate_image_block), ""), - ], - ), - ] diff --git a/network-api/networkapi/mozfest/migrations/0054_alter_mozfestprimarypage_body.py b/network-api/networkapi/mozfest/migrations/0054_alter_mozfestprimarypage_body.py deleted file mode 100644 index eb8bc0951fd..00000000000 --- a/network-api/networkapi/mozfest/migrations/0054_alter_mozfestprimarypage_body.py +++ /dev/null @@ -1,1890 +0,0 @@ -# Generated by Django 4.2.11 on 2024-06-12 22:34 - -from django.db import migrations -import networkapi.wagtailpages.pagemodels.blog.blog_topic -import networkapi.wagtailpages.pagemodels.profiles -import networkapi.wagtailpages.validators -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 - - -class Migration(migrations.Migration): - - dependencies = [ - ("mozfest", "0053_copy_old_link_data_to_new_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.CharBlock( - help_text="Optional URL that this image should link out to.", 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 - ), - ), - ] - ), - ), - ( - "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.CharBlock( - 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)), - ( - "captionURL", - wagtail.blocks.CharBlock( - help_text="Optional URL for caption to link to.", required=False - ), - ), - ( - "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)), - ( - "captionURL", - wagtail.blocks.CharBlock( - help_text="Optional URL that this caption should link out to.", required=False - ), - ), - ( - "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 - ), - ), - ] - ) - ), - ), - ] - ), - ), - ( - "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 - ), - ), - ("url_label", wagtail.blocks.CharBlock(required=False)), - ("url", wagtail.blocks.CharBlock(required=False)), - ( - "styling", - wagtail.blocks.ChoiceBlock( - choices=[ - ("btn-primary", "Primary button"), - ("btn-secondary", "Secondary button"), - ] - ), - ), - ( - "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.CharBlock( - 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), - ), - ( - "captionURL", - wagtail.blocks.CharBlock( - help_text="Optional URL for caption to link to.", - required=False, - ), - ), - ( - "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/0138_alter_blogpage_body_and_more.py b/network-api/networkapi/wagtailpages/migrations/0138_update_annotatedimageblock_with_linkblock.py similarity index 50% rename from network-api/networkapi/wagtailpages/migrations/0138_alter_blogpage_body_and_more.py rename to network-api/networkapi/wagtailpages/migrations/0138_update_annotatedimageblock_with_linkblock.py index 58a84289cb2..bd4c2c475b1 100644 --- a/network-api/networkapi/wagtailpages/migrations/0138_alter_blogpage_body_and_more.py +++ b/network-api/networkapi/wagtailpages/migrations/0138_update_annotatedimageblock_with_linkblock.py @@ -9,10 +9,33 @@ 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_image_block(source_block): + new_value = { + "image": source_block["value"]["image"], + "altText": source_block["value"]["altText"], + "caption": source_block["value"]["caption"], + "caption_url": [], + } + if "captionURL" in source_block["value"] and source_block["value"]["captionURL"]: + new_value["caption_url"] = [ + { + "link_to": "external_url", + "external_url": source_block["value"]["captionURL"], + "new_window": True, + } + ] + return { + **source_block, + "value": new_value, + } class Migration(migrations.Migration): @@ -5746,4 +5769,5706 @@ class Migration(migrations.Migration): use_json_field=True, ), ), + MigrateStreamData( + app_name="wagtailpages", + model_name="blogpage", + field_name="body", + operations_and_block_paths=[ + (AlterStreamChildBlockDataOperation(block="image", operation=migrate_image_block), ""), + ], + ), + migrations.AlterField( + model_name="blogpage", + name="body", + field=wagtail.fields.StreamField( + [ + ( + "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.CharBlock( + 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), + ), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL for caption to link to.", + required=False, + ), + ), + ( + "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.", + ), + ), + ] + ), + ), + ] + ), + ), + ] + ) + ), + ) + ] + ), + ), + ( + "paragraph", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "h2", + "h3", + "h4", + "h5", + "ol", + "ul", + "hr", + "document-link", + ], + 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.", + ), + ) + ] + ), + ), + ( + "CTA_card", + wagtail.blocks.StructBlock( + [ + ( + "style", + wagtail.blocks.ChoiceBlock( + choices=[("pop", "Pop"), ("outline", "Outline"), ("filled", "Filled")] + ), + ), + ( + "title", + wagtail.blocks.CharBlock( + help_text="Optional title for the card.", max_length=100, required=False + ), + ), + ( + "body", + wagtail.blocks.RichTextBlock( + features=["bold", "italic", "link", "hr", "h4", "h5", "ul", "ol"], + help_text="Body text of the card.", + ), + ), + ( + "image", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "altText", + wagtail.blocks.CharBlock( + help_text="Image description (for screen readers).", + required=True, + ), + ), + ] + ), + default=[], + max_num=1, + min_num=0, + ), + ), + ( + "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"), + ] + ), + ), + ] + ), + default=[], + max_num=1, + min_num=0, + ), + ), + ] + ), + ), + ( + "CTA_card_with_text", + wagtail.blocks.StructBlock( + [ + ( + "alignment", + wagtail.blocks.ChoiceBlock( + choices=[("right", "Right"), ("left", "Left")], + help_text="For full-width cards, please use a regular Blog CTA Card block with a separate paragraph.", + ), + ), + ( + "card", + wagtail.blocks.StructBlock( + [ + ( + "style", + wagtail.blocks.ChoiceBlock( + choices=[ + ("pop", "Pop"), + ("outline", "Outline"), + ("filled", "Filled"), + ] + ), + ), + ( + "title", + wagtail.blocks.CharBlock( + help_text="Optional title for the card.", + max_length=100, + required=False, + ), + ), + ( + "body", + wagtail.blocks.RichTextBlock( + features=["bold", "italic", "link", "hr", "h4", "h5", "ul", "ol"], + help_text="Body text of the card.", + ), + ), + ( + "image", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("image", wagtail.images.blocks.ImageChooserBlock()), + ( + "altText", + wagtail.blocks.CharBlock( + help_text="Image description (for screen readers).", + required=True, + ), + ), + ] + ), + default=[], + max_num=1, + min_num=0, + ), + ), + ( + "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"), + ] + ), + ), + ] + ), + default=[], + max_num=1, + min_num=0, + ), + ), + ], + required=True, + template="wagtailpages/blocks/blog_cta_card_block_regular.html", + ), + ), + ( + "paragraph", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "h2", + "h3", + "h4", + "h5", + "ol", + "ul", + "hr", + "document-link", + ], + help_text="Text to be displayed next to the card.", + template="wagtailpages/blocks/rich_text_block.html", + ), + ), + ] + ), + ), + ( + "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, + ), + ), + ] + ) + ), + ) + ] + ), + ), + ( + "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)), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL that this caption should link out to.", required=False + ), + ), + ( + "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, + ), + ), + ] + ), + ), + ( + "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)", + ), + ), + ] + ), + ), + ( + "audio", + wagtail.blocks.StructBlock( + [ + ("audio", wagtailmedia.blocks.AudioChooserBlock()), + ("caption", wagtail.blocks.CharBlock(required=False)), + ] + ), + ), + ( + "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.CharBlock( + help_text="Optional URL that this image should link out to.", 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 + ), + ), + ] + ), + ), + ( + "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"])), + ] + ), + ), + ( + "video", + wagtail.blocks.StructBlock( + [ + ( + "url", + wagtail.blocks.CharBlock( + 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)), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL for caption to link to.", required=False + ), + ), + ( + "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.", + ), + ), + ] + ), + ), + ( + "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"), + ] + ), + ), + ] + ), + ), + ( + "looping_video", + wagtail.blocks.StructBlock( + [ + ( + "video_url", + wagtail.blocks.CharBlock( + help_text='Log into Vimeo using 1Password and upload the desired video. Then select the video and click "Advanced", "Distribution", and "Video File Links". Copy and paste the link here.', + label="Embed URL", + ), + ) + ] + ), + ), + ( + "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, + ), + ), + ] + ), + ), + ( + "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), + ), + ] + ), + ), + ( + "slider", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock(help_text="Heading for the slider.", required=False), + ), + ( + "slides", + wagtail.blocks.StreamBlock( + [ + ( + "slide", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + help_text="Heading of the card.", required=False + ), + ), + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + help_text="The image associated with this event." + ), + ), + ( + "caption", + wagtail.blocks.TextBlock( + help_text="Caption for slider image", required=False + ), + ), + ( + "body", + wagtail.blocks.RichTextBlock( + blank=True, + features=["bold", "italic", "link", "large"], + required=False, + ), + ), + ( + "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, + required=False, + ), + ), + ] + ), + ) + ], + help_text="A list of slides.", + ), + ), + ] + ), + ), + ( + "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"), + ] + ), + ) + ] + ), + ), + ( + "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", + ), + ), + ] + ), + ), + ( + "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", + ), + ), + ( + "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, + ), + ), + ] + ), + ), + ( + "newsletter_signup", + wagtail.blocks.StructBlock( + [("signup", wagtail.snippets.blocks.SnippetChooserBlock("wagtailpages.BlogSignup"))] + ), + ), + ], + use_json_field=True, + ), + ), + migrations.AlterField( + model_name="buyersguidearticlepage", + name="body", + field=wagtail.fields.StreamField( + [ + ( + "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.CharBlock( + 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), + ), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL for caption to link to.", + required=False, + ), + ), + ( + "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.", + ), + ), + ] + ), + ), + ] + ), + ), + ] + ) + ), + ) + ] + ), + ), + ( + "paragraph", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "h2", + "h3", + "h4", + "h5", + "ol", + "ul", + "hr", + "document-link", + ], + 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_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, + ), + ), + ] + ) + ), + ) + ] + ), + ), + ( + "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)), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL that this caption should link out to.", required=False + ), + ), + ( + "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, + ), + ), + ] + ), + ), + ( + "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)", + ), + ), + ] + ), + ), + ( + "audio", + wagtail.blocks.StructBlock( + [ + ("audio", wagtailmedia.blocks.AudioChooserBlock()), + ("caption", wagtail.blocks.CharBlock(required=False)), + ] + ), + ), + ( + "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.CharBlock( + help_text="Optional URL that this image should link out to.", 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 + ), + ), + ] + ), + ), + ( + "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"])), + ] + ), + ), + ( + "video", + wagtail.blocks.StructBlock( + [ + ( + "url", + wagtail.blocks.CharBlock( + 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)), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL for caption to link to.", required=False + ), + ), + ( + "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.", + ), + ), + ] + ), + ), + ( + "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"), + ] + ), + ), + ] + ), + ), + ( + "looping_video", + wagtail.blocks.StructBlock( + [ + ( + "video_url", + wagtail.blocks.CharBlock( + help_text='Log into Vimeo using 1Password and upload the desired video. Then select the video and click "Advanced", "Distribution", and "Video File Links". Copy and paste the link here.', + label="Embed URL", + ), + ) + ] + ), + ), + ( + "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, + ), + ), + ] + ), + ), + ( + "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), + ), + ] + ), + ), + ( + "slider", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock(help_text="Heading for the slider.", required=False), + ), + ( + "slides", + wagtail.blocks.StreamBlock( + [ + ( + "slide", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + help_text="Heading of the card.", required=False + ), + ), + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + help_text="The image associated with this event." + ), + ), + ( + "caption", + wagtail.blocks.TextBlock( + help_text="Caption for slider image", required=False + ), + ), + ( + "body", + wagtail.blocks.RichTextBlock( + blank=True, + features=["bold", "italic", "link", "large"], + required=False, + ), + ), + ( + "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, + required=False, + ), + ), + ] + ), + ) + ], + help_text="A list of slides.", + ), + ), + ] + ), + ), + ( + "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"), + ] + ), + ) + ] + ), + ), + ( + "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", + ), + ), + ] + ), + ), + ( + "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", + ), + ), + ( + "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, + ), + ), + ] + ), + ), + ], + null=True, + use_json_field=True, + ), + ), + migrations.AlterField( + model_name="buyersguidecampaignpage", + name="body", + field=wagtail.fields.StreamField( + [ + ( + "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.CharBlock( + 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), + ), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL for caption to link to.", + required=False, + ), + ), + ( + "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.", + ), + ), + ] + ), + ), + ] + ), + ), + ] + ) + ), + ) + ] + ), + ), + ( + "paragraph", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "h2", + "h3", + "h4", + "h5", + "ol", + "ul", + "hr", + "document-link", + ], + 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_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, + ), + ), + ] + ) + ), + ) + ] + ), + ), + ( + "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)), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL that this caption should link out to.", required=False + ), + ), + ( + "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, + ), + ), + ] + ), + ), + ( + "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)", + ), + ), + ] + ), + ), + ( + "audio", + wagtail.blocks.StructBlock( + [ + ("audio", wagtailmedia.blocks.AudioChooserBlock()), + ("caption", wagtail.blocks.CharBlock(required=False)), + ] + ), + ), + ( + "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.CharBlock( + help_text="Optional URL that this image should link out to.", 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 + ), + ), + ] + ), + ), + ( + "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"])), + ] + ), + ), + ( + "video", + wagtail.blocks.StructBlock( + [ + ( + "url", + wagtail.blocks.CharBlock( + 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)), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL for caption to link to.", required=False + ), + ), + ( + "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.", + ), + ), + ] + ), + ), + ( + "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"), + ] + ), + ), + ] + ), + ), + ( + "looping_video", + wagtail.blocks.StructBlock( + [ + ( + "video_url", + wagtail.blocks.CharBlock( + help_text='Log into Vimeo using 1Password and upload the desired video. Then select the video and click "Advanced", "Distribution", and "Video File Links". Copy and paste the link here.', + label="Embed URL", + ), + ) + ] + ), + ), + ( + "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, + ), + ), + ] + ), + ), + ( + "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), + ), + ] + ), + ), + ( + "slider", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock(help_text="Heading for the slider.", required=False), + ), + ( + "slides", + wagtail.blocks.StreamBlock( + [ + ( + "slide", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + help_text="Heading of the card.", required=False + ), + ), + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + help_text="The image associated with this event." + ), + ), + ( + "caption", + wagtail.blocks.TextBlock( + help_text="Caption for slider image", required=False + ), + ), + ( + "body", + wagtail.blocks.RichTextBlock( + blank=True, + features=["bold", "italic", "link", "large"], + required=False, + ), + ), + ( + "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, + required=False, + ), + ), + ] + ), + ) + ], + help_text="A list of slides.", + ), + ), + ] + ), + ), + ( + "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"), + ] + ), + ) + ] + ), + ), + ( + "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", + ), + ), + ] + ), + ), + ( + "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", + ), + ), + ( + "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, + ), + ), + ] + ), + ), + ], + use_json_field=True, + ), + ), + 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.CharBlock( + help_text="Optional URL that this image should link out to.", 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 + ), + ), + ] + ), + ), + ( + "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.CharBlock( + 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)), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL for caption to link to.", required=False + ), + ), + ( + "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)), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL that this caption should link out to.", required=False + ), + ), + ( + "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 + ), + ), + ] + ) + ), + ), + ] + ), + ), + ( + "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 + ), + ), + ("url_label", wagtail.blocks.CharBlock(required=False)), + ("url", wagtail.blocks.CharBlock(required=False)), + ( + "styling", + wagtail.blocks.ChoiceBlock( + choices=[ + ("btn-primary", "Primary button"), + ("btn-secondary", "Secondary button"), + ] + ), + ), + ( + "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.CharBlock( + 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), + ), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL for caption to link to.", + required=False, + ), + ), + ( + "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.CharBlock( + help_text="Optional URL that this image should link out to.", 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 + ), + ), + ] + ), + ), + ( + "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.CharBlock( + 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)), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL for caption to link to.", required=False + ), + ), + ( + "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)), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL that this caption should link out to.", required=False + ), + ), + ( + "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 + ), + ), + ] + ) + ), + ), + ] + ), + ), + ( + "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 + ), + ), + ("url_label", wagtail.blocks.CharBlock(required=False)), + ("url", wagtail.blocks.CharBlock(required=False)), + ( + "styling", + wagtail.blocks.ChoiceBlock( + choices=[ + ("btn-primary", "Primary button"), + ("btn-secondary", "Secondary button"), + ] + ), + ), + ( + "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.CharBlock( + 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), + ), + ( + "captionURL", + wagtail.blocks.CharBlock( + help_text="Optional URL for caption to link to.", + required=False, + ), + ), + ( + "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/migrations/0139_copy_old_link_data_to_new_linkblock.py b/network-api/networkapi/wagtailpages/migrations/0139_copy_old_link_data_to_new_linkblock.py deleted file mode 100644 index 69ab035c7fe..00000000000 --- a/network-api/networkapi/wagtailpages/migrations/0139_copy_old_link_data_to_new_linkblock.py +++ /dev/null @@ -1,44 +0,0 @@ -# Generated by Django 4.2.10 on 2024-02-27 12:28 -from django.db import migrations -from wagtail.blocks.migrations.migrate_operation import MigrateStreamData - -from networkapi.utility.migration.operations import AlterStreamChildBlockDataOperation - - -def migrate_image_block(source_block): - new_value = { - "image": source_block["value"]["image"], - "altText": source_block["value"]["altText"], - "caption": source_block["value"]["caption"], - "caption_url": [], - } - if "captionURL" in source_block["value"] and source_block["value"]["captionURL"]: - new_value["caption_url"] = [ - { - "link_to": "external_url", - "external_url": source_block["value"]["captionURL"], - "new_window": True, - } - ] - return { - **source_block, - "value": new_value, - } - - -class Migration(migrations.Migration): - - dependencies = [ - ("wagtailpages", "0138_alter_blogpage_body_and_more"), - ] - - operations = [ - MigrateStreamData( - app_name="wagtailpages", - model_name="blogpage", - field_name="body", - operations_and_block_paths=[ - (AlterStreamChildBlockDataOperation(block="image", operation=migrate_image_block), ""), - ], - ), - ] From ab23a91f8759f8d8725c0fe5f43c55c1c367fd38 Mon Sep 17 00:00:00 2001 From: danielfmiranda Date: Thu, 13 Jun 2024 17:57:11 -0700 Subject: [PATCH 07/11] updated streamfield provider to account for new caption_url format --- .../networkapi/utility/faker/streamfield_provider.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/network-api/networkapi/utility/faker/streamfield_provider.py b/network-api/networkapi/utility/faker/streamfield_provider.py index 9db1610ae78..bb571638201 100644 --- a/network-api/networkapi/utility/faker/streamfield_provider.py +++ b/network-api/networkapi/utility/faker/streamfield_provider.py @@ -84,7 +84,13 @@ def generate_image_field(): image_id = choice(Image.objects.all()).id alt_text = " ".join(fake.words(nb=5)) caption = " ".join(fake.words(nb=5)) - caption_url = fake.url(schemes=["https"]) + caption_external_url = [ + { + "link_to": "external_url", + "external_url": fake.url(schemes=["https"]), + "new_window": True, + } + ] return generate_field( "image", @@ -92,7 +98,7 @@ def generate_image_field(): "image": image_id, "altText": alt_text, "caption": caption, - "captionURL": caption_url, + "caption_url": caption_external_url }, ) From 9f340505eb012190abb7e556232f89db2d4790cd Mon Sep 17 00:00:00 2001 From: danielfmiranda Date: Thu, 13 Jun 2024 18:05:12 -0700 Subject: [PATCH 08/11] formatting python --- .../networkapi/utility/faker/streamfield_provider.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/network-api/networkapi/utility/faker/streamfield_provider.py b/network-api/networkapi/utility/faker/streamfield_provider.py index bb571638201..48990b14213 100644 --- a/network-api/networkapi/utility/faker/streamfield_provider.py +++ b/network-api/networkapi/utility/faker/streamfield_provider.py @@ -94,12 +94,7 @@ def generate_image_field(): return generate_field( "image", - { - "image": image_id, - "altText": alt_text, - "caption": caption, - "caption_url": caption_external_url - }, + {"image": image_id, "altText": alt_text, "caption": caption, "caption_url": caption_external_url}, ) From 909b45f47014e3cc2bea12c85cf8ec07e634a969 Mon Sep 17 00:00:00 2001 From: danielfmiranda Date: Thu, 13 Jun 2024 18:28:38 -0700 Subject: [PATCH 09/11] rename to LinkWithoutLabelBlock to match other block naming --- .../reports/tests/test_block_type_report.py | 26 ++++++++++++------- .../customblocks/annotated_image_block.py | 4 +-- .../pagemodels/customblocks/link_block.py | 4 +-- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/network-api/networkapi/reports/tests/test_block_type_report.py b/network-api/networkapi/reports/tests/test_block_type_report.py index 55e76791910..ffe2d9f95aa 100644 --- a/network-api/networkapi/reports/tests/test_block_type_report.py +++ b/network-api/networkapi/reports/tests/test_block_type_report.py @@ -84,10 +84,12 @@ def test_view(self): self.assertListEqual([primary_page.content_type, campaign_page.content_type], block["content_types"]) block = object_list[3] - self.assertEqual(block["block"], "wagtail.blocks.field_block.CharBlock") + self.assertEqual( + block["block"], "networkapi.wagtailpages.pagemodels.customblocks.link_block.LinkWithoutLabelBlock" + ) self.assertEqual(block["count"], 2) - self.assertEqual(block["type_label"], "Core") - self.assertFalse(block["is_custom_block"]) + self.assertEqual(block["type_label"], "Custom") + self.assertTrue(block["is_custom_block"]) self.assertListEqual([primary_page.content_type, campaign_page.content_type], block["content_types"]) block = object_list[4] @@ -176,10 +178,12 @@ def test_page_unpublished(self): self.assertListEqual([campaign_page.content_type], block["content_types"]) block = object_list[3] - self.assertEqual(block["block"], "wagtail.blocks.field_block.CharBlock") + self.assertEqual( + block["block"], "networkapi.wagtailpages.pagemodels.customblocks.link_block.LinkWithoutLabelBlock" + ) self.assertEqual(block["count"], 1) - self.assertEqual(block["type_label"], "Core") - self.assertFalse(block["is_custom_block"]) + self.assertEqual(block["type_label"], "Custom") + self.assertTrue(block["is_custom_block"]) self.assertListEqual([campaign_page.content_type], block["content_types"]) block = object_list[4] @@ -225,7 +229,7 @@ def test_page_deleted(self): ) # Two pages have crated ImageBlocks - # Each ImageBlock has a ImageChooserBlock and a CharBlock + # Each ImageBlock has a ImageChooserBlock and a LinkWithoutLabelBlock # These should be in alphabetical order since they all have the same count block = object_list[1] self.assertEqual( @@ -246,10 +250,12 @@ def test_page_deleted(self): self.assertListEqual([campaign_page.content_type], block["content_types"]) block = object_list[3] - self.assertEqual(block["block"], "wagtail.blocks.field_block.CharBlock") + self.assertEqual( + block["block"], "networkapi.wagtailpages.pagemodels.customblocks.link_block.LinkWithoutLabelBlock" + ) self.assertEqual(block["count"], 1) - self.assertEqual(block["type_label"], "Core") - self.assertFalse(block["is_custom_block"]) + self.assertEqual(block["type_label"], "Custom") + self.assertTrue(block["is_custom_block"]) self.assertListEqual([campaign_page.content_type], block["content_types"]) block = object_list[4] diff --git a/network-api/networkapi/wagtailpages/pagemodels/customblocks/annotated_image_block.py b/network-api/networkapi/wagtailpages/pagemodels/customblocks/annotated_image_block.py index 3e40c4e6f68..9157acc50d6 100644 --- a/network-api/networkapi/wagtailpages/pagemodels/customblocks/annotated_image_block.py +++ b/network-api/networkapi/wagtailpages/pagemodels/customblocks/annotated_image_block.py @@ -2,7 +2,7 @@ from wagtail import blocks from .image_block import ImageBlock -from .link_block import LinkBlockWithoutLabel +from .link_block import LinkWithoutLabelBlock class RadioSelectBlock(blocks.ChoiceBlock): @@ -14,7 +14,7 @@ def __init__(self, *args, **kwargs): class AnnotatedImageBlock(ImageBlock): caption = blocks.CharBlock(required=False) caption_url = blocks.ListBlock( - LinkBlockWithoutLabel(), min_num=0, max_num=1, help_text="Optional URL that this caption should link out to." + LinkWithoutLabelBlock(), min_num=0, max_num=1, help_text="Optional URL that this caption should link out to." ) image_width = RadioSelectBlock( choices=( diff --git a/network-api/networkapi/wagtailpages/pagemodels/customblocks/link_block.py b/network-api/networkapi/wagtailpages/pagemodels/customblocks/link_block.py index 1e4d82c2da7..07498c77e90 100644 --- a/network-api/networkapi/wagtailpages/pagemodels/customblocks/link_block.py +++ b/network-api/networkapi/wagtailpages/pagemodels/customblocks/link_block.py @@ -68,11 +68,11 @@ class Meta: register(BaseLinkBlockAdapter(), LinkBlock) -class LinkBlockWithoutLabel(LinkBlock): +class LinkWithoutLabelBlock(LinkBlock): def __init__(self, local_blocks=None, **kwargs): super().__init__(local_blocks, **kwargs) self.child_blocks = self.base_blocks.copy() self.child_blocks.pop("label") -register(BaseLinkBlockAdapter(), LinkBlockWithoutLabel) +register(BaseLinkBlockAdapter(), LinkWithoutLabelBlock) From be309d5ae40f97075dcb95dee257734897a12bf7 Mon Sep 17 00:00:00 2001 From: danielfmiranda Date: Fri, 14 Jun 2024 11:30:15 -0700 Subject: [PATCH 10/11] updated tests to account for changes --- .../reports/tests/test_block_type_report.py | 220 ++++++++++++++++-- 1 file changed, 196 insertions(+), 24 deletions(-) diff --git a/network-api/networkapi/reports/tests/test_block_type_report.py b/network-api/networkapi/reports/tests/test_block_type_report.py index ffe2d9f95aa..3e1bbeb67d4 100644 --- a/network-api/networkapi/reports/tests/test_block_type_report.py +++ b/network-api/networkapi/reports/tests/test_block_type_report.py @@ -62,9 +62,7 @@ def test_view(self): block["content_types"], ) - # Two pages have crated ImageBlocks - # Each ImageBlock has a ImageChooserBlock and a CharBlock - # These should be in alphabetical order since they all have the same count + # Two pages have created AnnotatedImageBlocks block = object_list[1] self.assertEqual( block["block"], "networkapi.wagtailpages.pagemodels.customblocks.annotated_image_block.AnnotatedImageBlock" @@ -74,6 +72,7 @@ def test_view(self): self.assertTrue(block["is_custom_block"]) self.assertListEqual([primary_page.content_type, campaign_page.content_type], block["content_types"]) + # RadioSelectBlock is used in AnnotatedImageBlock block = object_list[2] self.assertEqual( block["block"], "networkapi.wagtailpages.pagemodels.customblocks.annotated_image_block.RadioSelectBlock" @@ -83,6 +82,7 @@ def test_view(self): self.assertTrue(block["is_custom_block"]) self.assertListEqual([primary_page.content_type, campaign_page.content_type], block["content_types"]) + # LinkBlockWithoutLabel is used in AnnotatedImageBlock block = object_list[3] self.assertEqual( block["block"], "networkapi.wagtailpages.pagemodels.customblocks.link_block.LinkWithoutLabelBlock" @@ -92,37 +92,77 @@ def test_view(self): self.assertTrue(block["is_custom_block"]) self.assertListEqual([primary_page.content_type, campaign_page.content_type], block["content_types"]) + # BooleanBlock is used in LinkBlockWithoutLabel block = object_list[4] - self.assertEqual(block["block"], "wagtail.images.blocks.ImageChooserBlock") + self.assertEqual(block["block"], "wagtail.blocks.field_block.BooleanBlock") self.assertEqual(block["count"], 2) self.assertEqual(block["type_label"], "Core") self.assertFalse(block["is_custom_block"]) self.assertListEqual([primary_page.content_type, campaign_page.content_type], block["content_types"]) - # FInally, we have the AirTableBlock, use only in one page - # This one is made of a URLBlock and a IntegerBlock + # CharBlock is used in LinkBlockWithoutLabel block = object_list[5] - self.assertEqual( - block["block"], "networkapi.wagtailpages.pagemodels.customblocks.airtable_block.AirTableBlock" - ) - self.assertEqual(block["count"], 1) - self.assertEqual(block["type_label"], "Custom") - self.assertTrue(block["is_custom_block"]) - self.assertListEqual([primary_page.content_type], block["content_types"]) + self.assertEqual(block["block"], "wagtail.blocks.field_block.CharBlock") + self.assertEqual(block["count"], 2) + self.assertEqual(block["type_label"], "Core") + self.assertFalse(block["is_custom_block"]) + self.assertListEqual([primary_page.content_type, campaign_page.content_type], block["content_types"]) + # ChoiceBlock is used in LinkBlockWithoutLabel block = object_list[6] - self.assertEqual(block["block"], "wagtail.blocks.field_block.IntegerBlock") - self.assertEqual(block["count"], 1) + self.assertEqual(block["block"], "wagtail.blocks.field_block.ChoiceBlock") + self.assertEqual(block["count"], 2) self.assertEqual(block["type_label"], "Core") self.assertFalse(block["is_custom_block"]) - self.assertListEqual([primary_page.content_type], block["content_types"]) + self.assertListEqual([primary_page.content_type, campaign_page.content_type], block["content_types"]) + # EmailBlock is used in LinkBlockWithoutLabel block = object_list[7] + self.assertEqual(block["block"], "wagtail.blocks.field_block.EmailBlock") + self.assertEqual(block["count"], 2) + self.assertEqual(block["type_label"], "Core") + self.assertFalse(block["is_custom_block"]) + self.assertListEqual([primary_page.content_type, campaign_page.content_type], block["content_types"]) + + # PageChooserBlock is used in LinkBlockWithoutLabel + block = object_list[8] + self.assertEqual(block["block"], "wagtail.blocks.field_block.PageChooserBlock") + self.assertEqual(block["count"], 2) + self.assertEqual(block["type_label"], "Core") + self.assertFalse(block["is_custom_block"]) + self.assertListEqual([primary_page.content_type, campaign_page.content_type], block["content_types"]) + + # URLBlock is used in LinkBlockWithoutLabel + block = object_list[9] self.assertEqual(block["block"], "wagtail.blocks.field_block.URLBlock") - self.assertEqual(block["count"], 1) + self.assertEqual(block["count"], 2) self.assertEqual(block["type_label"], "Core") self.assertFalse(block["is_custom_block"]) - self.assertListEqual([primary_page.content_type], block["content_types"]) + self.assertListEqual([primary_page.content_type, campaign_page.content_type], block["content_types"]) + + # ListBlock is used to wrap LinkBlockWithoutLabel in AnnotatedImageBlock + block = object_list[10] + self.assertEqual(block["block"], "wagtail.blocks.list_block.ListBlock") + self.assertEqual(block["count"], 2) + self.assertEqual(block["type_label"], "Core") + self.assertFalse(block["is_custom_block"]) + self.assertListEqual([primary_page.content_type, campaign_page.content_type], block["content_types"]) + + # DocumentChooserBlock is used in LinkBlockWithoutLabel + block = object_list[11] + self.assertEqual(block["block"], "wagtail.documents.blocks.DocumentChooserBlock") + self.assertEqual(block["count"], 2) + self.assertEqual(block["type_label"], "Core") + self.assertFalse(block["is_custom_block"]) + self.assertListEqual([primary_page.content_type, campaign_page.content_type], block["content_types"]) + + # ImageChooserBlock is used in AnnotatedImageBlock + block = object_list[12] + self.assertEqual(block["block"], "wagtail.images.blocks.ImageChooserBlock") + self.assertEqual(block["count"], 2) + self.assertEqual(block["type_label"], "Core") + self.assertFalse(block["is_custom_block"]) + self.assertListEqual([primary_page.content_type, campaign_page.content_type], block["content_types"]) def test_page_unpublished(self): """Tests that the queryset is updated when a page is unpublished""" @@ -156,9 +196,8 @@ def test_page_unpublished(self): block["content_types"], ) - # Two pages have crated ImageBlocks - # Each ImageBlock has a ImageChooserBlock and a CharBlock - # These should be in alphabetical order since they all have the same count + # The remaining blocks should only appear on the campaign page + # The campaign page is using an AnnotatedImageBlock block = object_list[1] self.assertEqual( block["block"], "networkapi.wagtailpages.pagemodels.customblocks.annotated_image_block.AnnotatedImageBlock" @@ -168,6 +207,7 @@ def test_page_unpublished(self): self.assertTrue(block["is_custom_block"]) self.assertListEqual([campaign_page.content_type], block["content_types"]) + # RadioSelectBlock is used in AnnotatedImageBlock block = object_list[2] self.assertEqual( block["block"], "networkapi.wagtailpages.pagemodels.customblocks.annotated_image_block.RadioSelectBlock" @@ -177,6 +217,7 @@ def test_page_unpublished(self): self.assertTrue(block["is_custom_block"]) self.assertListEqual([campaign_page.content_type], block["content_types"]) + # LinkBlockWithoutLabel is used in AnnotatedImageBlock block = object_list[3] self.assertEqual( block["block"], "networkapi.wagtailpages.pagemodels.customblocks.link_block.LinkWithoutLabelBlock" @@ -186,7 +227,72 @@ def test_page_unpublished(self): self.assertTrue(block["is_custom_block"]) self.assertListEqual([campaign_page.content_type], block["content_types"]) + # BooleanBlock is used in LinkBlockWithoutLabel block = object_list[4] + self.assertEqual(block["block"], "wagtail.blocks.field_block.BooleanBlock") + self.assertEqual(block["count"], 1) + self.assertEqual(block["type_label"], "Core") + self.assertFalse(block["is_custom_block"]) + self.assertListEqual([campaign_page.content_type], block["content_types"]) + + # CharBlock is used in LinkBlockWithoutLabel + block = object_list[5] + self.assertEqual(block["block"], "wagtail.blocks.field_block.CharBlock") + self.assertEqual(block["count"], 1) + self.assertEqual(block["type_label"], "Core") + self.assertFalse(block["is_custom_block"]) + self.assertListEqual([campaign_page.content_type], block["content_types"]) + + # ChoiceBlock is used in LinkBlockWithoutLabel + block = object_list[6] + self.assertEqual(block["block"], "wagtail.blocks.field_block.ChoiceBlock") + self.assertEqual(block["count"], 1) + self.assertEqual(block["type_label"], "Core") + self.assertFalse(block["is_custom_block"]) + self.assertListEqual([campaign_page.content_type], block["content_types"]) + + # EmailBlock is used in LinkBlockWithoutLabel + block = object_list[7] + self.assertEqual(block["block"], "wagtail.blocks.field_block.EmailBlock") + self.assertEqual(block["count"], 1) + self.assertEqual(block["type_label"], "Core") + self.assertFalse(block["is_custom_block"]) + self.assertListEqual([campaign_page.content_type], block["content_types"]) + + # PageChooserBlock is used in LinkBlockWithoutLabel + block = object_list[8] + self.assertEqual(block["block"], "wagtail.blocks.field_block.PageChooserBlock") + self.assertEqual(block["count"], 1) + self.assertEqual(block["type_label"], "Core") + self.assertFalse(block["is_custom_block"]) + self.assertListEqual([campaign_page.content_type], block["content_types"]) + + # URLBlock is used in LinkBlockWithoutLabel + block = object_list[9] + self.assertEqual(block["block"], "wagtail.blocks.field_block.URLBlock") + self.assertEqual(block["count"], 1) + self.assertEqual(block["type_label"], "Core") + self.assertFalse(block["is_custom_block"]) + self.assertListEqual([campaign_page.content_type], block["content_types"]) + + # ListBlock is used to wrap LinkBlockWithoutLabel in AnnotatedImageBlock + block = object_list[10] + self.assertEqual(block["block"], "wagtail.blocks.list_block.ListBlock") + self.assertEqual(block["count"], 1) + self.assertEqual(block["type_label"], "Core") + self.assertFalse(block["is_custom_block"]) + self.assertListEqual([campaign_page.content_type], block["content_types"]) + + # DocumentChooserBlock is used in LinkBlockWithoutLabel + block = object_list[11] + self.assertEqual(block["block"], "wagtail.documents.blocks.DocumentChooserBlock") + self.assertEqual(block["count"], 1) + self.assertEqual(block["type_label"], "Core") + self.assertFalse(block["is_custom_block"]) + self.assertListEqual([campaign_page.content_type], block["content_types"]) + + # ImageChooserBlock is used in AnnotatedImageBlock + block = object_list[12] self.assertEqual(block["block"], "wagtail.images.blocks.ImageChooserBlock") self.assertEqual(block["count"], 1) self.assertEqual(block["type_label"], "Core") @@ -228,9 +334,8 @@ def test_page_deleted(self): block["content_types"], ) - # Two pages have crated ImageBlocks - # Each ImageBlock has a ImageChooserBlock and a LinkWithoutLabelBlock - # These should be in alphabetical order since they all have the same count + # The remaining blocks should only appear on the campaign page + # The campaign page is using an AnnotatedImageBlock block = object_list[1] self.assertEqual( block["block"], "networkapi.wagtailpages.pagemodels.customblocks.annotated_image_block.AnnotatedImageBlock" @@ -240,6 +345,7 @@ def test_page_deleted(self): self.assertTrue(block["is_custom_block"]) self.assertListEqual([campaign_page.content_type], block["content_types"]) + # RadioSelectBlock is used in AnnotatedImageBlock block = object_list[2] self.assertEqual( block["block"], "networkapi.wagtailpages.pagemodels.customblocks.annotated_image_block.RadioSelectBlock" @@ -249,6 +355,7 @@ def test_page_deleted(self): self.assertTrue(block["is_custom_block"]) self.assertListEqual([campaign_page.content_type], block["content_types"]) + # LinkBlockWithoutLabel is used in AnnotatedImageBlock block = object_list[3] self.assertEqual( block["block"], "networkapi.wagtailpages.pagemodels.customblocks.link_block.LinkWithoutLabelBlock" @@ -258,7 +365,72 @@ def test_page_deleted(self): self.assertTrue(block["is_custom_block"]) self.assertListEqual([campaign_page.content_type], block["content_types"]) + # BooleanBlock is used in LinkBlockWithoutLabel block = object_list[4] + self.assertEqual(block["block"], "wagtail.blocks.field_block.BooleanBlock") + self.assertEqual(block["count"], 1) + self.assertEqual(block["type_label"], "Core") + self.assertFalse(block["is_custom_block"]) + self.assertListEqual([campaign_page.content_type], block["content_types"]) + + # CharBlock is used in LinkBlockWithoutLabel + block = object_list[5] + self.assertEqual(block["block"], "wagtail.blocks.field_block.CharBlock") + self.assertEqual(block["count"], 1) + self.assertEqual(block["type_label"], "Core") + self.assertFalse(block["is_custom_block"]) + self.assertListEqual([campaign_page.content_type], block["content_types"]) + + # ChoiceBlock is used in LinkBlockWithoutLabel + block = object_list[6] + self.assertEqual(block["block"], "wagtail.blocks.field_block.ChoiceBlock") + self.assertEqual(block["count"], 1) + self.assertEqual(block["type_label"], "Core") + self.assertFalse(block["is_custom_block"]) + self.assertListEqual([campaign_page.content_type], block["content_types"]) + + # EmailBlock is used in LinkBlockWithoutLabel + block = object_list[7] + self.assertEqual(block["block"], "wagtail.blocks.field_block.EmailBlock") + self.assertEqual(block["count"], 1) + self.assertEqual(block["type_label"], "Core") + self.assertFalse(block["is_custom_block"]) + self.assertListEqual([campaign_page.content_type], block["content_types"]) + + # PageChooserBlock is used in LinkBlockWithoutLabel + block = object_list[8] + self.assertEqual(block["block"], "wagtail.blocks.field_block.PageChooserBlock") + self.assertEqual(block["count"], 1) + self.assertEqual(block["type_label"], "Core") + self.assertFalse(block["is_custom_block"]) + self.assertListEqual([campaign_page.content_type], block["content_types"]) + + # URLBlock is used in LinkBlockWithoutLabel + block = object_list[9] + self.assertEqual(block["block"], "wagtail.blocks.field_block.URLBlock") + self.assertEqual(block["count"], 1) + self.assertEqual(block["type_label"], "Core") + self.assertFalse(block["is_custom_block"]) + self.assertListEqual([campaign_page.content_type], block["content_types"]) + + # ListBlock is used to wrap LinkBlockWithoutLabel in AnnotatedImageBlock + block = object_list[10] + self.assertEqual(block["block"], "wagtail.blocks.list_block.ListBlock") + self.assertEqual(block["count"], 1) + self.assertEqual(block["type_label"], "Core") + self.assertFalse(block["is_custom_block"]) + self.assertListEqual([campaign_page.content_type], block["content_types"]) + + # DocumentChooserBlock is used in LinkBlockWithoutLabel + block = object_list[11] + self.assertEqual(block["block"], "wagtail.documents.blocks.DocumentChooserBlock") + self.assertEqual(block["count"], 1) + self.assertEqual(block["type_label"], "Core") + self.assertFalse(block["is_custom_block"]) + self.assertListEqual([campaign_page.content_type], block["content_types"]) + + # ImageChooserBlock is used in AnnotatedImageBlock + block = object_list[12] self.assertEqual(block["block"], "wagtail.images.blocks.ImageChooserBlock") self.assertEqual(block["count"], 1) self.assertEqual(block["type_label"], "Core") From cdec4bf3c5d7120821e1585f5485a59a9a53bdf0 Mon Sep 17 00:00:00 2001 From: danielfmiranda Date: Thu, 20 Jun 2024 15:39:14 -0700 Subject: [PATCH 11/11] updated migrations --- ...ock.py => 0139_update_annotatedimageblock_with_linkblock.py} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename network-api/networkapi/wagtailpages/migrations/{0138_update_annotatedimageblock_with_linkblock.py => 0139_update_annotatedimageblock_with_linkblock.py} (99%) diff --git a/network-api/networkapi/wagtailpages/migrations/0138_update_annotatedimageblock_with_linkblock.py b/network-api/networkapi/wagtailpages/migrations/0139_update_annotatedimageblock_with_linkblock.py similarity index 99% rename from network-api/networkapi/wagtailpages/migrations/0138_update_annotatedimageblock_with_linkblock.py rename to network-api/networkapi/wagtailpages/migrations/0139_update_annotatedimageblock_with_linkblock.py index bd4c2c475b1..ad076db3b4a 100644 --- a/network-api/networkapi/wagtailpages/migrations/0138_update_annotatedimageblock_with_linkblock.py +++ b/network-api/networkapi/wagtailpages/migrations/0139_update_annotatedimageblock_with_linkblock.py @@ -41,7 +41,7 @@ def migrate_image_block(source_block): class Migration(migrations.Migration): dependencies = [ - ("wagtailpages", "0137_blogsignup_privacy_notice_cta_privacy_notice"), + ("wagtailpages", "0138_remove_modularpage_zen_nav_and_more"), ] operations = [