Skip to content

Commit

Permalink
PersonPage contact field (#1790)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesbiggs authored Feb 3, 2025
1 parent 05a5250 commit 353082e
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 0 deletions.
22 changes: 22 additions & 0 deletions etna/blog/migrations/0013_alter_blogpostpage_body.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Generated by Django 5.1.5 on 2025-01-30 16:02
# etna:allowAlterField

import django.core.validators
import etna.records.blocks
import wagtail.fields
from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('blog', '0012_blogindexpage_short_title_blogpage_short_title_and_more'),
]

operations = [
migrations.AlterField(
model_name='blogpostpage',
name='body',
field=wagtail.fields.StreamField([('call_to_action', 6), ('contact', 13), ('document', 17), ('featured_external_link', 22), ('featured_page', 25), ('image', 29), ('image_gallery', 31), ('inset_text', 33), ('media', 37), ('paragraph', 33), ('quote', 40), ('record', 42), ('table', 44), ('youtube_video', 50), ('content_section', 55)], block_lookup={0: ('etna.core.blocks.paragraph.APIRichTextBlock', (), {'features': ['bold', 'italic', 'link', 'ol', 'ul'], 'max_length': 100}), 1: ('wagtail.blocks.CharBlock', (), {}), 2: ('etna.core.blocks.page_chooser.APIPageChooserBlock', (), {'required': False}), 3: ('wagtail.blocks.URLBlock', (), {'required': False}), 4: ('wagtail.blocks.BooleanBlock', (), {'help_text': 'Use the accented button style', 'label': 'Accented', 'required': False}), 5: ('wagtail.blocks.StructBlock', [[('label', 1), ('link', 2), ('external_link', 3), ('accented', 4)]], {}), 6: ('wagtail.blocks.StructBlock', [[('body', 0), ('button', 5)]], {}), 7: ('etna.core.blocks.paragraph.APIRichTextBlock', (), {'features': ['link'], 'required': False}), 8: ('wagtail.blocks.TextBlock', (), {'features': ['bold', 'italic', 'link'], 'required': False}), 9: ('wagtail.blocks.CharBlock', (), {'required': False}), 10: ('etna.core.blocks.paragraph.APIRichTextBlock', (), {'required': False}), 11: ('wagtail.blocks.EmailBlock', (), {'required': False}), 12: ('etna.core.blocks.paragraph.APIRichTextBlock', (), {'features': ['bold', 'italic', 'link'], 'required': False}), 13: ('wagtail.blocks.StructBlock', [[('title', 1), ('body', 7), ('address', 8), ('telephone', 9), ('chat_link', 3), ('chat_note', 10), ('email', 11), ('website_link', 3), ('social_media', 12)]], {}), 14: ('wagtail.documents.blocks.DocumentChooserBlock', (), {'required': True}), 15: ('wagtail.blocks.StructBlock', [[('file', 14)]], {}), 16: ('wagtail.blocks.ListBlock', (15,), {}), 17: ('wagtail.blocks.StructBlock', [[('documents', 16)]], {}), 18: ('wagtail.blocks.CharBlock', (), {'label': 'Title', 'max_length': 100}), 19: ('wagtail.blocks.CharBlock', (), {'label': 'Description'}), 20: ('wagtail.blocks.URLBlock', (), {'label': 'URL'}), 21: ('etna.core.blocks.image.APIImageChooserBlock', (), {'label': 'Image', 'required': False}), 22: ('wagtail.blocks.StructBlock', [[('title', 18), ('description', 19), ('url', 20), ('image', 21)]], {}), 23: ('etna.core.blocks.page_chooser.APIPageChooserBlock', (), {'label': 'Page', 'page_type': ['wagtailcore.Page'], 'required': True}), 24: ('wagtail.blocks.CharBlock', (), {'help_text': 'Optional override for the teaser text', 'label': 'Teaser text override', 'required': False}), 25: ('wagtail.blocks.StructBlock', [[('page', 23), ('teaser_text', 24)]], {}), 26: ('etna.core.blocks.image.APIImageChooserBlock', (), {'rendition_size': 'max-900x900', 'required': True}), 27: ('wagtail.blocks.CharBlock', (), {'help_text': 'Alternative (alt) text describes images when they fail to load, and is read aloud by assistive technologies. Use a maximum of 100 characters to describe your image. <a href="https://html.spec.whatwg.org/multipage/images.html#alt" target="_blank">Check the guidance for tips on writing alt text</a>.', 'label': 'Alternative text', 'max_length': 100}), 28: ('etna.core.blocks.paragraph.APIRichTextBlock', (), {'features': ['bold', 'italic', 'link'], 'help_text': 'If provided, displays directly below the image. Can be used to specify sources, transcripts or other useful metadata.', 'label': 'Caption (optional)', 'required': False}), 29: ('wagtail.blocks.StructBlock', [[('image', 26), ('alt_text', 27), ('caption', 28)]], {}), 30: ('wagtail.blocks.ListBlock', (29,), {}), 31: ('wagtail.blocks.StructBlock', [[('title', 9), ('description', 12), ('images', 30)]], {}), 32: ('etna.core.blocks.paragraph.APIRichTextBlock', (), {'features': ['bold', 'italic', 'link', 'ol', 'ul']}), 33: ('wagtail.blocks.StructBlock', [[('text', 32)]], {}), 34: ('wagtail.blocks.CharBlock', (), {'help_text': 'A descriptive title for the media block', 'required': True}), 35: ('etna.core.blocks.image.APIImageChooserBlock', (), {'help_text': 'A thumbnail image for the media block', 'required': False}), 36: ('etna.media.blocks.MediaChooserBlock', (), {}), 37: ('wagtail.blocks.StructBlock', [[('title', 34), ('thumbnail', 35), ('media', 36)]], {}), 38: ('etna.core.blocks.paragraph.APIRichTextBlock', (), {'features': ['bold', 'italic', 'link', 'ol', 'ul'], 'required': True}), 39: ('wagtail.blocks.CharBlock', (), {'max_length': 100, 'required': False}), 40: ('wagtail.blocks.StructBlock', [[('quote', 38), ('attribution', 39)]], {}), 41: ('wagtail.blocks.ListBlock', (etna.records.blocks.RecordLinkBlock,), {'label': 'Items'}), 42: ('wagtail.blocks.StructBlock', [[('items', 41)]], {}), 43: ('wagtail.contrib.table_block.blocks.TableBlock', (), {'table_options': {'contextMenu': ['row_above', 'row_below', '---------', 'col_left', 'col_right', '---------', 'remove_row', 'remove_col', '---------', 'undo', 'redo', '---------', 'alignment']}}), 44: ('wagtail.blocks.StructBlock', [[('table', 43)]], {}), 45: ('wagtail.blocks.CharBlock', (), {'label': 'Title', 'max_length': 100, 'required': True}), 46: ('wagtail.blocks.CharBlock', (), {'label': 'YouTube Video ID', 'max_length': 11, 'required': True, 'validators': [django.core.validators.RegexValidator(message='Invalid YouTube Video ID', regex='^[a-zA-Z0-9_-]{11}$')]}), 47: ('etna.core.blocks.image.APIImageChooserBlock', (), {'label': 'Preview Image', 'rendition_size': 'fill-640x360', 'required': True}), 48: ('wagtail.blocks.RichTextBlock', (), {'label': 'Transcript', 'required': False}), 49: ('wagtail.blocks.BooleanBlock', (), {'help_text': 'Tick if the video has captions on YouTube', 'label': 'Captions available', 'required': False}), 50: ('wagtail.blocks.StructBlock', [[('title', 45), ('video_id', 46), ('preview_image', 47), ('transcript', 48), ('captions_available', 49)]], {}), 51: ('wagtail.blocks.CharBlock', (), {'label': 'Heading', 'max_length': 100}), 52: ('wagtail.blocks.CharBlock', (), {'label': 'Sub-heading', 'max_length': 100}), 53: ('wagtail.blocks.StructBlock', [[('heading', 52)]], {}), 54: ('wagtail.blocks.StreamBlock', [[('call_to_action', 6), ('contact', 13), ('document', 17), ('featured_external_link', 22), ('featured_page', 25), ('image', 29), ('image_gallery', 31), ('inset_text', 33), ('media', 37), ('paragraph', 33), ('quote', 40), ('record', 42), ('sub_heading', 53), ('table', 44), ('youtube_video', 50)]], {'required': False}), 55: ('wagtail.blocks.StructBlock', [[('heading', 51), ('content', 54)]], {})}),
),
]
1 change: 1 addition & 0 deletions etna/core/blocks/contact.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

