From 1999aedb9b9870f365fea100e6f3b005d9450842 Mon Sep 17 00:00:00 2001 From: sarahframe Date: Mon, 10 Jun 2024 16:08:17 +1200 Subject: [PATCH 1/2] add tags to people page, add recent work tile blocks to people page --- .../migrations/0012_alter_blogpost_body.py | 698 ++++++ .../migrations/0017_alter_event_body.py | 698 ++++++ ...tpage_body_alter_homepage_body_and_more.py | 2052 +++++++++++++++++ ...ngpage_body_alter_profile_body_and_more.py | 1422 ++++++++++++ cdhweb/people/models.py | 39 +- ...lter_project_body_alter_project_members.py | 708 ++++++ cdhweb/projects/models.py | 11 +- .../cdhpages/blocks/standard_tile_block.html | 2 +- templates/cdhpages/blocks/tile.html | 14 +- templates/includes/person_hero.html | 7 +- templates/people/person_page.html | 21 + 11 files changed, 5650 insertions(+), 22 deletions(-) create mode 100644 cdhweb/blog/migrations/0012_alter_blogpost_body.py create mode 100644 cdhweb/events/migrations/0017_alter_event_body.py create mode 100644 cdhweb/pages/migrations/0047_alter_contentpage_body_alter_homepage_body_and_more.py create mode 100644 cdhweb/people/migrations/0016_alter_peoplelandingpage_body_alter_profile_body_and_more.py create mode 100644 cdhweb/projects/migrations/0019_alter_project_body_alter_project_members.py diff --git a/cdhweb/blog/migrations/0012_alter_blogpost_body.py b/cdhweb/blog/migrations/0012_alter_blogpost_body.py new file mode 100644 index 00000000..262d6f1f --- /dev/null +++ b/cdhweb/blog/migrations/0012_alter_blogpost_body.py @@ -0,0 +1,698 @@ +# Generated by Django 5.0.5 on 2024-06-10 02:55 + +import wagtail.blocks +import wagtail.contrib.typed_table_block.blocks +import wagtail.embeds.blocks +import wagtail.fields +import wagtail.images.blocks +from django.db import migrations + +import cdhweb.pages.blocks.download_block +import cdhweb.pages.blocks.migrated +import cdhweb.pages.blocks.newsletter +import cdhweb.pages.blocks.rich_text + + +class Migration(migrations.Migration): + dependencies = [ + ("blog", "0011_blogpost_feed_image_alter_blogpost_body"), + ] + + operations = [ + migrations.AlterField( + model_name="blogpost", + name="body", + field=wagtail.fields.StreamField( + [ + ("paragraph", cdhweb.pages.blocks.rich_text.RichTextBlock()), + ( + "download_block", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + help_text="Heading for document block", + max_length=80, + required=False, + ), + ), + ( + "description", + wagtail.blocks.TextBlock( + help_text="A description to display with the download file (150 characters maximum).", + max_length=150, + required=False, + ), + ), + ( + "documents", + wagtail.blocks.ListBlock( + cdhweb.pages.blocks.download_block.FileBlock, + help_text="Upload at least 1 and maximum 10 files. Each file size should be less than 5MB.", + max_num=10, + min_num=1, + ), + ), + ] + ), + ), + ( + "cta_block", + wagtail.blocks.StructBlock( + [ + ( + "introduction", + wagtail.blocks.TextBlock( + help_text="Short introduction to the action you want users to take. Ideal: 80 characters or less (Max: 100 characters).", + max_length=100, + required=False, + ), + ), + ( + "cta_buttons", + wagtail.blocks.StreamBlock( + [ + ( + "internal_link", + wagtail.blocks.StructBlock( + [ + ( + "page", + wagtail.blocks.PageChooserBlock(), + ), + ( + "link_text", + wagtail.blocks.CharBlock( + label="Button text", + max_length=40, + required=True, + ), + ), + ] + ), + ), + ( + "external_link", + wagtail.blocks.StructBlock( + [ + ( + "link_url", + wagtail.blocks.URLBlock( + label="URL" + ), + ), + ( + "link_text", + wagtail.blocks.CharBlock( + label="Button text", + max_length=40, + required=True, + ), + ), + ] + ), + ), + ], + max_num=2, + min_num=1, + ), + ), + ] + ), + ), + ( + "accordion_block", + wagtail.blocks.StructBlock( + [ + ( + "show_in_jumplinks", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Link to this block in the jumplinks list (when 'Show jumplinks' is enabled in Page settings)", + required=False, + ), + ), + ( + "heading", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=80, required=True + ), + ) + ], + required=False, + ), + ), + ( + "description", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "document-link", + ], + required=False, + ), + ), + ( + "accordion_items", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=80, + required=True, + verbose_name="Accordion Title", + ), + ), + ( + "body", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "ol", + "ul", + "document-link", + "h3", + "h4", + ], + help_text="Only use H3 if you have not set an overall heading for the accordion block.", + ), + ), + ] + ) + ), + ), + ] + ), + ), + ( + "video_block", + wagtail.blocks.StructBlock( + [ + ( + "video", + wagtail.blocks.URLBlock( + help_text="A YouTube URL. Link to a specifc video or playlist." + ), + ), + ( + "accessibility_description", + wagtail.blocks.CharBlock( + help_text="Use this to describe the video. It is used as an accessibility attribute mainly for screen readers.", + required=False, + ), + ), + ( + "transcript", + wagtail.blocks.RichTextBlock( + features=["bold", "link", "document-link"], + required=False, + ), + ), + ( + "show_in_jumplinks", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Link to this block in the jumplinks list (when 'Show jumplinks' is enabled in Page settings)", + required=False, + ), + ), + ( + "heading", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=80, required=True + ), + ) + ], + required=False, + ), + ), + ] + ), + ), + ( + "embed", + wagtail.blocks.StructBlock( + [ + ( + "show_in_jumplinks", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Link to this block in the jumplinks list (when 'Show jumplinks' is enabled in Page settings)", + required=False, + ), + ), + ( + "heading", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=80, required=True + ), + ) + ], + required=False, + ), + ), + ( + "video_url", + wagtail.embeds.blocks.EmbedBlock( + help_text='This should be used for videos from Princeton\'s Media Central. Copy the "oEmbed URL" from the "Share" menu' + ), + ), + ( + "accessibility_description", + wagtail.blocks.CharBlock( + help_text="Use this to describe the video. It is used as an accessibility attribute mainly for screen readers.", + required=True, + ), + ), + ( + "transcript", + wagtail.blocks.RichTextBlock( + features=["bold", "link", "document-link"], + required=False, + ), + ), + ] + ), + ), + ( + "pull_quote", + wagtail.blocks.StructBlock( + [ + ( + "quote", + wagtail.blocks.RichTextBlock( + features=["bold", "italic"], + help_text='Pull a small section of content out as an "aside" to give it emphasis.', + max_length=100, + required=True, + ), + ), + ( + "attribution", + wagtail.blocks.RichTextBlock( + features=["bold", "link"], + help_text="Optional attribution", + max_length=60, + required=False, + ), + ), + ] + ), + ), + ( + "note", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.TextBlock( + help_text="Optional heading", required=False + ), + ), + ( + "message", + wagtail.blocks.RichTextBlock( + features=["bold", "italic", "link", "ul", "ol"], + help_text="Note message up to 750 chars", + max_length=750, + required=True, + ), + ), + ] + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + label="Image", required=True + ), + ), + ( + "caption", + wagtail.blocks.RichTextBlock( + features=["italic", "bold", "link"], + help_text="A short caption for the image.", + max_length=180, + required=False, + ), + ), + ( + "credit", + wagtail.blocks.RichTextBlock( + features=["italic", "bold", "link"], + help_text="A credit line or attribution for the image.", + max_length=80, + required=False, + ), + ), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Describe the image for screen readers", + max_length=80, + required=False, + ), + ), + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("small", "small"), + ("medium", "medium"), + ("large", "large"), + ], + label="Image Size", + ), + ), + ] + ), + ), + ( + "feature", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=80, required=True + ), + ), + ( + "feature_text", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "document-link", + "italic", + "link", + "ol", + "ul", + ], + max_length=400, + ), + ), + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + label="Image", required=True + ), + ), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Describe the image for screen readers.", + max_length=80, + required=False, + ), + ), + ( + "cta_buttons", + wagtail.blocks.StreamBlock( + [ + ( + "internal_link", + wagtail.blocks.StructBlock( + [ + ( + "page", + wagtail.blocks.PageChooserBlock(), + ), + ( + "link_text", + wagtail.blocks.CharBlock( + label="Button text", + max_length=40, + required=True, + ), + ), + ] + ), + ), + ( + "external_link", + wagtail.blocks.StructBlock( + [ + ( + "link_url", + wagtail.blocks.URLBlock( + label="URL" + ), + ), + ( + "link_text", + wagtail.blocks.CharBlock( + label="Button text", + max_length=40, + required=True, + ), + ), + ] + ), + ), + ], + max_num=2, + min_num=0, + required=False, + ), + ), + ] + ), + ), + ( + "table", + wagtail.blocks.StructBlock( + [ + ( + "caption", + wagtail.blocks.CharBlock( + help_text="Table caption", + label="Caption", + required=False, + ), + ), + ( + "notes", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "document-link", + ], + help_text="Primarily for using for footnotes from cells with asterisks", + label="Table notes", + required=False, + ), + ), + ( + "table", + wagtail.contrib.typed_table_block.blocks.TypedTableBlock( + [ + ( + "rich_text", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "ol", + "ul", + "h3", + ] + ), + ) + ], + help_text="It is recommended to use a minimal number of columns, to ensure the table is usable on mobile and desktop.", + max_num=1, + min_num=1, + ), + ), + ] + ), + ), + ("newsletter", cdhweb.pages.blocks.newsletter.NewsletterBlock()), + ( + "heading", + wagtail.blocks.StructBlock( + [ + ( + "show_in_jumplinks", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Link to this block in the jumplinks list (when 'Show jumplinks' is enabled in Page settings)", + required=False, + ), + ), + ( + "heading", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=80, required=True + ), + ) + ] + ), + ), + ] + ), + ), + ( + "tile_block", + wagtail.blocks.StructBlock( + [ + ( + "show_in_jumplinks", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Link to this block in the jumplinks list (when 'Show jumplinks' is enabled in Page settings)", + required=False, + ), + ), + ( + "heading", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=80, required=True + ), + ) + ], + help_text="Heading for this tile block", + required=False, + ), + ), + ( + "description", + wagtail.blocks.CharBlock( + help_text="Description for this tile block", + label="Description", + required=False, + ), + ), + ( + "see_more_link", + wagtail.blocks.StructBlock( + [ + ( + "page", + wagtail.blocks.PageChooserBlock( + help_text="Choose a page to link to", + label="Wagtail Page", + required=False, + ), + ), + ( + "title", + wagtail.blocks.CharBlock( + help_text="Set title for this link", + label="Link title", + max_length=80, + required=False, + ), + ), + ], + help_text="'See more' link", + required=False, + ), + ), + ( + "tiles", + wagtail.blocks.StreamBlock( + [ + ( + "internal_page_tile", + wagtail.blocks.StructBlock( + [ + ( + "page", + wagtail.blocks.PageChooserBlock( + required=True + ), + ) + ] + ), + ), + ( + "external_page_tile", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + help_text="Title for this tile.", + label="Tile Title", + max_length=100, + required=True, + ), + ), + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + help_text="Image for this tile.", + label="Tile Image", + required=False, + ), + ), + ( + "summary", + wagtail.blocks.CharBlock( + help_text="Summary for this tile.", + label="Tile Summary", + max_length=200, + required=False, + ), + ), + ( + "external_link", + wagtail.blocks.URLBlock( + required=True + ), + ), + ] + ), + ), + ], + min_num=1, + required=True, + ), + ), + ] + ), + ), + ("migrated", cdhweb.pages.blocks.migrated.MigratedBlock()), + ], + blank=True, + help_text="Put content for the body of the page here. Start with using the + button.", + use_json_field=True, + verbose_name="Page content", + ), + ), + ] diff --git a/cdhweb/events/migrations/0017_alter_event_body.py b/cdhweb/events/migrations/0017_alter_event_body.py new file mode 100644 index 00000000..55a66aca --- /dev/null +++ b/cdhweb/events/migrations/0017_alter_event_body.py @@ -0,0 +1,698 @@ +# Generated by Django 5.0.5 on 2024-06-10 02:55 + +import wagtail.blocks +import wagtail.contrib.typed_table_block.blocks +import wagtail.embeds.blocks +import wagtail.fields +import wagtail.images.blocks +from django.db import migrations + +import cdhweb.pages.blocks.download_block +import cdhweb.pages.blocks.migrated +import cdhweb.pages.blocks.newsletter +import cdhweb.pages.blocks.rich_text + + +class Migration(migrations.Migration): + dependencies = [ + ("events", "0016_remove_event_thumbnail_event_feed_image_and_more"), + ] + + operations = [ + migrations.AlterField( + model_name="event", + name="body", + field=wagtail.fields.StreamField( + [ + ("paragraph", cdhweb.pages.blocks.rich_text.RichTextBlock()), + ( + "download_block", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + help_text="Heading for document block", + max_length=80, + required=False, + ), + ), + ( + "description", + wagtail.blocks.TextBlock( + help_text="A description to display with the download file (150 characters maximum).", + max_length=150, + required=False, + ), + ), + ( + "documents", + wagtail.blocks.ListBlock( + cdhweb.pages.blocks.download_block.FileBlock, + help_text="Upload at least 1 and maximum 10 files. Each file size should be less than 5MB.", + max_num=10, + min_num=1, + ), + ), + ] + ), + ), + ( + "cta_block", + wagtail.blocks.StructBlock( + [ + ( + "introduction", + wagtail.blocks.TextBlock( + help_text="Short introduction to the action you want users to take. Ideal: 80 characters or less (Max: 100 characters).", + max_length=100, + required=False, + ), + ), + ( + "cta_buttons", + wagtail.blocks.StreamBlock( + [ + ( + "internal_link", + wagtail.blocks.StructBlock( + [ + ( + "page", + wagtail.blocks.PageChooserBlock(), + ), + ( + "link_text", + wagtail.blocks.CharBlock( + label="Button text", + max_length=40, + required=True, + ), + ), + ] + ), + ), + ( + "external_link", + wagtail.blocks.StructBlock( + [ + ( + "link_url", + wagtail.blocks.URLBlock( + label="URL" + ), + ), + ( + "link_text", + wagtail.blocks.CharBlock( + label="Button text", + max_length=40, + required=True, + ), + ), + ] + ), + ), + ], + max_num=2, + min_num=1, + ), + ), + ] + ), + ), + ( + "accordion_block", + wagtail.blocks.StructBlock( + [ + ( + "show_in_jumplinks", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Link to this block in the jumplinks list (when 'Show jumplinks' is enabled in Page settings)", + required=False, + ), + ), + ( + "heading", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=80, required=True + ), + ) + ], + required=False, + ), + ), + ( + "description", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "document-link", + ], + required=False, + ), + ), + ( + "accordion_items", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=80, + required=True, + verbose_name="Accordion Title", + ), + ), + ( + "body", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "ol", + "ul", + "document-link", + "h3", + "h4", + ], + help_text="Only use H3 if you have not set an overall heading for the accordion block.", + ), + ), + ] + ) + ), + ), + ] + ), + ), + ( + "video_block", + wagtail.blocks.StructBlock( + [ + ( + "video", + wagtail.blocks.URLBlock( + help_text="A YouTube URL. Link to a specifc video or playlist." + ), + ), + ( + "accessibility_description", + wagtail.blocks.CharBlock( + help_text="Use this to describe the video. It is used as an accessibility attribute mainly for screen readers.", + required=False, + ), + ), + ( + "transcript", + wagtail.blocks.RichTextBlock( + features=["bold", "link", "document-link"], + required=False, + ), + ), + ( + "show_in_jumplinks", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Link to this block in the jumplinks list (when 'Show jumplinks' is enabled in Page settings)", + required=False, + ), + ), + ( + "heading", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=80, required=True + ), + ) + ], + required=False, + ), + ), + ] + ), + ), + ( + "embed", + wagtail.blocks.StructBlock( + [ + ( + "show_in_jumplinks", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Link to this block in the jumplinks list (when 'Show jumplinks' is enabled in Page settings)", + required=False, + ), + ), + ( + "heading", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=80, required=True + ), + ) + ], + required=False, + ), + ), + ( + "video_url", + wagtail.embeds.blocks.EmbedBlock( + help_text='This should be used for videos from Princeton\'s Media Central. Copy the "oEmbed URL" from the "Share" menu' + ), + ), + ( + "accessibility_description", + wagtail.blocks.CharBlock( + help_text="Use this to describe the video. It is used as an accessibility attribute mainly for screen readers.", + required=True, + ), + ), + ( + "transcript", + wagtail.blocks.RichTextBlock( + features=["bold", "link", "document-link"], + required=False, + ), + ), + ] + ), + ), + ( + "pull_quote", + wagtail.blocks.StructBlock( + [ + ( + "quote", + wagtail.blocks.RichTextBlock( + features=["bold", "italic"], + help_text='Pull a small section of content out as an "aside" to give it emphasis.', + max_length=100, + required=True, + ), + ), + ( + "attribution", + wagtail.blocks.RichTextBlock( + features=["bold", "link"], + help_text="Optional attribution", + max_length=60, + required=False, + ), + ), + ] + ), + ), + ( + "note", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.TextBlock( + help_text="Optional heading", required=False + ), + ), + ( + "message", + wagtail.blocks.RichTextBlock( + features=["bold", "italic", "link", "ul", "ol"], + help_text="Note message up to 750 chars", + max_length=750, + required=True, + ), + ), + ] + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + label="Image", required=True + ), + ), + ( + "caption", + wagtail.blocks.RichTextBlock( + features=["italic", "bold", "link"], + help_text="A short caption for the image.", + max_length=180, + required=False, + ), + ), + ( + "credit", + wagtail.blocks.RichTextBlock( + features=["italic", "bold", "link"], + help_text="A credit line or attribution for the image.", + max_length=80, + required=False, + ), + ), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Describe the image for screen readers", + max_length=80, + required=False, + ), + ), + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("small", "small"), + ("medium", "medium"), + ("large", "large"), + ], + label="Image Size", + ), + ), + ] + ), + ), + ( + "feature", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=80, required=True + ), + ), + ( + "feature_text", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "document-link", + "italic", + "link", + "ol", + "ul", + ], + max_length=400, + ), + ), + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + label="Image", required=True + ), + ), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Describe the image for screen readers.", + max_length=80, + required=False, + ), + ), + ( + "cta_buttons", + wagtail.blocks.StreamBlock( + [ + ( + "internal_link", + wagtail.blocks.StructBlock( + [ + ( + "page", + wagtail.blocks.PageChooserBlock(), + ), + ( + "link_text", + wagtail.blocks.CharBlock( + label="Button text", + max_length=40, + required=True, + ), + ), + ] + ), + ), + ( + "external_link", + wagtail.blocks.StructBlock( + [ + ( + "link_url", + wagtail.blocks.URLBlock( + label="URL" + ), + ), + ( + "link_text", + wagtail.blocks.CharBlock( + label="Button text", + max_length=40, + required=True, + ), + ), + ] + ), + ), + ], + max_num=2, + min_num=0, + required=False, + ), + ), + ] + ), + ), + ( + "table", + wagtail.blocks.StructBlock( + [ + ( + "caption", + wagtail.blocks.CharBlock( + help_text="Table caption", + label="Caption", + required=False, + ), + ), + ( + "notes", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "document-link", + ], + help_text="Primarily for using for footnotes from cells with asterisks", + label="Table notes", + required=False, + ), + ), + ( + "table", + wagtail.contrib.typed_table_block.blocks.TypedTableBlock( + [ + ( + "rich_text", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "ol", + "ul", + "h3", + ] + ), + ) + ], + help_text="It is recommended to use a minimal number of columns, to ensure the table is usable on mobile and desktop.", + max_num=1, + min_num=1, + ), + ), + ] + ), + ), + ("newsletter", cdhweb.pages.blocks.newsletter.NewsletterBlock()), + ( + "heading", + wagtail.blocks.StructBlock( + [ + ( + "show_in_jumplinks", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Link to this block in the jumplinks list (when 'Show jumplinks' is enabled in Page settings)", + required=False, + ), + ), + ( + "heading", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=80, required=True + ), + ) + ] + ), + ), + ] + ), + ), + ( + "tile_block", + wagtail.blocks.StructBlock( + [ + ( + "show_in_jumplinks", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Link to this block in the jumplinks list (when 'Show jumplinks' is enabled in Page settings)", + required=False, + ), + ), + ( + "heading", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=80, required=True + ), + ) + ], + help_text="Heading for this tile block", + required=False, + ), + ), + ( + "description", + wagtail.blocks.CharBlock( + help_text="Description for this tile block", + label="Description", + required=False, + ), + ), + ( + "see_more_link", + wagtail.blocks.StructBlock( + [ + ( + "page", + wagtail.blocks.PageChooserBlock( + help_text="Choose a page to link to", + label="Wagtail Page", + required=False, + ), + ), + ( + "title", + wagtail.blocks.CharBlock( + help_text="Set title for this link", + label="Link title", + max_length=80, + required=False, + ), + ), + ], + help_text="'See more' link", + required=False, + ), + ), + ( + "tiles", + wagtail.blocks.StreamBlock( + [ + ( + "internal_page_tile", + wagtail.blocks.StructBlock( + [ + ( + "page", + wagtail.blocks.PageChooserBlock( + required=True + ), + ) + ] + ), + ), + ( + "external_page_tile", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + help_text="Title for this tile.", + label="Tile Title", + max_length=100, + required=True, + ), + ), + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + help_text="Image for this tile.", + label="Tile Image", + required=False, + ), + ), + ( + "summary", + wagtail.blocks.CharBlock( + help_text="Summary for this tile.", + label="Tile Summary", + max_length=200, + required=False, + ), + ), + ( + "external_link", + wagtail.blocks.URLBlock( + required=True + ), + ), + ] + ), + ), + ], + min_num=1, + required=True, + ), + ), + ] + ), + ), + ("migrated", cdhweb.pages.blocks.migrated.MigratedBlock()), + ], + blank=True, + help_text="Put content for the body of the page here. Start with using the + button.", + use_json_field=True, + verbose_name="Page content", + ), + ), + ] diff --git a/cdhweb/pages/migrations/0047_alter_contentpage_body_alter_homepage_body_and_more.py b/cdhweb/pages/migrations/0047_alter_contentpage_body_alter_homepage_body_and_more.py new file mode 100644 index 00000000..dee36ae9 --- /dev/null +++ b/cdhweb/pages/migrations/0047_alter_contentpage_body_alter_homepage_body_and_more.py @@ -0,0 +1,2052 @@ +# Generated by Django 5.0.5 on 2024-06-10 02:55 + +import wagtail.blocks +import wagtail.contrib.typed_table_block.blocks +import wagtail.embeds.blocks +import wagtail.fields +import wagtail.images.blocks +from django.db import migrations + +import cdhweb.pages.blocks.download_block +import cdhweb.pages.blocks.migrated +import cdhweb.pages.blocks.newsletter +import cdhweb.pages.blocks.rich_text + + +class Migration(migrations.Migration): + dependencies = [ + ( + "cdhpages", + "0046_contentpage_feed_image_contentpage_short_description_and_more", + ), + ] + + operations = [ + migrations.AlterField( + model_name="contentpage", + name="body", + field=wagtail.fields.StreamField( + [ + ("paragraph", cdhweb.pages.blocks.rich_text.RichTextBlock()), + ( + "download_block", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + help_text="Heading for document block", + max_length=80, + required=False, + ), + ), + ( + "description", + wagtail.blocks.TextBlock( + help_text="A description to display with the download file (150 characters maximum).", + max_length=150, + required=False, + ), + ), + ( + "documents", + wagtail.blocks.ListBlock( + cdhweb.pages.blocks.download_block.FileBlock, + help_text="Upload at least 1 and maximum 10 files. Each file size should be less than 5MB.", + max_num=10, + min_num=1, + ), + ), + ] + ), + ), + ( + "cta_block", + wagtail.blocks.StructBlock( + [ + ( + "introduction", + wagtail.blocks.TextBlock( + help_text="Short introduction to the action you want users to take. Ideal: 80 characters or less (Max: 100 characters).", + max_length=100, + required=False, + ), + ), + ( + "cta_buttons", + wagtail.blocks.StreamBlock( + [ + ( + "internal_link", + wagtail.blocks.StructBlock( + [ + ( + "page", + wagtail.blocks.PageChooserBlock(), + ), + ( + "link_text", + wagtail.blocks.CharBlock( + label="Button text", + max_length=40, + required=True, + ), + ), + ] + ), + ), + ( + "external_link", + wagtail.blocks.StructBlock( + [ + ( + "link_url", + wagtail.blocks.URLBlock( + label="URL" + ), + ), + ( + "link_text", + wagtail.blocks.CharBlock( + label="Button text", + max_length=40, + required=True, + ), + ), + ] + ), + ), + ], + max_num=2, + min_num=1, + ), + ), + ] + ), + ), + ( + "accordion_block", + wagtail.blocks.StructBlock( + [ + ( + "show_in_jumplinks", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Link to this block in the jumplinks list (when 'Show jumplinks' is enabled in Page settings)", + required=False, + ), + ), + ( + "heading", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=80, required=True + ), + ) + ], + required=False, + ), + ), + ( + "description", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "document-link", + ], + required=False, + ), + ), + ( + "accordion_items", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=80, + required=True, + verbose_name="Accordion Title", + ), + ), + ( + "body", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "ol", + "ul", + "document-link", + "h3", + "h4", + ], + help_text="Only use H3 if you have not set an overall heading for the accordion block.", + ), + ), + ] + ) + ), + ), + ] + ), + ), + ( + "video_block", + wagtail.blocks.StructBlock( + [ + ( + "video", + wagtail.blocks.URLBlock( + help_text="A YouTube URL. Link to a specifc video or playlist." + ), + ), + ( + "accessibility_description", + wagtail.blocks.CharBlock( + help_text="Use this to describe the video. It is used as an accessibility attribute mainly for screen readers.", + required=False, + ), + ), + ( + "transcript", + wagtail.blocks.RichTextBlock( + features=["bold", "link", "document-link"], + required=False, + ), + ), + ( + "show_in_jumplinks", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Link to this block in the jumplinks list (when 'Show jumplinks' is enabled in Page settings)", + required=False, + ), + ), + ( + "heading", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=80, required=True + ), + ) + ], + required=False, + ), + ), + ] + ), + ), + ( + "embed", + wagtail.blocks.StructBlock( + [ + ( + "show_in_jumplinks", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Link to this block in the jumplinks list (when 'Show jumplinks' is enabled in Page settings)", + required=False, + ), + ), + ( + "heading", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=80, required=True + ), + ) + ], + required=False, + ), + ), + ( + "video_url", + wagtail.embeds.blocks.EmbedBlock( + help_text='This should be used for videos from Princeton\'s Media Central. Copy the "oEmbed URL" from the "Share" menu' + ), + ), + ( + "accessibility_description", + wagtail.blocks.CharBlock( + help_text="Use this to describe the video. It is used as an accessibility attribute mainly for screen readers.", + required=True, + ), + ), + ( + "transcript", + wagtail.blocks.RichTextBlock( + features=["bold", "link", "document-link"], + required=False, + ), + ), + ] + ), + ), + ( + "pull_quote", + wagtail.blocks.StructBlock( + [ + ( + "quote", + wagtail.blocks.RichTextBlock( + features=["bold", "italic"], + help_text='Pull a small section of content out as an "aside" to give it emphasis.', + max_length=100, + required=True, + ), + ), + ( + "attribution", + wagtail.blocks.RichTextBlock( + features=["bold", "link"], + help_text="Optional attribution", + max_length=60, + required=False, + ), + ), + ] + ), + ), + ( + "note", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.TextBlock( + help_text="Optional heading", required=False + ), + ), + ( + "message", + wagtail.blocks.RichTextBlock( + features=["bold", "italic", "link", "ul", "ol"], + help_text="Note message up to 750 chars", + max_length=750, + required=True, + ), + ), + ] + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + label="Image", required=True + ), + ), + ( + "caption", + wagtail.blocks.RichTextBlock( + features=["italic", "bold", "link"], + help_text="A short caption for the image.", + max_length=180, + required=False, + ), + ), + ( + "credit", + wagtail.blocks.RichTextBlock( + features=["italic", "bold", "link"], + help_text="A credit line or attribution for the image.", + max_length=80, + required=False, + ), + ), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Describe the image for screen readers", + max_length=80, + required=False, + ), + ), + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("small", "small"), + ("medium", "medium"), + ("large", "large"), + ], + label="Image Size", + ), + ), + ] + ), + ), + ( + "feature", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=80, required=True + ), + ), + ( + "feature_text", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "document-link", + "italic", + "link", + "ol", + "ul", + ], + max_length=400, + ), + ), + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + label="Image", required=True + ), + ), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Describe the image for screen readers.", + max_length=80, + required=False, + ), + ), + ( + "cta_buttons", + wagtail.blocks.StreamBlock( + [ + ( + "internal_link", + wagtail.blocks.StructBlock( + [ + ( + "page", + wagtail.blocks.PageChooserBlock(), + ), + ( + "link_text", + wagtail.blocks.CharBlock( + label="Button text", + max_length=40, + required=True, + ), + ), + ] + ), + ), + ( + "external_link", + wagtail.blocks.StructBlock( + [ + ( + "link_url", + wagtail.blocks.URLBlock( + label="URL" + ), + ), + ( + "link_text", + wagtail.blocks.CharBlock( + label="Button text", + max_length=40, + required=True, + ), + ), + ] + ), + ), + ], + max_num=2, + min_num=0, + required=False, + ), + ), + ] + ), + ), + ( + "table", + wagtail.blocks.StructBlock( + [ + ( + "caption", + wagtail.blocks.CharBlock( + help_text="Table caption", + label="Caption", + required=False, + ), + ), + ( + "notes", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "document-link", + ], + help_text="Primarily for using for footnotes from cells with asterisks", + label="Table notes", + required=False, + ), + ), + ( + "table", + wagtail.contrib.typed_table_block.blocks.TypedTableBlock( + [ + ( + "rich_text", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "ol", + "ul", + "h3", + ] + ), + ) + ], + help_text="It is recommended to use a minimal number of columns, to ensure the table is usable on mobile and desktop.", + max_num=1, + min_num=1, + ), + ), + ] + ), + ), + ("newsletter", cdhweb.pages.blocks.newsletter.NewsletterBlock()), + ( + "heading", + wagtail.blocks.StructBlock( + [ + ( + "show_in_jumplinks", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Link to this block in the jumplinks list (when 'Show jumplinks' is enabled in Page settings)", + required=False, + ), + ), + ( + "heading", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=80, required=True + ), + ) + ] + ), + ), + ] + ), + ), + ( + "tile_block", + wagtail.blocks.StructBlock( + [ + ( + "show_in_jumplinks", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Link to this block in the jumplinks list (when 'Show jumplinks' is enabled in Page settings)", + required=False, + ), + ), + ( + "heading", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=80, required=True + ), + ) + ], + help_text="Heading for this tile block", + required=False, + ), + ), + ( + "description", + wagtail.blocks.CharBlock( + help_text="Description for this tile block", + label="Description", + required=False, + ), + ), + ( + "see_more_link", + wagtail.blocks.StructBlock( + [ + ( + "page", + wagtail.blocks.PageChooserBlock( + help_text="Choose a page to link to", + label="Wagtail Page", + required=False, + ), + ), + ( + "title", + wagtail.blocks.CharBlock( + help_text="Set title for this link", + label="Link title", + max_length=80, + required=False, + ), + ), + ], + help_text="'See more' link", + required=False, + ), + ), + ( + "tiles", + wagtail.blocks.StreamBlock( + [ + ( + "internal_page_tile", + wagtail.blocks.StructBlock( + [ + ( + "page", + wagtail.blocks.PageChooserBlock( + required=True + ), + ) + ] + ), + ), + ( + "external_page_tile", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + help_text="Title for this tile.", + label="Tile Title", + max_length=100, + required=True, + ), + ), + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + help_text="Image for this tile.", + label="Tile Image", + required=False, + ), + ), + ( + "summary", + wagtail.blocks.CharBlock( + help_text="Summary for this tile.", + label="Tile Summary", + max_length=200, + required=False, + ), + ), + ( + "external_link", + wagtail.blocks.URLBlock( + required=True + ), + ), + ] + ), + ), + ], + min_num=1, + required=True, + ), + ), + ] + ), + ), + ("migrated", cdhweb.pages.blocks.migrated.MigratedBlock()), + ], + blank=True, + help_text="Put content for the body of the page here. Start with using the + button.", + use_json_field=True, + verbose_name="Page content", + ), + ), + migrations.AlterField( + model_name="homepage", + name="body", + field=wagtail.fields.StreamField( + [ + ("paragraph", cdhweb.pages.blocks.rich_text.RichTextBlock()), + ( + "download_block", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + help_text="Heading for document block", + max_length=80, + required=False, + ), + ), + ( + "description", + wagtail.blocks.TextBlock( + help_text="A description to display with the download file (150 characters maximum).", + max_length=150, + required=False, + ), + ), + ( + "documents", + wagtail.blocks.ListBlock( + cdhweb.pages.blocks.download_block.FileBlock, + help_text="Upload at least 1 and maximum 10 files. Each file size should be less than 5MB.", + max_num=10, + min_num=1, + ), + ), + ] + ), + ), + ( + "cta_block", + wagtail.blocks.StructBlock( + [ + ( + "introduction", + wagtail.blocks.TextBlock( + help_text="Short introduction to the action you want users to take. Ideal: 80 characters or less (Max: 100 characters).", + max_length=100, + required=False, + ), + ), + ( + "cta_buttons", + wagtail.blocks.StreamBlock( + [ + ( + "internal_link", + wagtail.blocks.StructBlock( + [ + ( + "page", + wagtail.blocks.PageChooserBlock(), + ), + ( + "link_text", + wagtail.blocks.CharBlock( + label="Button text", + max_length=40, + required=True, + ), + ), + ] + ), + ), + ( + "external_link", + wagtail.blocks.StructBlock( + [ + ( + "link_url", + wagtail.blocks.URLBlock( + label="URL" + ), + ), + ( + "link_text", + wagtail.blocks.CharBlock( + label="Button text", + max_length=40, + required=True, + ), + ), + ] + ), + ), + ], + max_num=2, + min_num=1, + ), + ), + ] + ), + ), + ( + "accordion_block", + wagtail.blocks.StructBlock( + [ + ( + "show_in_jumplinks", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Link to this block in the jumplinks list (when 'Show jumplinks' is enabled in Page settings)", + required=False, + ), + ), + ( + "heading", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=80, required=True + ), + ) + ], + required=False, + ), + ), + ( + "description", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "document-link", + ], + required=False, + ), + ), + ( + "accordion_items", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=80, + required=True, + verbose_name="Accordion Title", + ), + ), + ( + "body", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "ol", + "ul", + "document-link", + "h3", + "h4", + ], + help_text="Only use H3 if you have not set an overall heading for the accordion block.", + ), + ), + ] + ) + ), + ), + ] + ), + ), + ( + "video_block", + wagtail.blocks.StructBlock( + [ + ( + "video", + wagtail.blocks.URLBlock( + help_text="A YouTube URL. Link to a specifc video or playlist." + ), + ), + ( + "accessibility_description", + wagtail.blocks.CharBlock( + help_text="Use this to describe the video. It is used as an accessibility attribute mainly for screen readers.", + required=False, + ), + ), + ( + "transcript", + wagtail.blocks.RichTextBlock( + features=["bold", "link", "document-link"], + required=False, + ), + ), + ( + "show_in_jumplinks", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Link to this block in the jumplinks list (when 'Show jumplinks' is enabled in Page settings)", + required=False, + ), + ), + ( + "heading", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=80, required=True + ), + ) + ], + required=False, + ), + ), + ] + ), + ), + ( + "embed", + wagtail.blocks.StructBlock( + [ + ( + "show_in_jumplinks", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Link to this block in the jumplinks list (when 'Show jumplinks' is enabled in Page settings)", + required=False, + ), + ), + ( + "heading", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=80, required=True + ), + ) + ], + required=False, + ), + ), + ( + "video_url", + wagtail.embeds.blocks.EmbedBlock( + help_text='This should be used for videos from Princeton\'s Media Central. Copy the "oEmbed URL" from the "Share" menu' + ), + ), + ( + "accessibility_description", + wagtail.blocks.CharBlock( + help_text="Use this to describe the video. It is used as an accessibility attribute mainly for screen readers.", + required=True, + ), + ), + ( + "transcript", + wagtail.blocks.RichTextBlock( + features=["bold", "link", "document-link"], + required=False, + ), + ), + ] + ), + ), + ( + "pull_quote", + wagtail.blocks.StructBlock( + [ + ( + "quote", + wagtail.blocks.RichTextBlock( + features=["bold", "italic"], + help_text='Pull a small section of content out as an "aside" to give it emphasis.', + max_length=100, + required=True, + ), + ), + ( + "attribution", + wagtail.blocks.RichTextBlock( + features=["bold", "link"], + help_text="Optional attribution", + max_length=60, + required=False, + ), + ), + ] + ), + ), + ( + "note", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.TextBlock( + help_text="Optional heading", required=False + ), + ), + ( + "message", + wagtail.blocks.RichTextBlock( + features=["bold", "italic", "link", "ul", "ol"], + help_text="Note message up to 750 chars", + max_length=750, + required=True, + ), + ), + ] + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + label="Image", required=True + ), + ), + ( + "caption", + wagtail.blocks.RichTextBlock( + features=["italic", "bold", "link"], + help_text="A short caption for the image.", + max_length=180, + required=False, + ), + ), + ( + "credit", + wagtail.blocks.RichTextBlock( + features=["italic", "bold", "link"], + help_text="A credit line or attribution for the image.", + max_length=80, + required=False, + ), + ), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Describe the image for screen readers", + max_length=80, + required=False, + ), + ), + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("small", "small"), + ("medium", "medium"), + ("large", "large"), + ], + label="Image Size", + ), + ), + ] + ), + ), + ( + "feature", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=80, required=True + ), + ), + ( + "feature_text", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "document-link", + "italic", + "link", + "ol", + "ul", + ], + max_length=400, + ), + ), + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + label="Image", required=True + ), + ), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Describe the image for screen readers.", + max_length=80, + required=False, + ), + ), + ( + "cta_buttons", + wagtail.blocks.StreamBlock( + [ + ( + "internal_link", + wagtail.blocks.StructBlock( + [ + ( + "page", + wagtail.blocks.PageChooserBlock(), + ), + ( + "link_text", + wagtail.blocks.CharBlock( + label="Button text", + max_length=40, + required=True, + ), + ), + ] + ), + ), + ( + "external_link", + wagtail.blocks.StructBlock( + [ + ( + "link_url", + wagtail.blocks.URLBlock( + label="URL" + ), + ), + ( + "link_text", + wagtail.blocks.CharBlock( + label="Button text", + max_length=40, + required=True, + ), + ), + ] + ), + ), + ], + max_num=2, + min_num=0, + required=False, + ), + ), + ] + ), + ), + ( + "table", + wagtail.blocks.StructBlock( + [ + ( + "caption", + wagtail.blocks.CharBlock( + help_text="Table caption", + label="Caption", + required=False, + ), + ), + ( + "notes", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "document-link", + ], + help_text="Primarily for using for footnotes from cells with asterisks", + label="Table notes", + required=False, + ), + ), + ( + "table", + wagtail.contrib.typed_table_block.blocks.TypedTableBlock( + [ + ( + "rich_text", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "ol", + "ul", + "h3", + ] + ), + ) + ], + help_text="It is recommended to use a minimal number of columns, to ensure the table is usable on mobile and desktop.", + max_num=1, + min_num=1, + ), + ), + ] + ), + ), + ("newsletter", cdhweb.pages.blocks.newsletter.NewsletterBlock()), + ( + "heading", + wagtail.blocks.StructBlock( + [ + ( + "show_in_jumplinks", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Link to this block in the jumplinks list (when 'Show jumplinks' is enabled in Page settings)", + required=False, + ), + ), + ( + "heading", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=80, required=True + ), + ) + ] + ), + ), + ] + ), + ), + ( + "tile_block", + wagtail.blocks.StructBlock( + [ + ( + "show_in_jumplinks", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Link to this block in the jumplinks list (when 'Show jumplinks' is enabled in Page settings)", + required=False, + ), + ), + ( + "heading", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=80, required=True + ), + ) + ], + help_text="Heading for this tile block", + required=False, + ), + ), + ( + "description", + wagtail.blocks.CharBlock( + help_text="Description for this tile block", + label="Description", + required=False, + ), + ), + ( + "see_more_link", + wagtail.blocks.StructBlock( + [ + ( + "page", + wagtail.blocks.PageChooserBlock( + help_text="Choose a page to link to", + label="Wagtail Page", + required=False, + ), + ), + ( + "title", + wagtail.blocks.CharBlock( + help_text="Set title for this link", + label="Link title", + max_length=80, + required=False, + ), + ), + ], + help_text="'See more' link", + required=False, + ), + ), + ( + "tiles", + wagtail.blocks.StreamBlock( + [ + ( + "internal_page_tile", + wagtail.blocks.StructBlock( + [ + ( + "page", + wagtail.blocks.PageChooserBlock( + required=True + ), + ) + ] + ), + ), + ( + "external_page_tile", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + help_text="Title for this tile.", + label="Tile Title", + max_length=100, + required=True, + ), + ), + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + help_text="Image for this tile.", + label="Tile Image", + required=False, + ), + ), + ( + "summary", + wagtail.blocks.CharBlock( + help_text="Summary for this tile.", + label="Tile Summary", + max_length=200, + required=False, + ), + ), + ( + "external_link", + wagtail.blocks.URLBlock( + required=True + ), + ), + ] + ), + ), + ], + min_num=1, + required=True, + ), + ), + ] + ), + ), + ], + blank=True, + help_text="Put content for the body of the page here. Start with using the + button.", + use_json_field=True, + verbose_name="Page content", + ), + ), + migrations.AlterField( + model_name="landingpage", + name="body", + field=wagtail.fields.StreamField( + [ + ("paragraph", cdhweb.pages.blocks.rich_text.RichTextBlock()), + ( + "download_block", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + help_text="Heading for document block", + max_length=80, + required=False, + ), + ), + ( + "description", + wagtail.blocks.TextBlock( + help_text="A description to display with the download file (150 characters maximum).", + max_length=150, + required=False, + ), + ), + ( + "documents", + wagtail.blocks.ListBlock( + cdhweb.pages.blocks.download_block.FileBlock, + help_text="Upload at least 1 and maximum 10 files. Each file size should be less than 5MB.", + max_num=10, + min_num=1, + ), + ), + ] + ), + ), + ( + "cta_block", + wagtail.blocks.StructBlock( + [ + ( + "introduction", + wagtail.blocks.TextBlock( + help_text="Short introduction to the action you want users to take. Ideal: 80 characters or less (Max: 100 characters).", + max_length=100, + required=False, + ), + ), + ( + "cta_buttons", + wagtail.blocks.StreamBlock( + [ + ( + "internal_link", + wagtail.blocks.StructBlock( + [ + ( + "page", + wagtail.blocks.PageChooserBlock(), + ), + ( + "link_text", + wagtail.blocks.CharBlock( + label="Button text", + max_length=40, + required=True, + ), + ), + ] + ), + ), + ( + "external_link", + wagtail.blocks.StructBlock( + [ + ( + "link_url", + wagtail.blocks.URLBlock( + label="URL" + ), + ), + ( + "link_text", + wagtail.blocks.CharBlock( + label="Button text", + max_length=40, + required=True, + ), + ), + ] + ), + ), + ], + max_num=2, + min_num=1, + ), + ), + ] + ), + ), + ( + "accordion_block", + wagtail.blocks.StructBlock( + [ + ( + "show_in_jumplinks", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Link to this block in the jumplinks list (when 'Show jumplinks' is enabled in Page settings)", + required=False, + ), + ), + ( + "heading", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=80, required=True + ), + ) + ], + required=False, + ), + ), + ( + "description", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "document-link", + ], + required=False, + ), + ), + ( + "accordion_items", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=80, + required=True, + verbose_name="Accordion Title", + ), + ), + ( + "body", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "ol", + "ul", + "document-link", + "h3", + "h4", + ], + help_text="Only use H3 if you have not set an overall heading for the accordion block.", + ), + ), + ] + ) + ), + ), + ] + ), + ), + ( + "video_block", + wagtail.blocks.StructBlock( + [ + ( + "video", + wagtail.blocks.URLBlock( + help_text="A YouTube URL. Link to a specifc video or playlist." + ), + ), + ( + "accessibility_description", + wagtail.blocks.CharBlock( + help_text="Use this to describe the video. It is used as an accessibility attribute mainly for screen readers.", + required=False, + ), + ), + ( + "transcript", + wagtail.blocks.RichTextBlock( + features=["bold", "link", "document-link"], + required=False, + ), + ), + ( + "show_in_jumplinks", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Link to this block in the jumplinks list (when 'Show jumplinks' is enabled in Page settings)", + required=False, + ), + ), + ( + "heading", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=80, required=True + ), + ) + ], + required=False, + ), + ), + ] + ), + ), + ( + "embed", + wagtail.blocks.StructBlock( + [ + ( + "show_in_jumplinks", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Link to this block in the jumplinks list (when 'Show jumplinks' is enabled in Page settings)", + required=False, + ), + ), + ( + "heading", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=80, required=True + ), + ) + ], + required=False, + ), + ), + ( + "video_url", + wagtail.embeds.blocks.EmbedBlock( + help_text='This should be used for videos from Princeton\'s Media Central. Copy the "oEmbed URL" from the "Share" menu' + ), + ), + ( + "accessibility_description", + wagtail.blocks.CharBlock( + help_text="Use this to describe the video. It is used as an accessibility attribute mainly for screen readers.", + required=True, + ), + ), + ( + "transcript", + wagtail.blocks.RichTextBlock( + features=["bold", "link", "document-link"], + required=False, + ), + ), + ] + ), + ), + ( + "pull_quote", + wagtail.blocks.StructBlock( + [ + ( + "quote", + wagtail.blocks.RichTextBlock( + features=["bold", "italic"], + help_text='Pull a small section of content out as an "aside" to give it emphasis.', + max_length=100, + required=True, + ), + ), + ( + "attribution", + wagtail.blocks.RichTextBlock( + features=["bold", "link"], + help_text="Optional attribution", + max_length=60, + required=False, + ), + ), + ] + ), + ), + ( + "note", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.TextBlock( + help_text="Optional heading", required=False + ), + ), + ( + "message", + wagtail.blocks.RichTextBlock( + features=["bold", "italic", "link", "ul", "ol"], + help_text="Note message up to 750 chars", + max_length=750, + required=True, + ), + ), + ] + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + label="Image", required=True + ), + ), + ( + "caption", + wagtail.blocks.RichTextBlock( + features=["italic", "bold", "link"], + help_text="A short caption for the image.", + max_length=180, + required=False, + ), + ), + ( + "credit", + wagtail.blocks.RichTextBlock( + features=["italic", "bold", "link"], + help_text="A credit line or attribution for the image.", + max_length=80, + required=False, + ), + ), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Describe the image for screen readers", + max_length=80, + required=False, + ), + ), + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("small", "small"), + ("medium", "medium"), + ("large", "large"), + ], + label="Image Size", + ), + ), + ] + ), + ), + ( + "feature", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=80, required=True + ), + ), + ( + "feature_text", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "document-link", + "italic", + "link", + "ol", + "ul", + ], + max_length=400, + ), + ), + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + label="Image", required=True + ), + ), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Describe the image for screen readers.", + max_length=80, + required=False, + ), + ), + ( + "cta_buttons", + wagtail.blocks.StreamBlock( + [ + ( + "internal_link", + wagtail.blocks.StructBlock( + [ + ( + "page", + wagtail.blocks.PageChooserBlock(), + ), + ( + "link_text", + wagtail.blocks.CharBlock( + label="Button text", + max_length=40, + required=True, + ), + ), + ] + ), + ), + ( + "external_link", + wagtail.blocks.StructBlock( + [ + ( + "link_url", + wagtail.blocks.URLBlock( + label="URL" + ), + ), + ( + "link_text", + wagtail.blocks.CharBlock( + label="Button text", + max_length=40, + required=True, + ), + ), + ] + ), + ), + ], + max_num=2, + min_num=0, + required=False, + ), + ), + ] + ), + ), + ( + "table", + wagtail.blocks.StructBlock( + [ + ( + "caption", + wagtail.blocks.CharBlock( + help_text="Table caption", + label="Caption", + required=False, + ), + ), + ( + "notes", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "document-link", + ], + help_text="Primarily for using for footnotes from cells with asterisks", + label="Table notes", + required=False, + ), + ), + ( + "table", + wagtail.contrib.typed_table_block.blocks.TypedTableBlock( + [ + ( + "rich_text", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "ol", + "ul", + "h3", + ] + ), + ) + ], + help_text="It is recommended to use a minimal number of columns, to ensure the table is usable on mobile and desktop.", + max_num=1, + min_num=1, + ), + ), + ] + ), + ), + ("newsletter", cdhweb.pages.blocks.newsletter.NewsletterBlock()), + ( + "heading", + wagtail.blocks.StructBlock( + [ + ( + "show_in_jumplinks", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Link to this block in the jumplinks list (when 'Show jumplinks' is enabled in Page settings)", + required=False, + ), + ), + ( + "heading", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=80, required=True + ), + ) + ] + ), + ), + ] + ), + ), + ( + "tile_block", + wagtail.blocks.StructBlock( + [ + ( + "show_in_jumplinks", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Link to this block in the jumplinks list (when 'Show jumplinks' is enabled in Page settings)", + required=False, + ), + ), + ( + "heading", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=80, required=True + ), + ) + ], + help_text="Heading for this tile block", + required=False, + ), + ), + ( + "description", + wagtail.blocks.CharBlock( + help_text="Description for this tile block", + label="Description", + required=False, + ), + ), + ( + "see_more_link", + wagtail.blocks.StructBlock( + [ + ( + "page", + wagtail.blocks.PageChooserBlock( + help_text="Choose a page to link to", + label="Wagtail Page", + required=False, + ), + ), + ( + "title", + wagtail.blocks.CharBlock( + help_text="Set title for this link", + label="Link title", + max_length=80, + required=False, + ), + ), + ], + help_text="'See more' link", + required=False, + ), + ), + ( + "tiles", + wagtail.blocks.StreamBlock( + [ + ( + "internal_page_tile", + wagtail.blocks.StructBlock( + [ + ( + "page", + wagtail.blocks.PageChooserBlock( + required=True + ), + ) + ] + ), + ), + ( + "external_page_tile", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + help_text="Title for this tile.", + label="Tile Title", + max_length=100, + required=True, + ), + ), + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + help_text="Image for this tile.", + label="Tile Image", + required=False, + ), + ), + ( + "summary", + wagtail.blocks.CharBlock( + help_text="Summary for this tile.", + label="Tile Summary", + max_length=200, + required=False, + ), + ), + ( + "external_link", + wagtail.blocks.URLBlock( + required=True + ), + ), + ] + ), + ), + ], + min_num=1, + required=True, + ), + ), + ] + ), + ), + ("migrated", cdhweb.pages.blocks.migrated.MigratedBlock()), + ], + blank=True, + help_text="Put content for the body of the page here. Start with using the + button.", + use_json_field=True, + verbose_name="Page content", + ), + ), + ] diff --git a/cdhweb/people/migrations/0016_alter_peoplelandingpage_body_alter_profile_body_and_more.py b/cdhweb/people/migrations/0016_alter_peoplelandingpage_body_alter_profile_body_and_more.py new file mode 100644 index 00000000..db50f8a4 --- /dev/null +++ b/cdhweb/people/migrations/0016_alter_peoplelandingpage_body_alter_profile_body_and_more.py @@ -0,0 +1,1422 @@ +# Generated by Django 5.0.5 on 2024-06-10 02:55 + +import django.db.models.deletion +import modelcluster.contrib.taggit +import modelcluster.fields +import wagtail.blocks +import wagtail.contrib.typed_table_block.blocks +import wagtail.embeds.blocks +import wagtail.fields +import wagtail.images.blocks +from django.db import migrations, models + +import cdhweb.pages.blocks.download_block +import cdhweb.pages.blocks.migrated +import cdhweb.pages.blocks.newsletter +import cdhweb.pages.blocks.rich_text + + +class Migration(migrations.Migration): + dependencies = [ + ("people", "0015_peoplelandingpage_feed_image_and_more"), + ("taggit", "0005_auto_20220424_2025"), + ] + + operations = [ + migrations.AlterField( + model_name="peoplelandingpage", + name="body", + field=wagtail.fields.StreamField( + [ + ("paragraph", cdhweb.pages.blocks.rich_text.RichTextBlock()), + ( + "download_block", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + help_text="Heading for document block", + max_length=80, + required=False, + ), + ), + ( + "description", + wagtail.blocks.TextBlock( + help_text="A description to display with the download file (150 characters maximum).", + max_length=150, + required=False, + ), + ), + ( + "documents", + wagtail.blocks.ListBlock( + cdhweb.pages.blocks.download_block.FileBlock, + help_text="Upload at least 1 and maximum 10 files. Each file size should be less than 5MB.", + max_num=10, + min_num=1, + ), + ), + ] + ), + ), + ( + "cta_block", + wagtail.blocks.StructBlock( + [ + ( + "introduction", + wagtail.blocks.TextBlock( + help_text="Short introduction to the action you want users to take. Ideal: 80 characters or less (Max: 100 characters).", + max_length=100, + required=False, + ), + ), + ( + "cta_buttons", + wagtail.blocks.StreamBlock( + [ + ( + "internal_link", + wagtail.blocks.StructBlock( + [ + ( + "page", + wagtail.blocks.PageChooserBlock(), + ), + ( + "link_text", + wagtail.blocks.CharBlock( + label="Button text", + max_length=40, + required=True, + ), + ), + ] + ), + ), + ( + "external_link", + wagtail.blocks.StructBlock( + [ + ( + "link_url", + wagtail.blocks.URLBlock( + label="URL" + ), + ), + ( + "link_text", + wagtail.blocks.CharBlock( + label="Button text", + max_length=40, + required=True, + ), + ), + ] + ), + ), + ], + max_num=2, + min_num=1, + ), + ), + ] + ), + ), + ( + "accordion_block", + wagtail.blocks.StructBlock( + [ + ( + "show_in_jumplinks", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Link to this block in the jumplinks list (when 'Show jumplinks' is enabled in Page settings)", + required=False, + ), + ), + ( + "heading", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=80, required=True + ), + ) + ], + required=False, + ), + ), + ( + "description", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "document-link", + ], + required=False, + ), + ), + ( + "accordion_items", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=80, + required=True, + verbose_name="Accordion Title", + ), + ), + ( + "body", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "ol", + "ul", + "document-link", + "h3", + "h4", + ], + help_text="Only use H3 if you have not set an overall heading for the accordion block.", + ), + ), + ] + ) + ), + ), + ] + ), + ), + ( + "video_block", + wagtail.blocks.StructBlock( + [ + ( + "video", + wagtail.blocks.URLBlock( + help_text="A YouTube URL. Link to a specifc video or playlist." + ), + ), + ( + "accessibility_description", + wagtail.blocks.CharBlock( + help_text="Use this to describe the video. It is used as an accessibility attribute mainly for screen readers.", + required=False, + ), + ), + ( + "transcript", + wagtail.blocks.RichTextBlock( + features=["bold", "link", "document-link"], + required=False, + ), + ), + ( + "show_in_jumplinks", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Link to this block in the jumplinks list (when 'Show jumplinks' is enabled in Page settings)", + required=False, + ), + ), + ( + "heading", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=80, required=True + ), + ) + ], + required=False, + ), + ), + ] + ), + ), + ( + "embed", + wagtail.blocks.StructBlock( + [ + ( + "show_in_jumplinks", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Link to this block in the jumplinks list (when 'Show jumplinks' is enabled in Page settings)", + required=False, + ), + ), + ( + "heading", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=80, required=True + ), + ) + ], + required=False, + ), + ), + ( + "video_url", + wagtail.embeds.blocks.EmbedBlock( + help_text='This should be used for videos from Princeton\'s Media Central. Copy the "oEmbed URL" from the "Share" menu' + ), + ), + ( + "accessibility_description", + wagtail.blocks.CharBlock( + help_text="Use this to describe the video. It is used as an accessibility attribute mainly for screen readers.", + required=True, + ), + ), + ( + "transcript", + wagtail.blocks.RichTextBlock( + features=["bold", "link", "document-link"], + required=False, + ), + ), + ] + ), + ), + ( + "pull_quote", + wagtail.blocks.StructBlock( + [ + ( + "quote", + wagtail.blocks.RichTextBlock( + features=["bold", "italic"], + help_text='Pull a small section of content out as an "aside" to give it emphasis.', + max_length=100, + required=True, + ), + ), + ( + "attribution", + wagtail.blocks.RichTextBlock( + features=["bold", "link"], + help_text="Optional attribution", + max_length=60, + required=False, + ), + ), + ] + ), + ), + ( + "note", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.TextBlock( + help_text="Optional heading", required=False + ), + ), + ( + "message", + wagtail.blocks.RichTextBlock( + features=["bold", "italic", "link", "ul", "ol"], + help_text="Note message up to 750 chars", + max_length=750, + required=True, + ), + ), + ] + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + label="Image", required=True + ), + ), + ( + "caption", + wagtail.blocks.RichTextBlock( + features=["italic", "bold", "link"], + help_text="A short caption for the image.", + max_length=180, + required=False, + ), + ), + ( + "credit", + wagtail.blocks.RichTextBlock( + features=["italic", "bold", "link"], + help_text="A credit line or attribution for the image.", + max_length=80, + required=False, + ), + ), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Describe the image for screen readers", + max_length=80, + required=False, + ), + ), + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("small", "small"), + ("medium", "medium"), + ("large", "large"), + ], + label="Image Size", + ), + ), + ] + ), + ), + ( + "feature", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=80, required=True + ), + ), + ( + "feature_text", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "document-link", + "italic", + "link", + "ol", + "ul", + ], + max_length=400, + ), + ), + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + label="Image", required=True + ), + ), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Describe the image for screen readers.", + max_length=80, + required=False, + ), + ), + ( + "cta_buttons", + wagtail.blocks.StreamBlock( + [ + ( + "internal_link", + wagtail.blocks.StructBlock( + [ + ( + "page", + wagtail.blocks.PageChooserBlock(), + ), + ( + "link_text", + wagtail.blocks.CharBlock( + label="Button text", + max_length=40, + required=True, + ), + ), + ] + ), + ), + ( + "external_link", + wagtail.blocks.StructBlock( + [ + ( + "link_url", + wagtail.blocks.URLBlock( + label="URL" + ), + ), + ( + "link_text", + wagtail.blocks.CharBlock( + label="Button text", + max_length=40, + required=True, + ), + ), + ] + ), + ), + ], + max_num=2, + min_num=0, + required=False, + ), + ), + ] + ), + ), + ( + "table", + wagtail.blocks.StructBlock( + [ + ( + "caption", + wagtail.blocks.CharBlock( + help_text="Table caption", + label="Caption", + required=False, + ), + ), + ( + "notes", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "document-link", + ], + help_text="Primarily for using for footnotes from cells with asterisks", + label="Table notes", + required=False, + ), + ), + ( + "table", + wagtail.contrib.typed_table_block.blocks.TypedTableBlock( + [ + ( + "rich_text", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "ol", + "ul", + "h3", + ] + ), + ) + ], + help_text="It is recommended to use a minimal number of columns, to ensure the table is usable on mobile and desktop.", + max_num=1, + min_num=1, + ), + ), + ] + ), + ), + ("newsletter", cdhweb.pages.blocks.newsletter.NewsletterBlock()), + ( + "heading", + wagtail.blocks.StructBlock( + [ + ( + "show_in_jumplinks", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Link to this block in the jumplinks list (when 'Show jumplinks' is enabled in Page settings)", + required=False, + ), + ), + ( + "heading", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=80, required=True + ), + ) + ] + ), + ), + ] + ), + ), + ( + "tile_block", + wagtail.blocks.StructBlock( + [ + ( + "show_in_jumplinks", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Link to this block in the jumplinks list (when 'Show jumplinks' is enabled in Page settings)", + required=False, + ), + ), + ( + "heading", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=80, required=True + ), + ) + ], + help_text="Heading for this tile block", + required=False, + ), + ), + ( + "description", + wagtail.blocks.CharBlock( + help_text="Description for this tile block", + label="Description", + required=False, + ), + ), + ( + "see_more_link", + wagtail.blocks.StructBlock( + [ + ( + "page", + wagtail.blocks.PageChooserBlock( + help_text="Choose a page to link to", + label="Wagtail Page", + required=False, + ), + ), + ( + "title", + wagtail.blocks.CharBlock( + help_text="Set title for this link", + label="Link title", + max_length=80, + required=False, + ), + ), + ], + help_text="'See more' link", + required=False, + ), + ), + ( + "tiles", + wagtail.blocks.StreamBlock( + [ + ( + "internal_page_tile", + wagtail.blocks.StructBlock( + [ + ( + "page", + wagtail.blocks.PageChooserBlock( + required=True + ), + ) + ] + ), + ), + ( + "external_page_tile", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + help_text="Title for this tile.", + label="Tile Title", + max_length=100, + required=True, + ), + ), + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + help_text="Image for this tile.", + label="Tile Image", + required=False, + ), + ), + ( + "summary", + wagtail.blocks.CharBlock( + help_text="Summary for this tile.", + label="Tile Summary", + max_length=200, + required=False, + ), + ), + ( + "external_link", + wagtail.blocks.URLBlock( + required=True + ), + ), + ] + ), + ), + ], + min_num=1, + required=True, + ), + ), + ] + ), + ), + ("migrated", cdhweb.pages.blocks.migrated.MigratedBlock()), + ], + blank=True, + help_text="Put content for the body of the page here. Start with using the + button.", + use_json_field=True, + verbose_name="Page content", + ), + ), + migrations.AlterField( + model_name="profile", + name="body", + field=wagtail.fields.StreamField( + [ + ("paragraph", cdhweb.pages.blocks.rich_text.RichTextBlock()), + ( + "download_block", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + help_text="Heading for document block", + max_length=80, + required=False, + ), + ), + ( + "description", + wagtail.blocks.TextBlock( + help_text="A description to display with the download file (150 characters maximum).", + max_length=150, + required=False, + ), + ), + ( + "documents", + wagtail.blocks.ListBlock( + cdhweb.pages.blocks.download_block.FileBlock, + help_text="Upload at least 1 and maximum 10 files. Each file size should be less than 5MB.", + max_num=10, + min_num=1, + ), + ), + ] + ), + ), + ( + "cta_block", + wagtail.blocks.StructBlock( + [ + ( + "introduction", + wagtail.blocks.TextBlock( + help_text="Short introduction to the action you want users to take. Ideal: 80 characters or less (Max: 100 characters).", + max_length=100, + required=False, + ), + ), + ( + "cta_buttons", + wagtail.blocks.StreamBlock( + [ + ( + "internal_link", + wagtail.blocks.StructBlock( + [ + ( + "page", + wagtail.blocks.PageChooserBlock(), + ), + ( + "link_text", + wagtail.blocks.CharBlock( + label="Button text", + max_length=40, + required=True, + ), + ), + ] + ), + ), + ( + "external_link", + wagtail.blocks.StructBlock( + [ + ( + "link_url", + wagtail.blocks.URLBlock( + label="URL" + ), + ), + ( + "link_text", + wagtail.blocks.CharBlock( + label="Button text", + max_length=40, + required=True, + ), + ), + ] + ), + ), + ], + max_num=2, + min_num=1, + ), + ), + ] + ), + ), + ( + "accordion_block", + wagtail.blocks.StructBlock( + [ + ( + "show_in_jumplinks", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Link to this block in the jumplinks list (when 'Show jumplinks' is enabled in Page settings)", + required=False, + ), + ), + ( + "heading", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=80, required=True + ), + ) + ], + required=False, + ), + ), + ( + "description", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "document-link", + ], + required=False, + ), + ), + ( + "accordion_items", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=80, + required=True, + verbose_name="Accordion Title", + ), + ), + ( + "body", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "ol", + "ul", + "document-link", + "h3", + "h4", + ], + help_text="Only use H3 if you have not set an overall heading for the accordion block.", + ), + ), + ] + ) + ), + ), + ] + ), + ), + ( + "video_block", + wagtail.blocks.StructBlock( + [ + ( + "video", + wagtail.blocks.URLBlock( + help_text="A YouTube URL. Link to a specifc video or playlist." + ), + ), + ( + "accessibility_description", + wagtail.blocks.CharBlock( + help_text="Use this to describe the video. It is used as an accessibility attribute mainly for screen readers.", + required=False, + ), + ), + ( + "transcript", + wagtail.blocks.RichTextBlock( + features=["bold", "link", "document-link"], + required=False, + ), + ), + ( + "show_in_jumplinks", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Link to this block in the jumplinks list (when 'Show jumplinks' is enabled in Page settings)", + required=False, + ), + ), + ( + "heading", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=80, required=True + ), + ) + ], + required=False, + ), + ), + ] + ), + ), + ( + "embed", + wagtail.blocks.StructBlock( + [ + ( + "show_in_jumplinks", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Link to this block in the jumplinks list (when 'Show jumplinks' is enabled in Page settings)", + required=False, + ), + ), + ( + "heading", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=80, required=True + ), + ) + ], + required=False, + ), + ), + ( + "video_url", + wagtail.embeds.blocks.EmbedBlock( + help_text='This should be used for videos from Princeton\'s Media Central. Copy the "oEmbed URL" from the "Share" menu' + ), + ), + ( + "accessibility_description", + wagtail.blocks.CharBlock( + help_text="Use this to describe the video. It is used as an accessibility attribute mainly for screen readers.", + required=True, + ), + ), + ( + "transcript", + wagtail.blocks.RichTextBlock( + features=["bold", "link", "document-link"], + required=False, + ), + ), + ] + ), + ), + ( + "pull_quote", + wagtail.blocks.StructBlock( + [ + ( + "quote", + wagtail.blocks.RichTextBlock( + features=["bold", "italic"], + help_text='Pull a small section of content out as an "aside" to give it emphasis.', + max_length=100, + required=True, + ), + ), + ( + "attribution", + wagtail.blocks.RichTextBlock( + features=["bold", "link"], + help_text="Optional attribution", + max_length=60, + required=False, + ), + ), + ] + ), + ), + ( + "note", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.TextBlock( + help_text="Optional heading", required=False + ), + ), + ( + "message", + wagtail.blocks.RichTextBlock( + features=["bold", "italic", "link", "ul", "ol"], + help_text="Note message up to 750 chars", + max_length=750, + required=True, + ), + ), + ] + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + label="Image", required=True + ), + ), + ( + "caption", + wagtail.blocks.RichTextBlock( + features=["italic", "bold", "link"], + help_text="A short caption for the image.", + max_length=180, + required=False, + ), + ), + ( + "credit", + wagtail.blocks.RichTextBlock( + features=["italic", "bold", "link"], + help_text="A credit line or attribution for the image.", + max_length=80, + required=False, + ), + ), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Describe the image for screen readers", + max_length=80, + required=False, + ), + ), + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("small", "small"), + ("medium", "medium"), + ("large", "large"), + ], + label="Image Size", + ), + ), + ] + ), + ), + ( + "feature", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=80, required=True + ), + ), + ( + "feature_text", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "document-link", + "italic", + "link", + "ol", + "ul", + ], + max_length=400, + ), + ), + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + label="Image", required=True + ), + ), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Describe the image for screen readers.", + max_length=80, + required=False, + ), + ), + ( + "cta_buttons", + wagtail.blocks.StreamBlock( + [ + ( + "internal_link", + wagtail.blocks.StructBlock( + [ + ( + "page", + wagtail.blocks.PageChooserBlock(), + ), + ( + "link_text", + wagtail.blocks.CharBlock( + label="Button text", + max_length=40, + required=True, + ), + ), + ] + ), + ), + ( + "external_link", + wagtail.blocks.StructBlock( + [ + ( + "link_url", + wagtail.blocks.URLBlock( + label="URL" + ), + ), + ( + "link_text", + wagtail.blocks.CharBlock( + label="Button text", + max_length=40, + required=True, + ), + ), + ] + ), + ), + ], + max_num=2, + min_num=0, + required=False, + ), + ), + ] + ), + ), + ( + "table", + wagtail.blocks.StructBlock( + [ + ( + "caption", + wagtail.blocks.CharBlock( + help_text="Table caption", + label="Caption", + required=False, + ), + ), + ( + "notes", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "document-link", + ], + help_text="Primarily for using for footnotes from cells with asterisks", + label="Table notes", + required=False, + ), + ), + ( + "table", + wagtail.contrib.typed_table_block.blocks.TypedTableBlock( + [ + ( + "rich_text", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "ol", + "ul", + "h3", + ] + ), + ) + ], + help_text="It is recommended to use a minimal number of columns, to ensure the table is usable on mobile and desktop.", + max_num=1, + min_num=1, + ), + ), + ] + ), + ), + ("newsletter", cdhweb.pages.blocks.newsletter.NewsletterBlock()), + ( + "heading", + wagtail.blocks.StructBlock( + [ + ( + "show_in_jumplinks", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Link to this block in the jumplinks list (when 'Show jumplinks' is enabled in Page settings)", + required=False, + ), + ), + ( + "heading", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=80, required=True + ), + ) + ] + ), + ), + ] + ), + ), + ( + "tile_block", + wagtail.blocks.StructBlock( + [ + ( + "show_in_jumplinks", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Link to this block in the jumplinks list (when 'Show jumplinks' is enabled in Page settings)", + required=False, + ), + ), + ( + "heading", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=80, required=True + ), + ) + ], + help_text="Heading for this tile block", + required=False, + ), + ), + ( + "description", + wagtail.blocks.CharBlock( + help_text="Description for this tile block", + label="Description", + required=False, + ), + ), + ( + "see_more_link", + wagtail.blocks.StructBlock( + [ + ( + "page", + wagtail.blocks.PageChooserBlock( + help_text="Choose a page to link to", + label="Wagtail Page", + required=False, + ), + ), + ( + "title", + wagtail.blocks.CharBlock( + help_text="Set title for this link", + label="Link title", + max_length=80, + required=False, + ), + ), + ], + help_text="'See more' link", + required=False, + ), + ), + ( + "tiles", + wagtail.blocks.StreamBlock( + [ + ( + "internal_page_tile", + wagtail.blocks.StructBlock( + [ + ( + "page", + wagtail.blocks.PageChooserBlock( + required=True + ), + ) + ] + ), + ), + ( + "external_page_tile", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + help_text="Title for this tile.", + label="Tile Title", + max_length=100, + required=True, + ), + ), + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + help_text="Image for this tile.", + label="Tile Image", + required=False, + ), + ), + ( + "summary", + wagtail.blocks.CharBlock( + help_text="Summary for this tile.", + label="Tile Summary", + max_length=200, + required=False, + ), + ), + ( + "external_link", + wagtail.blocks.URLBlock( + required=True + ), + ), + ] + ), + ), + ], + min_num=1, + required=True, + ), + ), + ] + ), + ), + ("migrated", cdhweb.pages.blocks.migrated.MigratedBlock()), + ], + blank=True, + help_text="Put content for the body of the page here. Start with using the + button.", + use_json_field=True, + verbose_name="Page content", + ), + ), + migrations.CreateModel( + name="PersonTag", + fields=[ + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "content_object", + modelcluster.fields.ParentalKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="tagged_items", + to="people.profile", + ), + ), + ( + "tag", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="%(app_label)s_%(class)s_items", + to="taggit.tag", + ), + ), + ], + options={ + "abstract": False, + }, + ), + migrations.AddField( + model_name="profile", + name="tags", + field=modelcluster.contrib.taggit.ClusterTaggableManager( + blank=True, + help_text="A comma-separated list of tags.", + through="people.PersonTag", + to="taggit.Tag", + verbose_name="Tags", + ), + ), + ] diff --git a/cdhweb/people/models.py b/cdhweb/people/models.py index c3da429a..46b614b8 100644 --- a/cdhweb/people/models.py +++ b/cdhweb/people/models.py @@ -8,9 +8,11 @@ from django.urls import reverse from django.utils import timezone from django.utils.functional import cached_property +from modelcluster.contrib.taggit import ClusterTaggableManager from modelcluster.fields import ParentalKey from modelcluster.models import ClusterableModel from taggit.managers import TaggableManager +from taggit.models import TaggedItemBase from wagtail.admin.panels import FieldPanel, FieldRowPanel, InlinePanel, MultiFieldPanel from wagtail.fields import RichTextField from wagtail.models import Page @@ -257,6 +259,14 @@ def order_by_position(self): ).order_by("min_title", "min_start", "last_name") +class PersonTag(TaggedItemBase): + """Tags for Profile Pages""" + + content_object = ParentalKey( + "people.Profile", on_delete=models.CASCADE, related_name="tagged_items" + ) + + class Person(ClusterableModel): # in cdhweb 2.x this was a proxy model for User; # in 3.x it is a distinct model with 1-1 optional relationship to User @@ -481,6 +491,7 @@ class Profile(BasePage): related_name="+", ) # no reverse relationship education = RichTextField(features=PARAGRAPH_FEATURES, blank=True) + tags = ClusterTaggableManager(through=PersonTag, blank=True) # admin edit configuration content_panels = Page.content_panels + [ @@ -493,15 +504,19 @@ class Profile(BasePage): parent_page_types = ["people.PeopleLandingPageArchived", "people.PeopleLandingPage"] subpage_types = [] - promote_panels = [ - MultiFieldPanel( - [ - FieldPanel("short_title"), - FieldPanel("feed_image"), - ], - "Share Page", - ), - ] + BasePage.promote_panels + promote_panels = ( + [ + MultiFieldPanel( + [ + FieldPanel("short_title"), + FieldPanel("feed_image"), + ], + "Share Page", + ), + ] + + BasePage.promote_panels + + [FieldPanel("tags")] + ) # index fields search_fields = BasePage.search_fields + [index.SearchField("education")] @@ -514,12 +529,18 @@ def breadcrumbs(self): def get_context(self, request): """Add recent BlogPosts by this Person to their Profile.""" context = super().get_context(request) + print("*******") + print(self.person.events.all()) # get 3 most recent published posts with this person as author; + # get 3 most recent events with this person as a speaker; + # get 3 most recent projects with this person as a member; # add to context and set open graph metadata context.update( { "opengraph_type": "profile", "recent_posts": self.person.posts.live().recent()[:3], + "recent_events": self.person.events.live().recent()[:3], + "recent_projects": self.person.members.live().recent()[:3], } ) return context diff --git a/cdhweb/projects/migrations/0019_alter_project_body_alter_project_members.py b/cdhweb/projects/migrations/0019_alter_project_body_alter_project_members.py new file mode 100644 index 00000000..fd8b1c57 --- /dev/null +++ b/cdhweb/projects/migrations/0019_alter_project_body_alter_project_members.py @@ -0,0 +1,708 @@ +# Generated by Django 5.0.5 on 2024-06-10 02:55 + +import wagtail.blocks +import wagtail.contrib.typed_table_block.blocks +import wagtail.embeds.blocks +import wagtail.fields +import wagtail.images.blocks +from django.db import migrations, models + +import cdhweb.pages.blocks.download_block +import cdhweb.pages.blocks.migrated +import cdhweb.pages.blocks.newsletter +import cdhweb.pages.blocks.rich_text + + +class Migration(migrations.Migration): + dependencies = [ + ("people", "0016_alter_peoplelandingpage_body_alter_profile_body_and_more"), + ("projects", "0018_project_feed_image_project_short_description_and_more"), + ] + + operations = [ + migrations.AlterField( + model_name="project", + name="body", + field=wagtail.fields.StreamField( + [ + ("paragraph", cdhweb.pages.blocks.rich_text.RichTextBlock()), + ( + "download_block", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + help_text="Heading for document block", + max_length=80, + required=False, + ), + ), + ( + "description", + wagtail.blocks.TextBlock( + help_text="A description to display with the download file (150 characters maximum).", + max_length=150, + required=False, + ), + ), + ( + "documents", + wagtail.blocks.ListBlock( + cdhweb.pages.blocks.download_block.FileBlock, + help_text="Upload at least 1 and maximum 10 files. Each file size should be less than 5MB.", + max_num=10, + min_num=1, + ), + ), + ] + ), + ), + ( + "cta_block", + wagtail.blocks.StructBlock( + [ + ( + "introduction", + wagtail.blocks.TextBlock( + help_text="Short introduction to the action you want users to take. Ideal: 80 characters or less (Max: 100 characters).", + max_length=100, + required=False, + ), + ), + ( + "cta_buttons", + wagtail.blocks.StreamBlock( + [ + ( + "internal_link", + wagtail.blocks.StructBlock( + [ + ( + "page", + wagtail.blocks.PageChooserBlock(), + ), + ( + "link_text", + wagtail.blocks.CharBlock( + label="Button text", + max_length=40, + required=True, + ), + ), + ] + ), + ), + ( + "external_link", + wagtail.blocks.StructBlock( + [ + ( + "link_url", + wagtail.blocks.URLBlock( + label="URL" + ), + ), + ( + "link_text", + wagtail.blocks.CharBlock( + label="Button text", + max_length=40, + required=True, + ), + ), + ] + ), + ), + ], + max_num=2, + min_num=1, + ), + ), + ] + ), + ), + ( + "accordion_block", + wagtail.blocks.StructBlock( + [ + ( + "show_in_jumplinks", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Link to this block in the jumplinks list (when 'Show jumplinks' is enabled in Page settings)", + required=False, + ), + ), + ( + "heading", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=80, required=True + ), + ) + ], + required=False, + ), + ), + ( + "description", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "document-link", + ], + required=False, + ), + ), + ( + "accordion_items", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=80, + required=True, + verbose_name="Accordion Title", + ), + ), + ( + "body", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "ol", + "ul", + "document-link", + "h3", + "h4", + ], + help_text="Only use H3 if you have not set an overall heading for the accordion block.", + ), + ), + ] + ) + ), + ), + ] + ), + ), + ( + "video_block", + wagtail.blocks.StructBlock( + [ + ( + "video", + wagtail.blocks.URLBlock( + help_text="A YouTube URL. Link to a specifc video or playlist." + ), + ), + ( + "accessibility_description", + wagtail.blocks.CharBlock( + help_text="Use this to describe the video. It is used as an accessibility attribute mainly for screen readers.", + required=False, + ), + ), + ( + "transcript", + wagtail.blocks.RichTextBlock( + features=["bold", "link", "document-link"], + required=False, + ), + ), + ( + "show_in_jumplinks", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Link to this block in the jumplinks list (when 'Show jumplinks' is enabled in Page settings)", + required=False, + ), + ), + ( + "heading", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=80, required=True + ), + ) + ], + required=False, + ), + ), + ] + ), + ), + ( + "embed", + wagtail.blocks.StructBlock( + [ + ( + "show_in_jumplinks", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Link to this block in the jumplinks list (when 'Show jumplinks' is enabled in Page settings)", + required=False, + ), + ), + ( + "heading", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=80, required=True + ), + ) + ], + required=False, + ), + ), + ( + "video_url", + wagtail.embeds.blocks.EmbedBlock( + help_text='This should be used for videos from Princeton\'s Media Central. Copy the "oEmbed URL" from the "Share" menu' + ), + ), + ( + "accessibility_description", + wagtail.blocks.CharBlock( + help_text="Use this to describe the video. It is used as an accessibility attribute mainly for screen readers.", + required=True, + ), + ), + ( + "transcript", + wagtail.blocks.RichTextBlock( + features=["bold", "link", "document-link"], + required=False, + ), + ), + ] + ), + ), + ( + "pull_quote", + wagtail.blocks.StructBlock( + [ + ( + "quote", + wagtail.blocks.RichTextBlock( + features=["bold", "italic"], + help_text='Pull a small section of content out as an "aside" to give it emphasis.', + max_length=100, + required=True, + ), + ), + ( + "attribution", + wagtail.blocks.RichTextBlock( + features=["bold", "link"], + help_text="Optional attribution", + max_length=60, + required=False, + ), + ), + ] + ), + ), + ( + "note", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.TextBlock( + help_text="Optional heading", required=False + ), + ), + ( + "message", + wagtail.blocks.RichTextBlock( + features=["bold", "italic", "link", "ul", "ol"], + help_text="Note message up to 750 chars", + max_length=750, + required=True, + ), + ), + ] + ), + ), + ( + "image", + wagtail.blocks.StructBlock( + [ + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + label="Image", required=True + ), + ), + ( + "caption", + wagtail.blocks.RichTextBlock( + features=["italic", "bold", "link"], + help_text="A short caption for the image.", + max_length=180, + required=False, + ), + ), + ( + "credit", + wagtail.blocks.RichTextBlock( + features=["italic", "bold", "link"], + help_text="A credit line or attribution for the image.", + max_length=80, + required=False, + ), + ), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Describe the image for screen readers", + max_length=80, + required=False, + ), + ), + ( + "size", + wagtail.blocks.ChoiceBlock( + choices=[ + ("small", "small"), + ("medium", "medium"), + ("large", "large"), + ], + label="Image Size", + ), + ), + ] + ), + ), + ( + "feature", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=80, required=True + ), + ), + ( + "feature_text", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "document-link", + "italic", + "link", + "ol", + "ul", + ], + max_length=400, + ), + ), + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + label="Image", required=True + ), + ), + ( + "alt_text", + wagtail.blocks.CharBlock( + help_text="Describe the image for screen readers.", + max_length=80, + required=False, + ), + ), + ( + "cta_buttons", + wagtail.blocks.StreamBlock( + [ + ( + "internal_link", + wagtail.blocks.StructBlock( + [ + ( + "page", + wagtail.blocks.PageChooserBlock(), + ), + ( + "link_text", + wagtail.blocks.CharBlock( + label="Button text", + max_length=40, + required=True, + ), + ), + ] + ), + ), + ( + "external_link", + wagtail.blocks.StructBlock( + [ + ( + "link_url", + wagtail.blocks.URLBlock( + label="URL" + ), + ), + ( + "link_text", + wagtail.blocks.CharBlock( + label="Button text", + max_length=40, + required=True, + ), + ), + ] + ), + ), + ], + max_num=2, + min_num=0, + required=False, + ), + ), + ] + ), + ), + ( + "table", + wagtail.blocks.StructBlock( + [ + ( + "caption", + wagtail.blocks.CharBlock( + help_text="Table caption", + label="Caption", + required=False, + ), + ), + ( + "notes", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "document-link", + ], + help_text="Primarily for using for footnotes from cells with asterisks", + label="Table notes", + required=False, + ), + ), + ( + "table", + wagtail.contrib.typed_table_block.blocks.TypedTableBlock( + [ + ( + "rich_text", + wagtail.blocks.RichTextBlock( + features=[ + "bold", + "italic", + "link", + "ol", + "ul", + "h3", + ] + ), + ) + ], + help_text="It is recommended to use a minimal number of columns, to ensure the table is usable on mobile and desktop.", + max_num=1, + min_num=1, + ), + ), + ] + ), + ), + ("newsletter", cdhweb.pages.blocks.newsletter.NewsletterBlock()), + ( + "heading", + wagtail.blocks.StructBlock( + [ + ( + "show_in_jumplinks", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Link to this block in the jumplinks list (when 'Show jumplinks' is enabled in Page settings)", + required=False, + ), + ), + ( + "heading", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=80, required=True + ), + ) + ] + ), + ), + ] + ), + ), + ( + "tile_block", + wagtail.blocks.StructBlock( + [ + ( + "show_in_jumplinks", + wagtail.blocks.BooleanBlock( + default=False, + help_text="Link to this block in the jumplinks list (when 'Show jumplinks' is enabled in Page settings)", + required=False, + ), + ), + ( + "heading", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock( + max_length=80, required=True + ), + ) + ], + help_text="Heading for this tile block", + required=False, + ), + ), + ( + "description", + wagtail.blocks.CharBlock( + help_text="Description for this tile block", + label="Description", + required=False, + ), + ), + ( + "see_more_link", + wagtail.blocks.StructBlock( + [ + ( + "page", + wagtail.blocks.PageChooserBlock( + help_text="Choose a page to link to", + label="Wagtail Page", + required=False, + ), + ), + ( + "title", + wagtail.blocks.CharBlock( + help_text="Set title for this link", + label="Link title", + max_length=80, + required=False, + ), + ), + ], + help_text="'See more' link", + required=False, + ), + ), + ( + "tiles", + wagtail.blocks.StreamBlock( + [ + ( + "internal_page_tile", + wagtail.blocks.StructBlock( + [ + ( + "page", + wagtail.blocks.PageChooserBlock( + required=True + ), + ) + ] + ), + ), + ( + "external_page_tile", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock( + help_text="Title for this tile.", + label="Tile Title", + max_length=100, + required=True, + ), + ), + ( + "image", + wagtail.images.blocks.ImageChooserBlock( + help_text="Image for this tile.", + label="Tile Image", + required=False, + ), + ), + ( + "summary", + wagtail.blocks.CharBlock( + help_text="Summary for this tile.", + label="Tile Summary", + max_length=200, + required=False, + ), + ), + ( + "external_link", + wagtail.blocks.URLBlock( + required=True + ), + ), + ] + ), + ), + ], + min_num=1, + required=True, + ), + ), + ] + ), + ), + ("migrated", cdhweb.pages.blocks.migrated.MigratedBlock()), + ], + blank=True, + help_text="Put content for the body of the page here. Start with using the + button.", + use_json_field=True, + verbose_name="Page content", + ), + ), + migrations.AlterField( + model_name="project", + name="members", + field=models.ManyToManyField( + related_name="members", + through="projects.Membership", + to="people.person", + ), + ), + ] diff --git a/cdhweb/projects/models.py b/cdhweb/projects/models.py index 4c70857a..d40835ee 100644 --- a/cdhweb/projects/models.py +++ b/cdhweb/projects/models.py @@ -73,6 +73,13 @@ def order_by_newest_grant(self): "-last_start", "title" ) + def recent(self): + """Order projects by date published.""" + # NOTE we can't use ordering on the model to do this by default, so we + # have to make sure to call this method instead. See: + # https://docs.wagtail.io/en/stable/topics/pages.html#page-queryset-ordering + return self.order_by("-first_published_at") + # custom manager for wagtail pages, see: # https://docs.wagtail.io/en/stable/topics/pages.html#custom-page-managers @@ -110,7 +117,9 @@ class Project(BasePage, ClusterableModel, StandardHeroMixin): help_text="Project is a long-term collaborative group associated with the CDH.", ) - members = models.ManyToManyField(Person, through="Membership") + members = models.ManyToManyField( + Person, through="Membership", related_name="members" + ) tags = ClusterTaggableManager(through=ProjectTag, blank=True) # TODO attachments (#245) diff --git a/templates/cdhpages/blocks/standard_tile_block.html b/templates/cdhpages/blocks/standard_tile_block.html index accfdf47..b8f51590 100644 --- a/templates/cdhpages/blocks/standard_tile_block.html +++ b/templates/cdhpages/blocks/standard_tile_block.html @@ -22,6 +22,6 @@
{% for tile in tiles %} - {% include 'cdhpages/blocks/tile.html' with has_component_title=self.heading.heading %} + {% include 'cdhpages/blocks/tile.html' with internal_page=tile.value.page tile_type=tile.block.name has_component_title=self.heading.heading %} {% endfor %}
\ No newline at end of file diff --git a/templates/cdhpages/blocks/tile.html b/templates/cdhpages/blocks/tile.html index 0821a07a..735d7258 100644 --- a/templates/cdhpages/blocks/tile.html +++ b/templates/cdhpages/blocks/tile.html @@ -1,18 +1,16 @@ {% load wagtailcore_tags wagtailimages_tags l10n %} - -{% with tile.value.page as internal_page %}
<{% if has_component_title %}h3{% else %}h2{% endif %}> - {% if tile.block.name == 'internal_page_tile' %} + {% if tile_type == 'internal_page_tile' %} {{ internal_page.specific.short_title|default:internal_page.specific.title }} {% else %} {# External tile title #} @@ -22,7 +20,7 @@ {# Internal page deets #} - {% if tile.block.name == 'internal_page_tile' %} + {% if tile_type == 'internal_page_tile' %} {{ internal_page.specific.description|richtext }} @@ -72,7 +70,7 @@ {% endif %}
- {% if tile.block.name == 'internal_page_tile' %} + {% if tile_type == 'internal_page_tile' %} {% if internal_page.specific.feed_image %} {% image internal_page.specific.feed_image fill-900x493 format-webp as image %} {{ image.alt }} @@ -92,8 +90,6 @@
-{% endwith %} - {% comment %} {# TODO, do something with this maybe? Once blog/news exists #} {% if internal_page.specific.page_type == 'BlogPost' %} diff --git a/templates/includes/person_hero.html b/templates/includes/person_hero.html index 12850eb5..d128bfa3 100644 --- a/templates/includes/person_hero.html +++ b/templates/includes/person_hero.html @@ -6,10 +6,13 @@

{{ self.title}}

{{ person.current_title }}

{{ page.education|richtext }}
+ {% if self.tags %}
-
TODO tag 1
-
TODO tag 2 etc
+ {% for tag in self.tags.all %} +
{{ tag }}
+ {% endfor %}
+ {% endif %}
+{% if recent_projects %} +

Recent Projects

+ {% for project in recent_projects %} + {% include 'cdhpages/blocks/tile.html' with internal_page=project tile_type='internal_page_tile' %} + {% endfor %} +{% endif %} + +{% if recent_events %} +

Recent Events

+ {% for event in recent_events %} + {% include 'cdhpages/blocks/tile.html' with internal_page=event tile_type='internal_page_tile' %} + {% endfor %} +{% endif %} + +{# TODO - when blog page exists #} +{% if recent_posts %} +

Recent Posts

+ {% for post in recent_posts %} + {% include 'cdhpages/blocks/tile.html' with internal_page=post tile_type='internal_page_tile' %} + {% endfor %} +{% endif %} {% endblock %} \ No newline at end of file From ba912f573151b75ad239faf5272d9674254cdc9c Mon Sep 17 00:00:00 2001 From: sarahframe Date: Mon, 10 Jun 2024 16:10:19 +1200 Subject: [PATCH 2/2] remove print line --- cdhweb/people/models.py | 2 -- cdhweb/projects/models.py | 3 --- 2 files changed, 5 deletions(-) diff --git a/cdhweb/people/models.py b/cdhweb/people/models.py index 46b614b8..6349f2ab 100644 --- a/cdhweb/people/models.py +++ b/cdhweb/people/models.py @@ -529,8 +529,6 @@ def breadcrumbs(self): def get_context(self, request): """Add recent BlogPosts by this Person to their Profile.""" context = super().get_context(request) - print("*******") - print(self.person.events.all()) # get 3 most recent published posts with this person as author; # get 3 most recent events with this person as a speaker; # get 3 most recent projects with this person as a member; diff --git a/cdhweb/projects/models.py b/cdhweb/projects/models.py index d40835ee..fe31aeae 100644 --- a/cdhweb/projects/models.py +++ b/cdhweb/projects/models.py @@ -75,9 +75,6 @@ def order_by_newest_grant(self): def recent(self): """Order projects by date published.""" - # NOTE we can't use ordering on the model to do this by default, so we - # have to make sure to call this method instead. See: - # https://docs.wagtail.io/en/stable/topics/pages.html#page-queryset-ordering return self.order_by("-first_published_at")