class ContactBlock(blocks.StructBlock):
title = blocks.CharBlock()
body = APIRichTextBlock(required=False, features=["link"])
address = blocks.TextBlock(
required=False, features=settings.INLINE_RICH_TEXT_FEATURES
)
Expand Down
22 changes: 22 additions & 0 deletions etna/generic_pages/migrations/0043_alter_generalpage_body.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Generated by Django 5.1.5 on 2025-01-30 16:02
# etna:allowAlterField

import django.core.validators
import etna.records.blocks
import wagtail.fields
from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('generic_pages', '0042_generalpage_short_title_hubpage_short_title'),
]

operations = [
migrations.AlterField(
model_name='generalpage',
name='body',
field=wagtail.fields.StreamField([('accordions', 10), ('button', 15), ('call_to_action', 17), ('contact', 24), ('description_list', 28), ('details', 29), ('document', 6), ('do_dont_list', 34), ('featured_external_link', 39), ('featured_page', 42), ('featured_record_article', 44), ('image', 48), ('image_gallery', 50), ('inset_text', 52), ('media', 56), ('paragraph', 52), ('promoted_item', 68), ('quote', 70), ('record_links', 72), ('table', 74), ('warning_text', 75), ('youtube_video', 81), ('content_section', 88)], blank=True, block_lookup={0: ('wagtail.blocks.CharBlock', (), {'required': True}), 1: ('etna.core.blocks.paragraph.APIRichTextBlock', (), {'features': ['bold', 'italic', 'link', 'ol', 'ul'], 'required': True}), 2: ('wagtail.contrib.table_block.blocks.TableBlock', (), {}), 3: ('wagtail.documents.blocks.DocumentChooserBlock', (), {'required': True}), 4: ('wagtail.blocks.StructBlock', [[('file', 3)]], {}), 5: ('wagtail.blocks.ListBlock', (4,), {}), 6: ('wagtail.blocks.StructBlock', [[('documents', 5)]], {}), 7: ('wagtail.blocks.StreamBlock', [[('text', 1), ('table', 2), ('documents', 6)]], {}), 8: ('wagtail.blocks.StructBlock', [[('title', 0), ('body', 7)]], {}), 9: ('wagtail.blocks.ListBlock', (8,), {}), 10: ('wagtail.blocks.StructBlock', [[('items', 9)]], {}), 11: ('wagtail.blocks.CharBlock', (), {}), 12: ('etna.core.blocks.page_chooser.APIPageChooserBlock', (), {'required': False}), 13: ('wagtail.blocks.URLBlock', (), {'required': False}), 14: ('wagtail.blocks.BooleanBlock', (), {'help_text': 'Use the accented button style', 'label': 'Accented', 'required': False}), 15: ('wagtail.blocks.StructBlock', [[('label', 11), ('link', 12), ('external_link', 13), ('accented', 14)]], {}), 16: ('etna.core.blocks.paragraph.APIRichTextBlock', (), {'features': ['bold', 'italic', 'link', 'ol', 'ul'], 'max_length': 100}), 17: ('wagtail.blocks.StructBlock', [[('body', 16), ('button', 15)]], {}), 18: ('etna.core.blocks.paragraph.APIRichTextBlock', (), {'features': ['link'], 'required': False}), 19: ('wagtail.blocks.TextBlock', (), {'features': ['bold', 'italic', 'link'], 'required': False}), 20: ('wagtail.blocks.CharBlock', (), {'required': False}), 21: ('etna.core.blocks.paragraph.APIRichTextBlock', (), {'required': False}), 22: ('wagtail.blocks.EmailBlock', (), {'required': False}), 23: ('etna.core.blocks.paragraph.APIRichTextBlock', (), {'features': ['bold', 'italic', 'link'], 'required': False}), 24: ('wagtail.blocks.StructBlock', [[('title', 11), ('body', 18), ('address', 19), ('telephone', 20), ('chat_link', 13), ('chat_note', 21), ('email', 22), ('website_link', 13), ('social_media', 23)]], {}), 25: ('etna.core.blocks.paragraph.APIRichTextBlock', (), {'features': ['bold', 'italic', 'link']}), 26: ('wagtail.blocks.StructBlock', [[('term', 0), ('detail', 25)]], {}), 27: ('wagtail.blocks.ListBlock', (26,), {}), 28: ('wagtail.blocks.StructBlock', [[('items', 27)]], {}), 29: ('wagtail.blocks.StructBlock', [[('title', 0), ('body', 1)]], {}), 30: ('wagtail.blocks.StructBlock', [[('text', 25)]], {'icon': 'check', 'label': 'Do item'}), 31: ('wagtail.blocks.ListBlock', (30,), {'label': 'Dos'}), 32: ('wagtail.blocks.StructBlock', [[('text', 25)]], {'icon': 'cross', 'label': "Don't item"}), 33: ('wagtail.blocks.ListBlock', (32,), {'label': "Don'ts"}), 34: ('wagtail.blocks.StructBlock', [[('do', 31), ('dont', 33)]], {}), 35: ('wagtail.blocks.CharBlock', (), {'label': 'Title', 'max_length': 100}), 36: ('wagtail.blocks.CharBlock', (), {'label': 'Description'}), 37: ('wagtail.blocks.URLBlock', (), {'label': 'URL'}), 38: ('etna.core.blocks.image.APIImageChooserBlock', (), {'label': 'Image', 'required': False}), 39: ('wagtail.blocks.StructBlock', [[('title', 35), ('description', 36), ('url', 37), ('image', 38)]], {}), 40: ('etna.core.blocks.page_chooser.APIPageChooserBlock', (), {'label': 'Page', 'page_type': ['wagtailcore.Page'], 'required': True}), 41: ('wagtail.blocks.CharBlock', (), {'help_text': 'Optional override for the teaser text', 'label': 'Teaser text override', 'required': False}), 42: ('wagtail.blocks.StructBlock', [[('page', 40), ('teaser_text', 41)]], {}), 43: ('etna.core.blocks.page_chooser.APIPageChooserBlock', (), {'label': 'Page', 'page_type': ['articles.RecordArticlePage'], 'required_api_fields': ['teaser_image']}), 44: ('wagtail.blocks.StructBlock', [[('page', 43)]], {}), 45: ('etna.core.blocks.image.APIImageChooserBlock', (), {'rendition_size': 'max-900x900', 'required': True}), 46: ('wagtail.blocks.CharBlock', (), {'help_text': 'Alternative (alt) text describes images when they fail to load, and is read aloud by assistive technologies. Use a maximum of 100 characters to describe your image. <a href="https://html.spec.whatwg.org/multipage/images.html#alt" target="_blank">Check the guidance for tips on writing alt text</a>.', 'label': 'Alternative text', 'max_length': 100}), 47: ('etna.core.blocks.paragraph.APIRichTextBlock', (), {'features': ['bold', 'italic', 'link'], 'help_text': 'If provided, displays directly below the image. Can be used to specify sources, transcripts or other useful metadata.', 'label': 'Caption (optional)', 'required': False}), 48: ('wagtail.blocks.StructBlock', [[('image', 45), ('alt_text', 46), ('caption', 47)]], {}), 49: ('wagtail.blocks.ListBlock', (48,), {}), 50: ('wagtail.blocks.StructBlock', [[('title', 20), ('description', 23), ('images', 49)]], {}), 51: ('etna.core.blocks.paragraph.APIRichTextBlock', (), {'features': ['bold', 'italic', 'link', 'ol', 'ul']}), 52: ('wagtail.blocks.StructBlock', [[('text', 51)]], {}), 53: ('wagtail.blocks.CharBlock', (), {'help_text': 'A descriptive title for the media block', 'required': True}), 54: ('etna.core.blocks.image.APIImageChooserBlock', (), {'help_text': 'A thumbnail image for the media block', 'required': False}), 55: ('etna.media.blocks.MediaChooserBlock', (), {}), 56: ('wagtail.blocks.StructBlock', [[('title', 53), ('thumbnail', 54), ('media', 55)]], {}), 57: ('wagtail.blocks.CharBlock', (), {'help_text': 'Title of the promoted page', 'label': 'Title', 'max_length': 100}), 58: ('wagtail.blocks.ChoiceBlock', [], {'choices': [('blog', 'Blog post'), ('podcast', 'Podcast'), ('video', 'Video'), ('video-external', 'External video'), ('external-link', 'External link')], 'label': 'Category'}), 59: ('wagtail.blocks.CharBlock', (), {'help_text': 'This is a free text field. Please enter date as per agreed format: 14 April 2021', 'required': False}), 60: ('wagtail.blocks.CharBlock', (), {'help_text': 'Podcast or video duration.', 'label': 'Duration', 'max_length': 50, 'required': False}), 61: ('wagtail.blocks.URLBlock', (), {'help_text': 'URL for the external page', 'label': 'External URL'}), 62: ('wagtail.blocks.BooleanBlock', (), {'label': "Should this URL open in a new tab? <p style='font-size: 11px;'>Tick the box if 'yes'</p>", 'required': False}), 63: ('wagtail.blocks.CharBlock', (), {'help_text': "The text displayed on the button for your URL. If your URL links to an external site, please add the name of the site users will land on, and what they will find on this page. For example 'Watch our short film <strong>about Shakespeare on YouTube</strong>'.", 'label': 'Call to action label', 'max_length': 50}), 64: ('wagtail.blocks.BooleanBlock', (), {'default': False, 'help_text': 'Decorative images are used for visual effect and do not add information to the content of a page. <a href="https://www.w3.org/WAI/tutorials/images/decorative/" target="_blank">"Check the guidance to see if your image is decorative</a>.', 'label': "Is this image decorative? <p class='field-title__subheading'>Tick the box if 'yes'</p>", 'required': False}), 65: ('wagtail.blocks.CharBlock', (), {'help_text': 'Alternative (alt) text describes images when they fail to load, and is read aloud by assistive technologies. Use a maximum of 100 characters to describe your image. Decorative images do not require alt text. <a href="https://html.spec.whatwg.org/multipage/images.html#alt" target="_blank">Check the guidance for tips on writing alt text</a>.', 'label': 'Image alternative text', 'max_length': 100, 'required': False}), 66: ('wagtail.blocks.StructBlock', [[('image', 45), ('decorative', 64), ('alt_text', 65)]], {'label': 'Teaser image', 'template': 'articles/blocks/images/blog-embed__image-container.html'}), 67: ('etna.core.blocks.paragraph.APIRichTextBlock', (), {'features': ['bold', 'italic', 'link'], 'help_text': 'A description of the promoted page'}), 68: ('wagtail.blocks.StructBlock', [[('title', 57), ('category', 58), ('publication_date', 59), ('author', 20), ('duration', 60), ('url', 61), ('target_blank', 62), ('cta_label', 63), ('image', 66), ('description', 67)]], {}), 69: ('wagtail.blocks.CharBlock', (), {'max_length': 100, 'required': False}), 70: ('wagtail.blocks.StructBlock', [[('quote', 1), ('attribution', 69)]], {}), 71: ('wagtail.blocks.ListBlock', (etna.records.blocks.RecordLinkBlock,), {'label': 'Items'}), 72: ('wagtail.blocks.StructBlock', [[('items', 71)]], {}), 73: ('wagtail.contrib.table_block.blocks.TableBlock', (), {'table_options': {'contextMenu': ['row_above', 'row_below', '---------', 'col_left', 'col_right', '---------', 'remove_row', 'remove_col', '---------', 'undo', 'redo', '---------', 'alignment']}}), 74: ('wagtail.blocks.StructBlock', [[('table', 73)]], {}), 75: ('wagtail.blocks.StructBlock', [[('body', 51)]], {}), 76: ('wagtail.blocks.CharBlock', (), {'label': 'Title', 'max_length': 100, 'required': True}), 77: ('wagtail.blocks.CharBlock', (), {'label': 'YouTube Video ID', 'max_length': 11, 'required': True, 'validators': [django.core.validators.RegexValidator(message='Invalid YouTube Video ID', regex='^[a-zA-Z0-9_-]{11}$')]}), 78: ('etna.core.blocks.image.APIImageChooserBlock', (), {'label': 'Preview Image', 'rendition_size': 'fill-640x360', 'required': True}), 79: ('wagtail.blocks.RichTextBlock', (), {'label': 'Transcript', 'required': False}), 80: ('wagtail.blocks.BooleanBlock', (), {'help_text': 'Tick if the video has captions on YouTube', 'label': 'Captions available', 'required': False}), 81: ('wagtail.blocks.StructBlock', [[('title', 76), ('video_id', 77), ('preview_image', 78), ('transcript', 79), ('captions_available', 80)]], {}), 82: ('wagtail.blocks.CharBlock', (), {'label': 'Heading', 'max_length': 100}), 83: ('wagtail.blocks.CharBlock', (), {'label': 'Sub-heading', 'max_length': 100}), 84: ('wagtail.blocks.StructBlock', [[('heading', 83)]], {}), 85: ('wagtail.blocks.CharBlock', (), {'label': 'Sub-sub-heading', 'max_length': 100}), 86: ('wagtail.blocks.StructBlock', [[('heading', 85)]], {}), 87: ('wagtail.blocks.StreamBlock', [[('accordions', 10), ('button', 15), ('call_to_action', 17), ('contact', 24), ('description_list', 28), ('details', 29), ('document', 6), ('do_dont_list', 34), ('featured_external_link', 39), ('featured_page', 42), ('featured_record_article', 44), ('image', 48), ('image_gallery', 50), ('inset_text', 52), ('media', 56), ('paragraph', 52), ('promoted_item', 68), ('quote', 70), ('record_links', 72), ('sub_heading', 84), ('sub_sub_heading', 86), ('table', 74), ('warning_text', 75), ('youtube_video', 81)]], {'required': False}), 88: ('wagtail.blocks.StructBlock', [[('heading', 82), ('content', 87)]], {})}, null=True),
),
]
2 changes: 2 additions & 0 deletions etna/people/blocks.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
from wagtail import blocks

from etna.core.blocks import (
ContactBlock,
InsetTextBlock,
ParagraphBlock,
SectionDepthAwareStructBlock,
)


class SectionContentBlock(blocks.StreamBlock):
contact = ContactBlock()
inset_text = InsetTextBlock()
paragraph = ParagraphBlock()

Expand Down
Loading

0 comments on commit 353082e

Please sign in to comment.