From fdd18433a042825e42e22f66c500bfa8d6864566 Mon Sep 17 00:00:00 2001 From: phillip stanley Date: Fri, 13 Mar 2026 17:47:32 +0000 Subject: [PATCH] CDD-3163: Implement section footer for landing & topic_list page --- cms/dynamic_content/blocks.py | 13 + cms/dynamic_content/help_texts.py | 16 + cms/dynamic_content/sections.py | 14 +- .../migrations/0032_alter_landingpage_body.py | 1067 +++++++++++++++++ .../0005_alter_topicslistpage_body.py | 1067 +++++++++++++++++ 5 files changed, 2171 insertions(+), 6 deletions(-) create mode 100644 cms/home/migrations/0032_alter_landingpage_body.py create mode 100644 cms/topics_list/migrations/0005_alter_topicslistpage_body.py diff --git a/cms/dynamic_content/blocks.py b/cms/dynamic_content/blocks.py index 21f2df846..340acc7a0 100644 --- a/cms/dynamic_content/blocks.py +++ b/cms/dynamic_content/blocks.py @@ -198,3 +198,16 @@ def _validate_only_one_of_page_or_external_url( if page and external_url: error_message = "Use either page OR external_url, not both." raise ValidationError(error_message) + + +class SectionFooterLink(blocks.StructBlock): + badge_label = blocks.CharBlock( + help_text=help_texts.SECTION_FOOTER_BADGE_LABEL, required=True + ) + text = blocks.CharBlock( + help_text=help_texts.SECTION_FOOTER_LINK_TEXT, required=True + ) + link = SourceLinkBlock(help_text=help_texts.SECTION_FOOTER_LINK, required=True) + + class Meta: + icon = "link" diff --git a/cms/dynamic_content/help_texts.py b/cms/dynamic_content/help_texts.py index 351e88efd..1d0c847ea 100644 --- a/cms/dynamic_content/help_texts.py +++ b/cms/dynamic_content/help_texts.py @@ -588,3 +588,19 @@ PAGE_CLASSIFICATION: str = """ The classification level of all data on this page (only applies to non-public pages). Defaults to `Official-Sensitive`. """ + +SECTION_FOOTER_BLOCKS: str = """ +This is an optional footer for content sections to allow additional supporting information to be linked too. (E.g. a link to furhter information about how we define an outbreak) +""" +SECTION_FOOTER: str = """ +This is an optional footer for a section to provide a link to further information. +""" +SECTION_FOOTER_BADGE_LABEL: str = """ +This is the label used for the a section footer link badge" +""" +SECTION_FOOTER_LINK_TEXT: str = """ +This is the text to displayed along side a link in a the sections footer link. +""" +SECTION_FOOTER_LINK: str = """ +This is a link component that allows the user to setup an internal or external link along with a short description of the link's content. +""" diff --git a/cms/dynamic_content/sections.py b/cms/dynamic_content/sections.py index 2bdd5368a..3525595b1 100644 --- a/cms/dynamic_content/sections.py +++ b/cms/dynamic_content/sections.py @@ -1,9 +1,4 @@ -from wagtail.blocks import ( - RichTextBlock, - StreamBlock, - StructBlock, - TextBlock, -) +from wagtail.blocks import RichTextBlock, StreamBlock, StructBlock, TextBlock from cms.dynamic_content import blocks, cards, help_texts from cms.dynamic_content.global_filter.card import GlobalFilterCard @@ -35,6 +30,10 @@ class ContentCards(StreamBlock): ) +class FooterCardsSectionWithLink(StreamBlock): + section_link = blocks.SectionFooterLink(max_num=1) + + class ContentCardsSectionWithLink(StreamBlock): text_card = cards.TextCard() chart_card_section = cards.ChartCardSection() @@ -58,6 +57,9 @@ class SectionWithLink(StructBlock): help_text=help_texts.INDEX_PAGE_FIELD, ) content = ContentCardsSectionWithLink(help_text=help_texts.CONTENT_ROW_CARDS) + footer = FooterCardsSectionWithLink( + help_text=help_texts.SECTION_FOOTER, required=False + ) class Meta: icon = "thumbtack" diff --git a/cms/home/migrations/0032_alter_landingpage_body.py b/cms/home/migrations/0032_alter_landingpage_body.py new file mode 100644 index 000000000..4bcd677a1 --- /dev/null +++ b/cms/home/migrations/0032_alter_landingpage_body.py @@ -0,0 +1,1067 @@ +# Generated by Django 5.2.12 on 2026-04-01 14:47 + +import cms.dynamic_content.cards +import cms.metrics_interface.field_choices_callables +import validation.url +import wagtail.fields +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ("home", "0031_alter_landingpagerelatedlink_body"), + ] + + operations = [ + migrations.AlterField( + model_name="landingpage", + name="body", + field=wagtail.fields.StreamField( + [("section", 102)], + block_lookup={ + 0: ( + "wagtail.blocks.TextBlock", + (), + { + "help_text": "\nThe text you add here will be used as the heading for this section. \n", + "required": True, + }, + ), + 1: ( + "cms.dynamic_content.blocks.PageLinkChooserBlock", + (), + { + "help_text": "\nThe related index page you want to link to. Eg: `Respiratory viruses` or `Outbreaks`\n", + "page_type": ["composite.CompositePage"], + "required": False, + }, + ), + 2: ( + "wagtail.blocks.RichTextBlock", + (), + { + "features": ["h2", "h3", "h4", "bold", "ul", "link"], + "help_text": "\nThis section of text will comprise this card. \nNote that this card will span the length of the available page width if sufficient text content is provided.\n", + }, + ), + 3: ("wagtail.blocks.StructBlock", [[("body", 2)]], {}), + 4: ( + "wagtail.blocks.TextBlock", + (), + { + "help_text": "\nThe title to display for this component. \nNote that this will be shown in the hex colour #505A5F\n", + "required": True, + }, + ), + 5: ( + "wagtail.blocks.TextBlock", + (), + { + "help_text": "\nAn optional body of text to accompany this block. This text will be displayed below the chart title.\n", + "label": "Subtitle", + "required": False, + }, + ), + 6: ( + "wagtail.blocks.TextBlock", + (), + { + "default": "", + "help_text": "\nAn optional body of text to accompany this block. This text will be displayed in the about content of the chart.\n", + "required": False, + }, + ), + 7: ( + "wagtail.blocks.CharBlock", + (), + { + "help_text": "\nThe Text that will be displayed for the URL.\n", + "required": True, + }, + ), + 8: ( + "wagtail.blocks.CharBlock", + (), + { + "help_text": "\nThe URL that the user will be navigated to when clicked.\nAn optional body of text to accompany this block. This text will be displayed below the chart title.\n", + "required": True, + }, + ), + 9: ( + "wagtail.blocks.StructBlock", + [[("link_display_text", 7), ("link", 8)]], + {}, + ), + 10: ( + "wagtail.blocks.StreamBlock", + [[("related_link", 9)]], + { + "help_text": "\nProvide optional URLs that can provide further contextual information for the data displayed in the chart.\n", + "required": False, + }, + ), + 11: ( + "wagtail.blocks.CharBlock", + (), + { + "help_text": "\nThe ID to associate with this component. \nThis allows for tracking of events when users interact with this component.\nNote that changing this multiple times will result in the recording of different groups of events.\n", + "label": "Tag manager event ID", + "required": False, + }, + ), + 12: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "choices": cms.metrics_interface.field_choices_callables.get_possible_axis_choices, + "help_text": "\nAn optional choice of what to display along the x-axis of the chart.\nIf nothing is provided, `dates` will be used by default.\nDates are used by default\n", + "required": False, + }, + ), + 13: ( + "wagtail.blocks.CharBlock", + (), + { + "default": "", + "help_text": "\nAn optional title to display along the x-axis of the chart.\nIf nothing is provided, then no title will be displayed.\n", + "required": False, + }, + ), + 14: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "choices": cms.metrics_interface.field_choices_callables.get_possible_axis_choices, + "help_text": "\nAn optional choice of what to display along the y-axis of the chart.\nIf nothing is provided, `metric value` will be used by default.\n", + "required": False, + }, + ), + 15: ( + "wagtail.blocks.CharBlock", + (), + { + "default": "", + "help_text": "\nAn optional title to display along the y-axis of the chart.\nIf nothing is provided, then no title will be displayed.\n", + "required": False, + }, + ), + 16: ( + "wagtail.blocks.DecimalBlock", + (), + { + "default": 0, + "help_text": "\nThis field allows you to set the first value in the chart's y-axis range. Please\nnote that a value provided here, which is higher than the lowest value in the data will\nbe overridden and the value from the dataset will be used.\n", + "required": False, + }, + ), + 17: ( + "wagtail.blocks.DecimalBlock", + (), + { + "help_text": "\nThis field allows you to set the last value in the chart's y-axis range. Please\nnote that a value provided here, which is lower than the highest value in the data will\nbe overridden and the value from the dataset will be used. \n", + "required": False, + }, + ), + 18: ( + "wagtail.blocks.BooleanBlock", + (), + { + "default": False, + "help_text": "\nThis is a switch to show tooltips on hover within the chart.\nDefaults to False.\n", + "required": False, + }, + ), + 19: ( + "wagtail.blocks.CharBlock", + (), + { + "default": "Up to and including", + "help_texts": "\nThis is the accompanying text for chart dates Eg: `Up to and including` 21 Oct 2024\n", + "requried": True, + }, + ), + 20: ( + "wagtail.blocks.BooleanBlock", + (), + { + "default": False, + "help_text": "\nThis option enables timeseries filter for this chart.\nThe timeseries filter allows a user to change the timeseries range for example between\n1m, 3m, 6m, 1y etc.\n", + "required": False, + }, + ), + 21: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "choices": cms.metrics_interface.field_choices_callables.get_all_topic_names, + "help_text": "The name of the topic to pull data e.g. COVID-19.", + }, + ), + 22: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "choices": cms.metrics_interface.field_choices_callables.get_all_timeseries_metric_names, + "help_text": '\nThe name of the metric to pull data for e.g. "COVID-19_deaths_ONSByDay".\n', + }, + ), + 23: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "choices": cms.metrics_interface.field_choices_callables.get_all_geography_names, + "help_text": "\nThe name of the geography associated with this particular piece of data.\nIf nothing is provided, then no filtering will be applied for this field.\n", + }, + ), + 24: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "choices": cms.metrics_interface.field_choices_callables.get_all_geography_type_names, + "help_text": "\nThe type of geographical categorisation to apply any data filtering to.\nIf nothing is provided, then no filtering will be applied for this field.\n", + }, + ), + 25: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "choices": cms.metrics_interface.field_choices_callables.get_all_sex_names, + "help_text": "\nThe gender to filter for, if any.\nThe only options available are `M`, `F` and `ALL`.\nBy default, no filtering will be applied to the underlying query if no selection is made.\n", + }, + ), + 26: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "choices": cms.metrics_interface.field_choices_callables.get_all_age_names, + "help_text": "\nThe age band to filter for, if any.\nBy default, no filtering will be applied to the underlying query if no selection is made.\n", + }, + ), + 27: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "choices": cms.metrics_interface.field_choices_callables.get_all_stratum_names, + "help_text": "\nThe smallest subgroup a piece of data can be broken down into.\nFor example, this could be broken down by ethnicity or testing pillar.\nIf nothing is provided, then no filtering will be applied for this field.\n", + }, + ), + 28: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "choices": cms.metrics_interface.field_choices_callables.get_chart_types, + "help_text": "\nThe name of the type of chart which you want to create e.g. bar\n", + }, + ), + 29: ( + "wagtail.blocks.DateBlock", + (), + { + "help_text": "\nThe date from which to begin the supporting plot data. \nNote that if nothing is provided, a default of 1 year ago from the current date will be applied.\n", + "required": False, + }, + ), + 30: ( + "wagtail.blocks.DateBlock", + (), + { + "help_text": "\nThe date to which to end the supporting plot data. \nNote that if nothing is provided, a default of the current date will be applied.\n", + "required": False, + }, + ), + 31: ( + "wagtail.blocks.TextBlock", + (), + { + "help_text": "\nThe label to assign on the legend for this individual plot.\nE.g. `15 to 44 years old`\n", + "required": False, + }, + ), + 32: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "choices": cms.metrics_interface.field_choices_callables.get_colours, + "help_text": '\nThe colour to apply to this individual line plot. The colours conform to the GDS specification.\nCurrently, only the `line_multi_coloured` chart type supports different line colours.\nFor all other chart types, this field will be ignored.\nNote that if nothing is provided, a default of "BLACK" will be applied.\nE.g. `GREEN`\n', + }, + ), + 33: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "choices": cms.metrics_interface.field_choices_callables.get_chart_line_types, + "help_text": '\nThe line type to apply to this individual line plot.\nCurrently, only the `line_multi_coloured` chart type supports different line types.\nFor all other chart types, this field will be ignored.\nNote that if nothing is provided, a default of "SOLID" will be applied.\nE.g. `DASH`\n', + "required": False, + }, + ), + 34: ( + "wagtail.blocks.BooleanBlock", + (), + { + "default": False, + "help_text": "\nIf set to true, markers are drawn on each individual data point.\nIf set to false, markers are not drawn at all.\nThis is only applicable to line-type charts.\n", + "required": False, + }, + ), + 35: ( + "wagtail.blocks.BooleanBlock", + (), + { + "default": True, + "help_text": "\nIf set to true, draws the plot as a spline line, resulting in smooth curves between data points.\nIf set to false, draws the plot as a linear line, \nresulting in linear point-to-point lines being drawn between data points.\nThis is only applicable to line-type charts.\n", + "required": False, + }, + ), + 36: ( + "wagtail.blocks.StructBlock", + [ + [ + ("topic", 21), + ("metric", 22), + ("geography", 23), + ("geography_type", 24), + ("sex", 25), + ("age", 26), + ("stratum", 27), + ("chart_type", 28), + ("date_from", 29), + ("date_to", 30), + ("label", 31), + ("line_colour", 32), + ("line_type", 33), + ("use_markers", 34), + ("use_smooth_lines", 35), + ] + ], + {}, + ), + 37: ( + "wagtail.blocks.StreamBlock", + [[("plot", 36)]], + { + "help_text": "\nAdd the plots required for your chart. \nWithin each plot, you will be required to add a set of fields which will be used to fetch the supporting data \nfor that plot.\n" + }, + ), + 38: ( + "wagtail.blocks.StructBlock", + [ + [ + ("title", 4), + ("body", 5), + ("about", 6), + ("related_links", 10), + ("tag_manager_event_id", 11), + ("x_axis", 12), + ("x_axis_title", 13), + ("y_axis", 14), + ("y_axis_title", 15), + ("y_axis_minimum_value", 16), + ("y_axis_maximum_value", 17), + ("show_tooltips", 18), + ("date_prefix", 19), + ("show_timeseries_filter", 20), + ("chart", 37), + ] + ], + {}, + ), + 39: ( + "cms.dynamic_content.blocks.PageLinkChooserBlock", + (), + { + "help_text": "\nThe related topic page you want to link to. Eg: `COVID-19`\n", + "page_type": ["topic.TopicPage"], + "required": True, + }, + ), + 40: ( + "wagtail.blocks.TextBlock", + (), + { + "help_text": "\nRequired description for the chart.\n", + "required": True, + }, + ), + 41: ( + "wagtail.blocks.CharBlock", + (), + { + "help_text": "\nDisplay text for the link.\n", + "required": False, + }, + ), + 42: ( + "cms.dynamic_content.blocks.PageLinkChooserBlock", + (), + { + "help_text": "\nFor linking to internal pages. (If chosen, external_url must be blank).\n", + "page_type": ["topic.TopicPage"], + "required": False, + }, + ), + 43: ( + "wagtail.blocks.URLBlock", + (), + { + "help_text": "\nFor linking to external url. (Only one of page or external_url must be filled not both).\n", + "required": False, + "validators": [validation.url.validate_https_scheme], + }, + ), + 44: ( + "wagtail.blocks.StructBlock", + [ + [ + ("link_display_text", 41), + ("page", 42), + ("external_url", 43), + ] + ], + { + "help_text": "\nSource link (internal or external).\n", + "required": False, + }, + ), + 45: ( + "wagtail.blocks.StructBlock", + [ + [ + ("title", 4), + ("sub_title", 5), + ("topic_page", 39), + ("description", 40), + ("source", 44), + ("tag_manager_event_id", 11), + ("x_axis", 12), + ("x_axis_title", 13), + ("y_axis", 14), + ("y_axis_title", 15), + ("y_axis_minimum_value", 16), + ("y_axis_maximum_value", 17), + ("show_tooltips", 18), + ("chart", 37), + ] + ], + {}, + ), + 46: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "choices": cms.metrics_interface.field_choices_callables.get_possible_axis_choices, + "help_text": "\nA required choice of what to display along the x-axis of the chart.\n", + }, + ), + 47: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "choices": cms.metrics_interface.field_choices_callables.get_all_headline_metric_names, + "help_text": '\nThe name of the metric to pull data for e.g. "COVID-19_deaths_ONSByDay".\n', + }, + ), + 48: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "choices": cms.metrics_interface.field_choices_callables.get_headline_chart_types, + "help_text": "\nThe name of the type of chart which you want to create e.g. bar\n", + }, + ), + 49: ( + "wagtail.blocks.StructBlock", + [ + [ + ("topic", 21), + ("metric", 47), + ("geography", 23), + ("geography_type", 24), + ("sex", 25), + ("age", 26), + ("stratum", 27), + ("chart_type", 48), + ("line_colour", 32), + ("label", 31), + ] + ], + {}, + ), + 50: ( + "wagtail.blocks.StreamBlock", + [[("plot", 49)]], + { + "help_texts": "\nAdd the plots required for your chart. \nWithin each plot, you will be required to add a set of fields which will be used to fetch the supporting data \nfor that plot.\n" + }, + ), + 51: ( + "wagtail.blocks.BooleanBlock", + (), + { + "default": False, + "help_text": "\nToggle to enable confidence intervals if they are present in the data set\n", + "required": False, + }, + ), + 52: ( + "wagtail.blocks.TextBlock", + (), + { + "default": "Metric column includes 95% lower and upper confidence intervals, in brackets.", + "help_text": "\nAn optional body of text to accompany this block.\nThis text will be displayed above the metrics table if confidence intervals is enabled.\n", + "required": False, + }, + ), + 53: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "choices": cms.metrics_interface.field_choices_callables.get_colours, + "help_text": '\nThe colour to display the confidence interval in. The colours conform to the GDS specification.\nNote that if nothing is provided, a default of "BLACK" will be applied.\n', + "required": False, + }, + ), + 54: ( + "wagtail.blocks.StructBlock", + [ + [ + ("title", 4), + ("body", 5), + ("about", 6), + ("related_links", 10), + ("tag_manager_event_id", 11), + ("x_axis", 46), + ("x_axis_title", 13), + ("y_axis", 14), + ("y_axis_title", 15), + ("y_axis_minimum_value", 16), + ("y_axis_maximum_value", 17), + ("show_tooltips", 18), + ("date_prefix", 19), + ("show_timeseries_filter", 20), + ("chart", 50), + ("confidence_intervals", 51), + ("confidence_intervals_description", 52), + ("confidence_colour", 53), + ] + ], + {}, + ), + 55: ( + "wagtail.blocks.TextBlock", + (), + { + "help_text": "\nAn optional body of text to accompany this block. This text will be displayed in the about content of the chart.\n", + "required": False, + }, + ), + 56: ( + "wagtail.blocks.CharBlock", + (), + { + "default": "Up to and including", + "help_text": "\nThis is the accompanying text for chart dates Eg: `Up to and including` 21 Oct 2024\n", + "required": True, + }, + ), + 57: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "choices": cms.metrics_interface.field_choices_callables.get_all_unique_metric_names, + "help_text": '\nThe name of the metric to pull data for e.g. "COVID-19_deaths_ONSByDay".\n', + }, + ), + 58: ( + "wagtail.blocks.TextBlock", + (), + { + "help_text": "\nAn optional body of text to accompany this block. This text will be displayed below the chart title.\n", + "required": False, + }, + ), + 59: ( + "wagtail.blocks.StructBlock", + [ + [ + ("topic", 21), + ("metric", 57), + ("geography", 23), + ("geography_type", 24), + ("sex", 25), + ("age", 26), + ("stratum", 27), + ("body", 58), + ] + ], + { + "help_text": '\nThis component will display a key headline number type metric.\nYou can also optionally add a body of text to accompany that headline number.\nE.g. "Patients admitted"\n' + }, + ), + 60: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "choices": cms.metrics_interface.field_choices_callables.get_all_unique_change_type_metric_names, + "help_text": "\nThe name of the trend type metric to pull data e.g. \"COVID-19_headline_ONSdeaths_7daychange\". \nNote that only 'change' type metrics are available for selection for this field type.\n", + }, + ), + 61: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "choices": cms.metrics_interface.field_choices_callables.get_all_unique_percent_change_type_names, + "help_text": "\nThe name of the accompanying percentage trend type metric to pull data \ne.g. \"COVID-19_headline_ONSdeaths_7daypercentchange\". \nNote that only 'percent' type metrics are available for selection for this field type.\n", + }, + ), + 62: ( + "wagtail.blocks.StructBlock", + [ + [ + ("topic", 21), + ("metric", 60), + ("geography", 23), + ("geography_type", 24), + ("sex", 25), + ("age", 26), + ("stratum", 27), + ("body", 58), + ("percentage_metric", 61), + ] + ], + { + "help_text": '\nThis component will display a trend number type metric.\nThis will display an arrow pointing in the direction of the metric change \nas well as colouring of the block to indicate the context of the change.\nYou can also optionally add a body of text to accompany that headline number.\nE.g. "Last 7 days"\n' + }, + ), + 63: ( + "wagtail.blocks.StructBlock", + [ + [ + ("topic", 21), + ("metric", 57), + ("geography", 23), + ("geography_type", 24), + ("sex", 25), + ("age", 26), + ("stratum", 27), + ("body", 58), + ] + ], + { + "help_text": '\nThis component will display a percentage number type metric.\nThis will display the value of the metric appended with a % character.\nYou can also optionally add a body of text to accompany this percentage number.\nE.g. "Virus tests positivity".\n' + }, + ), + 64: ( + "wagtail.blocks.StreamBlock", + [ + [ + ("headline_number", 59), + ("trend_number", 62), + ("percentage_number", 63), + ] + ], + { + "help_text": "\nAdd up to 2 headline or trend number column components within this space.\nNote that these figures will be displayed within the card, and above the chart itself.\n", + "max_num": 2, + "min_num": 0, + "required": False, + }, + ), + 65: ( + "wagtail.blocks.StructBlock", + [ + [ + ("title", 4), + ("body", 5), + ("about", 55), + ("related_links", 10), + ("tag_manager_event_id", 11), + ("x_axis", 12), + ("x_axis_title", 13), + ("y_axis", 14), + ("y_axis_title", 15), + ("y_axis_minimum_value", 16), + ("y_axis_maximum_value", 17), + ("show_tooltips", 18), + ("date_prefix", 56), + ("show_timeseries_filter", 20), + ("chart", 37), + ("headline_number_columns", 64), + ] + ], + {}, + ), + 66: ( + "wagtail.blocks.CharBlock", + (), + { + "help_text": "\nThe sub title to display for this component.\n", + "required": False, + }, + ), + 67: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "choices": cms.metrics_interface.field_choices_callables.get_possible_axis_choices, + "help_text": "\nA required choice of what to display along the x-axis of the chart.\n", + "ready_only": True, + }, + ), + 68: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "choices": cms.metrics_interface.field_choices_callables.get_possible_axis_choices, + "help_text": "\nA required choice of what to display along the y-axis of the chart.\n", + }, + ), + 69: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "choices": cms.metrics_interface.field_choices_callables.get_simplified_chart_types + }, + ), + 70: ( + "wagtail.blocks.BooleanBlock", + (), + { + "default": False, + "help_text": "\nIf set to true, draws the plot as a spline line, resulting in smooth curves between data points.\nIf set to false, draws the plot as a linear line, \nresulting in linear point-to-point lines being drawn between data points.\nThis is only applicable to line-type charts.\n", + "required": False, + }, + ), + 71: ( + "wagtail.blocks.StructBlock", + [ + [ + ("topic", 21), + ("metric", 22), + ("geography", 23), + ("geography_type", 24), + ("sex", 25), + ("age", 26), + ("stratum", 27), + ("chart_type", 69), + ("date_from", 29), + ("date_to", 30), + ("use_smooth_lines", 70), + ] + ], + {}, + ), + 72: ( + "wagtail.blocks.StreamBlock", + [[("plot", 71)]], + { + "help_text": "\nAdd the plots required for your chart. \nWithin each plot, you will be required to add a set of fields which will be used to fetch the supporting data \nfor that plot.\n", + "max_num": 1, + "required": True, + }, + ), + 73: ( + "wagtail.blocks.StructBlock", + [ + [ + ("title", 4), + ("sub_title", 66), + ("tag_manager_event_id", 11), + ("topic_page", 39), + ("x_axis", 67), + ("x_axis_title", 13), + ("y_axis", 68), + ("y_axis_title", 15), + ("y_axis_minimum_value", 16), + ("y_axis_maximum_value", 17), + ("chart", 72), + ] + ], + {}, + ), + 74: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "choices": cms.metrics_interface.field_choices_callables.get_possible_axis_choices, + "help_text": "\nAn optional choice of what to display along the x-axis of the chart.\nIf nothing is provided, `dates` will be used by default.\nDates are used by default\n", + }, + ), + 75: ( + "wagtail.blocks.MultipleChoiceBlock", + [], + { + "choices": cms.metrics_interface.field_choices_callables.get_all_subcategory_choices, + "help_text": "\nSelect a list of primary field values for the chart, these will be you're x-axis.\nFor example if we're creating a stacked bar chart that has a metric value in y and geographies along\nthe x-axis. The `primary field values` should be the list of geographies to include in the chart.\n", + "required": False, + }, + ), + 76: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "choices": cms.metrics_interface.field_choices_callables.get_possible_axis_choices, + "help_text": "\nAn optional choice of what to display along the y-axis of the chart.\nIf nothing is provided, `metric value` will be used by default.\n", + }, + ), + 77: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "choices": cms.metrics_interface.field_choices_callables.get_dual_category_chart_types, + "help_text": "\nThe name of the type of chart which you want to create e.g. bar\n", + "required": False, + }, + ), + 78: ( + "wagtail.blocks.StructBlock", + [ + [ + ("topic", 21), + ("metric", 57), + ("geography", 23), + ("geography_type", 24), + ("sex", 25), + ("age", 26), + ("stratum", 27), + ("date_from", 29), + ("date_to", 30), + ] + ], + {}, + ), + 79: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "choices": cms.metrics_interface.field_choices_callables.get_dual_chart_secondary_category_choices, + "help_text": "\nThis is for selecting the Second categorical variable type for Dual category charts.\nFor example when building a `Stacked bar chart` where the x-axis may be of type `Sex` and\ndisplay `Male` and `Female` along the x-axis. If our stacked bar chart then breaks each bar up into\nage groups, then our `Secondary Category` type is `Age`.\n", + }, + ), + 80: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "choices": cms.metrics_interface.field_choices_callables.get_all_subcategory_choices, + "help_text": "\nSelect the secondary field for a `Segments` this is the second categorical variable used to create segments\nof a `stacked bar` chart. For example if we're creating a stacked bar chart that has a metric in the y-axis\nand geographies along the x-axis. If each bar is broken into segments by `age group` this field\nshould be the age group for this segment.\n", + }, + ), + 81: ( + "wagtail.blocks.StructBlock", + [ + [ + ("secondary_field_value", 80), + ("colour", 32), + ("label", 31), + ] + ], + {}, + ), + 82: ( + "wagtail.blocks.StreamBlock", + [[("segment", 81)]], + {"min_num": 1}, + ), + 83: ( + "wagtail.blocks.StructBlock", + [ + [ + ("title", 4), + ("body", 5), + ("about", 6), + ("related_links", 10), + ("tag_manager_event_id", 11), + ("x_axis", 74), + ("x_axis_title", 13), + ("primary_field_values", 75), + ("y_axis", 76), + ("y_axis_title", 15), + ("y_axis_minimum_value", 16), + ("y_axis_maximum_value", 17), + ("chart_type", 77), + ("static_fields", 78), + ("second_category", 79), + ("segments", 82), + ] + ], + {}, + ), + 84: ( + "wagtail.blocks.StreamBlock", + [ + [ + ("chart_card", 38), + ("chart_with_description_card", 45), + ("headline_chart_card", 54), + ("chart_with_headline_and_trend_card", 65), + ("simplified_chart_with_link", 73), + ("dual_category_chart_card", 83), + ] + ], + { + "help_text": "\nHere you can add chart cards to a section and the layout will change based on the number of cards added.\nA single card will expand to take up half the row. When 2 or 3 cards are added they will share the width\nof a row equally, creating either a 2 or 3 column layout.\n", + "min_num": 1, + }, + ), + 85: ("wagtail.blocks.StructBlock", [[("cards", 84)]], {}), + 86: ( + "wagtail.blocks.TextBlock", + (), + { + "default": "Up to", + "help_text": "\nThis is the accompanying text for headline column dates Eg: `Up to` 27 Oct 2024 \n", + "required": True, + }, + ), + 87: ( + "wagtail.blocks.StreamBlock", + [ + [ + ("headline_number", 59), + ("trend_number", 62), + ("percentage_number", 63), + ] + ], + { + "help_text": "\nHere you can add up to 2 rows within this column component.\nEach row can be used to add a number block. \nThis can be a headline number, a trend number or a percentage number.\nIf you only add 1 row, then that block will be rendered on the upper half of the column.\nAnd the bottom row of the column will remain empty.\n", + "max_num": 2, + "min_num": 1, + "required": True, + }, + ), + 88: ( + "wagtail.blocks.StructBlock", + [[("title", 4), ("date_prefix", 86), ("rows", 87)]], + {}, + ), + 89: ( + "wagtail.blocks.StreamBlock", + [[("column", 88)]], + { + "help_text": "\nAdd up to 5 number column components within this row. \nThe columns are ordered from left to right, top to bottom respectively. \nSo by moving 1 column component above the other, that component will be rendered in the column left of the other. \n", + "max_num": 5, + "min_num": 1, + }, + ), + 90: ("wagtail.blocks.StructBlock", [[("columns", 89)]], {}), + 91: ( + "wagtail.blocks.TextBlock", + (), + { + "help_text": "\nThe sub title to display for this component.\n", + "required": True, + }, + ), + 92: ( + "wagtail.blocks.TextBlock", + (), + { + "help_text": "\nOptional description for the weather health alerts card.\n", + "required": False, + }, + ), + 93: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "choices": cms.dynamic_content.cards.WHAlerts.get_alerts, + "help_text": "\nThis is used to select the current weather health alert type Eg: Heat or Cold alert season.\n", + }, + ), + 94: ( + "wagtail.blocks.StructBlock", + [ + [ + ("link_display_text", 41), + ("page", 42), + ("external_url", 43), + ] + ], + {"help_text": "\nOptional source link.\n", "required": False}, + ), + 95: ( + "wagtail.blocks.StructBlock", + [ + [ + ("title", 4), + ("sub_title", 91), + ("description", 92), + ("alert_type", 93), + ("source", 94), + ] + ], + {}, + ), + 96: ( + "wagtail.blocks.StreamBlock", + [ + [ + ("text_card", 3), + ("chart_card_section", 85), + ("headline_numbers_row_card", 90), + ("weather_health_alert_card", 95), + ] + ], + { + "help_text": "\nHere you can add any number of content row cards for this section.\nNote that these cards will be displayed across the available width.\n" + }, + ), + 97: ( + "wagtail.blocks.CharBlock", + (), + { + "help_text": '\nThis is the label used for the a section footer link badge"\n', + "required": True, + }, + ), + 98: ( + "wagtail.blocks.CharBlock", + (), + { + "help_text": "\nThis is the text to displayed along side a link in a the sections footer link.\n", + "required": True, + }, + ), + 99: ( + "wagtail.blocks.StructBlock", + [ + [ + ("link_display_text", 41), + ("page", 42), + ("external_url", 43), + ] + ], + { + "help_text": "\nThis is a link component that allows the user to setup an internal or external link along with a short description of the link's content.\n", + "required": True, + }, + ), + 100: ( + "wagtail.blocks.StructBlock", + [[("badge_label", 97), ("text", 98), ("link", 99)]], + {"max_num": 1}, + ), + 101: ( + "wagtail.blocks.StreamBlock", + [[("section_link", 100)]], + { + "help_text": "\nThis is an optional footer for a section to provide a link to further information.\n", + "required": False, + }, + ), + 102: ( + "wagtail.blocks.StructBlock", + [ + [ + ("heading", 0), + ("page_link", 1), + ("content", 96), + ("footer", 101), + ] + ], + {}, + ), + }, + ), + ), + ] diff --git a/cms/topics_list/migrations/0005_alter_topicslistpage_body.py b/cms/topics_list/migrations/0005_alter_topicslistpage_body.py new file mode 100644 index 000000000..efc391327 --- /dev/null +++ b/cms/topics_list/migrations/0005_alter_topicslistpage_body.py @@ -0,0 +1,1067 @@ +# Generated by Django 5.2.12 on 2026-04-01 14:47 + +import cms.dynamic_content.cards +import cms.metrics_interface.field_choices_callables +import validation.url +import wagtail.fields +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ("topics_list", "0004_alter_topicslistpage_body_date_prefix"), + ] + + operations = [ + migrations.AlterField( + model_name="topicslistpage", + name="body", + field=wagtail.fields.StreamField( + [("section", 102)], + block_lookup={ + 0: ( + "wagtail.blocks.TextBlock", + (), + { + "help_text": "\nThe text you add here will be used as the heading for this section. \n", + "required": True, + }, + ), + 1: ( + "cms.dynamic_content.blocks.PageLinkChooserBlock", + (), + { + "help_text": "\nThe related index page you want to link to. Eg: `Respiratory viruses` or `Outbreaks`\n", + "page_type": ["composite.CompositePage"], + "required": False, + }, + ), + 2: ( + "wagtail.blocks.RichTextBlock", + (), + { + "features": ["h2", "h3", "h4", "bold", "ul", "link"], + "help_text": "\nThis section of text will comprise this card. \nNote that this card will span the length of the available page width if sufficient text content is provided.\n", + }, + ), + 3: ("wagtail.blocks.StructBlock", [[("body", 2)]], {}), + 4: ( + "wagtail.blocks.TextBlock", + (), + { + "help_text": "\nThe title to display for this component. \nNote that this will be shown in the hex colour #505A5F\n", + "required": True, + }, + ), + 5: ( + "wagtail.blocks.TextBlock", + (), + { + "help_text": "\nAn optional body of text to accompany this block. This text will be displayed below the chart title.\n", + "label": "Subtitle", + "required": False, + }, + ), + 6: ( + "wagtail.blocks.TextBlock", + (), + { + "default": "", + "help_text": "\nAn optional body of text to accompany this block. This text will be displayed in the about content of the chart.\n", + "required": False, + }, + ), + 7: ( + "wagtail.blocks.CharBlock", + (), + { + "help_text": "\nThe Text that will be displayed for the URL.\n", + "required": True, + }, + ), + 8: ( + "wagtail.blocks.CharBlock", + (), + { + "help_text": "\nThe URL that the user will be navigated to when clicked.\nAn optional body of text to accompany this block. This text will be displayed below the chart title.\n", + "required": True, + }, + ), + 9: ( + "wagtail.blocks.StructBlock", + [[("link_display_text", 7), ("link", 8)]], + {}, + ), + 10: ( + "wagtail.blocks.StreamBlock", + [[("related_link", 9)]], + { + "help_text": "\nProvide optional URLs that can provide further contextual information for the data displayed in the chart.\n", + "required": False, + }, + ), + 11: ( + "wagtail.blocks.CharBlock", + (), + { + "help_text": "\nThe ID to associate with this component. \nThis allows for tracking of events when users interact with this component.\nNote that changing this multiple times will result in the recording of different groups of events.\n", + "label": "Tag manager event ID", + "required": False, + }, + ), + 12: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "choices": cms.metrics_interface.field_choices_callables.get_possible_axis_choices, + "help_text": "\nAn optional choice of what to display along the x-axis of the chart.\nIf nothing is provided, `dates` will be used by default.\nDates are used by default\n", + "required": False, + }, + ), + 13: ( + "wagtail.blocks.CharBlock", + (), + { + "default": "", + "help_text": "\nAn optional title to display along the x-axis of the chart.\nIf nothing is provided, then no title will be displayed.\n", + "required": False, + }, + ), + 14: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "choices": cms.metrics_interface.field_choices_callables.get_possible_axis_choices, + "help_text": "\nAn optional choice of what to display along the y-axis of the chart.\nIf nothing is provided, `metric value` will be used by default.\n", + "required": False, + }, + ), + 15: ( + "wagtail.blocks.CharBlock", + (), + { + "default": "", + "help_text": "\nAn optional title to display along the y-axis of the chart.\nIf nothing is provided, then no title will be displayed.\n", + "required": False, + }, + ), + 16: ( + "wagtail.blocks.DecimalBlock", + (), + { + "default": 0, + "help_text": "\nThis field allows you to set the first value in the chart's y-axis range. Please\nnote that a value provided here, which is higher than the lowest value in the data will\nbe overridden and the value from the dataset will be used.\n", + "required": False, + }, + ), + 17: ( + "wagtail.blocks.DecimalBlock", + (), + { + "help_text": "\nThis field allows you to set the last value in the chart's y-axis range. Please\nnote that a value provided here, which is lower than the highest value in the data will\nbe overridden and the value from the dataset will be used. \n", + "required": False, + }, + ), + 18: ( + "wagtail.blocks.BooleanBlock", + (), + { + "default": False, + "help_text": "\nThis is a switch to show tooltips on hover within the chart.\nDefaults to False.\n", + "required": False, + }, + ), + 19: ( + "wagtail.blocks.CharBlock", + (), + { + "default": "Up to and including", + "help_texts": "\nThis is the accompanying text for chart dates Eg: `Up to and including` 21 Oct 2024\n", + "requried": True, + }, + ), + 20: ( + "wagtail.blocks.BooleanBlock", + (), + { + "default": False, + "help_text": "\nThis option enables timeseries filter for this chart.\nThe timeseries filter allows a user to change the timeseries range for example between\n1m, 3m, 6m, 1y etc.\n", + "required": False, + }, + ), + 21: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "choices": cms.metrics_interface.field_choices_callables.get_all_topic_names, + "help_text": "The name of the topic to pull data e.g. COVID-19.", + }, + ), + 22: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "choices": cms.metrics_interface.field_choices_callables.get_all_timeseries_metric_names, + "help_text": '\nThe name of the metric to pull data for e.g. "COVID-19_deaths_ONSByDay".\n', + }, + ), + 23: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "choices": cms.metrics_interface.field_choices_callables.get_all_geography_names, + "help_text": "\nThe name of the geography associated with this particular piece of data.\nIf nothing is provided, then no filtering will be applied for this field.\n", + }, + ), + 24: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "choices": cms.metrics_interface.field_choices_callables.get_all_geography_type_names, + "help_text": "\nThe type of geographical categorisation to apply any data filtering to.\nIf nothing is provided, then no filtering will be applied for this field.\n", + }, + ), + 25: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "choices": cms.metrics_interface.field_choices_callables.get_all_sex_names, + "help_text": "\nThe gender to filter for, if any.\nThe only options available are `M`, `F` and `ALL`.\nBy default, no filtering will be applied to the underlying query if no selection is made.\n", + }, + ), + 26: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "choices": cms.metrics_interface.field_choices_callables.get_all_age_names, + "help_text": "\nThe age band to filter for, if any.\nBy default, no filtering will be applied to the underlying query if no selection is made.\n", + }, + ), + 27: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "choices": cms.metrics_interface.field_choices_callables.get_all_stratum_names, + "help_text": "\nThe smallest subgroup a piece of data can be broken down into.\nFor example, this could be broken down by ethnicity or testing pillar.\nIf nothing is provided, then no filtering will be applied for this field.\n", + }, + ), + 28: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "choices": cms.metrics_interface.field_choices_callables.get_chart_types, + "help_text": "\nThe name of the type of chart which you want to create e.g. bar\n", + }, + ), + 29: ( + "wagtail.blocks.DateBlock", + (), + { + "help_text": "\nThe date from which to begin the supporting plot data. \nNote that if nothing is provided, a default of 1 year ago from the current date will be applied.\n", + "required": False, + }, + ), + 30: ( + "wagtail.blocks.DateBlock", + (), + { + "help_text": "\nThe date to which to end the supporting plot data. \nNote that if nothing is provided, a default of the current date will be applied.\n", + "required": False, + }, + ), + 31: ( + "wagtail.blocks.TextBlock", + (), + { + "help_text": "\nThe label to assign on the legend for this individual plot.\nE.g. `15 to 44 years old`\n", + "required": False, + }, + ), + 32: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "choices": cms.metrics_interface.field_choices_callables.get_colours, + "help_text": '\nThe colour to apply to this individual line plot. The colours conform to the GDS specification.\nCurrently, only the `line_multi_coloured` chart type supports different line colours.\nFor all other chart types, this field will be ignored.\nNote that if nothing is provided, a default of "BLACK" will be applied.\nE.g. `GREEN`\n', + }, + ), + 33: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "choices": cms.metrics_interface.field_choices_callables.get_chart_line_types, + "help_text": '\nThe line type to apply to this individual line plot.\nCurrently, only the `line_multi_coloured` chart type supports different line types.\nFor all other chart types, this field will be ignored.\nNote that if nothing is provided, a default of "SOLID" will be applied.\nE.g. `DASH`\n', + "required": False, + }, + ), + 34: ( + "wagtail.blocks.BooleanBlock", + (), + { + "default": False, + "help_text": "\nIf set to true, markers are drawn on each individual data point.\nIf set to false, markers are not drawn at all.\nThis is only applicable to line-type charts.\n", + "required": False, + }, + ), + 35: ( + "wagtail.blocks.BooleanBlock", + (), + { + "default": True, + "help_text": "\nIf set to true, draws the plot as a spline line, resulting in smooth curves between data points.\nIf set to false, draws the plot as a linear line, \nresulting in linear point-to-point lines being drawn between data points.\nThis is only applicable to line-type charts.\n", + "required": False, + }, + ), + 36: ( + "wagtail.blocks.StructBlock", + [ + [ + ("topic", 21), + ("metric", 22), + ("geography", 23), + ("geography_type", 24), + ("sex", 25), + ("age", 26), + ("stratum", 27), + ("chart_type", 28), + ("date_from", 29), + ("date_to", 30), + ("label", 31), + ("line_colour", 32), + ("line_type", 33), + ("use_markers", 34), + ("use_smooth_lines", 35), + ] + ], + {}, + ), + 37: ( + "wagtail.blocks.StreamBlock", + [[("plot", 36)]], + { + "help_text": "\nAdd the plots required for your chart. \nWithin each plot, you will be required to add a set of fields which will be used to fetch the supporting data \nfor that plot.\n" + }, + ), + 38: ( + "wagtail.blocks.StructBlock", + [ + [ + ("title", 4), + ("body", 5), + ("about", 6), + ("related_links", 10), + ("tag_manager_event_id", 11), + ("x_axis", 12), + ("x_axis_title", 13), + ("y_axis", 14), + ("y_axis_title", 15), + ("y_axis_minimum_value", 16), + ("y_axis_maximum_value", 17), + ("show_tooltips", 18), + ("date_prefix", 19), + ("show_timeseries_filter", 20), + ("chart", 37), + ] + ], + {}, + ), + 39: ( + "cms.dynamic_content.blocks.PageLinkChooserBlock", + (), + { + "help_text": "\nThe related topic page you want to link to. Eg: `COVID-19`\n", + "page_type": ["topic.TopicPage"], + "required": True, + }, + ), + 40: ( + "wagtail.blocks.TextBlock", + (), + { + "help_text": "\nRequired description for the chart.\n", + "required": True, + }, + ), + 41: ( + "wagtail.blocks.CharBlock", + (), + { + "help_text": "\nDisplay text for the link.\n", + "required": False, + }, + ), + 42: ( + "cms.dynamic_content.blocks.PageLinkChooserBlock", + (), + { + "help_text": "\nFor linking to internal pages. (If chosen, external_url must be blank).\n", + "page_type": ["topic.TopicPage"], + "required": False, + }, + ), + 43: ( + "wagtail.blocks.URLBlock", + (), + { + "help_text": "\nFor linking to external url. (Only one of page or external_url must be filled not both).\n", + "required": False, + "validators": [validation.url.validate_https_scheme], + }, + ), + 44: ( + "wagtail.blocks.StructBlock", + [ + [ + ("link_display_text", 41), + ("page", 42), + ("external_url", 43), + ] + ], + { + "help_text": "\nSource link (internal or external).\n", + "required": False, + }, + ), + 45: ( + "wagtail.blocks.StructBlock", + [ + [ + ("title", 4), + ("sub_title", 5), + ("topic_page", 39), + ("description", 40), + ("source", 44), + ("tag_manager_event_id", 11), + ("x_axis", 12), + ("x_axis_title", 13), + ("y_axis", 14), + ("y_axis_title", 15), + ("y_axis_minimum_value", 16), + ("y_axis_maximum_value", 17), + ("show_tooltips", 18), + ("chart", 37), + ] + ], + {}, + ), + 46: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "choices": cms.metrics_interface.field_choices_callables.get_possible_axis_choices, + "help_text": "\nA required choice of what to display along the x-axis of the chart.\n", + }, + ), + 47: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "choices": cms.metrics_interface.field_choices_callables.get_all_headline_metric_names, + "help_text": '\nThe name of the metric to pull data for e.g. "COVID-19_deaths_ONSByDay".\n', + }, + ), + 48: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "choices": cms.metrics_interface.field_choices_callables.get_headline_chart_types, + "help_text": "\nThe name of the type of chart which you want to create e.g. bar\n", + }, + ), + 49: ( + "wagtail.blocks.StructBlock", + [ + [ + ("topic", 21), + ("metric", 47), + ("geography", 23), + ("geography_type", 24), + ("sex", 25), + ("age", 26), + ("stratum", 27), + ("chart_type", 48), + ("line_colour", 32), + ("label", 31), + ] + ], + {}, + ), + 50: ( + "wagtail.blocks.StreamBlock", + [[("plot", 49)]], + { + "help_texts": "\nAdd the plots required for your chart. \nWithin each plot, you will be required to add a set of fields which will be used to fetch the supporting data \nfor that plot.\n" + }, + ), + 51: ( + "wagtail.blocks.BooleanBlock", + (), + { + "default": False, + "help_text": "\nToggle to enable confidence intervals if they are present in the data set\n", + "required": False, + }, + ), + 52: ( + "wagtail.blocks.TextBlock", + (), + { + "default": "Metric column includes 95% lower and upper confidence intervals, in brackets.", + "help_text": "\nAn optional body of text to accompany this block.\nThis text will be displayed above the metrics table if confidence intervals is enabled.\n", + "required": False, + }, + ), + 53: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "choices": cms.metrics_interface.field_choices_callables.get_colours, + "help_text": '\nThe colour to display the confidence interval in. The colours conform to the GDS specification.\nNote that if nothing is provided, a default of "BLACK" will be applied.\n', + "required": False, + }, + ), + 54: ( + "wagtail.blocks.StructBlock", + [ + [ + ("title", 4), + ("body", 5), + ("about", 6), + ("related_links", 10), + ("tag_manager_event_id", 11), + ("x_axis", 46), + ("x_axis_title", 13), + ("y_axis", 14), + ("y_axis_title", 15), + ("y_axis_minimum_value", 16), + ("y_axis_maximum_value", 17), + ("show_tooltips", 18), + ("date_prefix", 19), + ("show_timeseries_filter", 20), + ("chart", 50), + ("confidence_intervals", 51), + ("confidence_intervals_description", 52), + ("confidence_colour", 53), + ] + ], + {}, + ), + 55: ( + "wagtail.blocks.TextBlock", + (), + { + "help_text": "\nAn optional body of text to accompany this block. This text will be displayed in the about content of the chart.\n", + "required": False, + }, + ), + 56: ( + "wagtail.blocks.CharBlock", + (), + { + "default": "Up to and including", + "help_text": "\nThis is the accompanying text for chart dates Eg: `Up to and including` 21 Oct 2024\n", + "required": True, + }, + ), + 57: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "choices": cms.metrics_interface.field_choices_callables.get_all_unique_metric_names, + "help_text": '\nThe name of the metric to pull data for e.g. "COVID-19_deaths_ONSByDay".\n', + }, + ), + 58: ( + "wagtail.blocks.TextBlock", + (), + { + "help_text": "\nAn optional body of text to accompany this block. This text will be displayed below the chart title.\n", + "required": False, + }, + ), + 59: ( + "wagtail.blocks.StructBlock", + [ + [ + ("topic", 21), + ("metric", 57), + ("geography", 23), + ("geography_type", 24), + ("sex", 25), + ("age", 26), + ("stratum", 27), + ("body", 58), + ] + ], + { + "help_text": '\nThis component will display a key headline number type metric.\nYou can also optionally add a body of text to accompany that headline number.\nE.g. "Patients admitted"\n' + }, + ), + 60: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "choices": cms.metrics_interface.field_choices_callables.get_all_unique_change_type_metric_names, + "help_text": "\nThe name of the trend type metric to pull data e.g. \"COVID-19_headline_ONSdeaths_7daychange\". \nNote that only 'change' type metrics are available for selection for this field type.\n", + }, + ), + 61: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "choices": cms.metrics_interface.field_choices_callables.get_all_unique_percent_change_type_names, + "help_text": "\nThe name of the accompanying percentage trend type metric to pull data \ne.g. \"COVID-19_headline_ONSdeaths_7daypercentchange\". \nNote that only 'percent' type metrics are available for selection for this field type.\n", + }, + ), + 62: ( + "wagtail.blocks.StructBlock", + [ + [ + ("topic", 21), + ("metric", 60), + ("geography", 23), + ("geography_type", 24), + ("sex", 25), + ("age", 26), + ("stratum", 27), + ("body", 58), + ("percentage_metric", 61), + ] + ], + { + "help_text": '\nThis component will display a trend number type metric.\nThis will display an arrow pointing in the direction of the metric change \nas well as colouring of the block to indicate the context of the change.\nYou can also optionally add a body of text to accompany that headline number.\nE.g. "Last 7 days"\n' + }, + ), + 63: ( + "wagtail.blocks.StructBlock", + [ + [ + ("topic", 21), + ("metric", 57), + ("geography", 23), + ("geography_type", 24), + ("sex", 25), + ("age", 26), + ("stratum", 27), + ("body", 58), + ] + ], + { + "help_text": '\nThis component will display a percentage number type metric.\nThis will display the value of the metric appended with a % character.\nYou can also optionally add a body of text to accompany this percentage number.\nE.g. "Virus tests positivity".\n' + }, + ), + 64: ( + "wagtail.blocks.StreamBlock", + [ + [ + ("headline_number", 59), + ("trend_number", 62), + ("percentage_number", 63), + ] + ], + { + "help_text": "\nAdd up to 2 headline or trend number column components within this space.\nNote that these figures will be displayed within the card, and above the chart itself.\n", + "max_num": 2, + "min_num": 0, + "required": False, + }, + ), + 65: ( + "wagtail.blocks.StructBlock", + [ + [ + ("title", 4), + ("body", 5), + ("about", 55), + ("related_links", 10), + ("tag_manager_event_id", 11), + ("x_axis", 12), + ("x_axis_title", 13), + ("y_axis", 14), + ("y_axis_title", 15), + ("y_axis_minimum_value", 16), + ("y_axis_maximum_value", 17), + ("show_tooltips", 18), + ("date_prefix", 56), + ("show_timeseries_filter", 20), + ("chart", 37), + ("headline_number_columns", 64), + ] + ], + {}, + ), + 66: ( + "wagtail.blocks.CharBlock", + (), + { + "help_text": "\nThe sub title to display for this component.\n", + "required": False, + }, + ), + 67: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "choices": cms.metrics_interface.field_choices_callables.get_possible_axis_choices, + "help_text": "\nA required choice of what to display along the x-axis of the chart.\n", + "ready_only": True, + }, + ), + 68: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "choices": cms.metrics_interface.field_choices_callables.get_possible_axis_choices, + "help_text": "\nA required choice of what to display along the y-axis of the chart.\n", + }, + ), + 69: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "choices": cms.metrics_interface.field_choices_callables.get_simplified_chart_types + }, + ), + 70: ( + "wagtail.blocks.BooleanBlock", + (), + { + "default": False, + "help_text": "\nIf set to true, draws the plot as a spline line, resulting in smooth curves between data points.\nIf set to false, draws the plot as a linear line, \nresulting in linear point-to-point lines being drawn between data points.\nThis is only applicable to line-type charts.\n", + "required": False, + }, + ), + 71: ( + "wagtail.blocks.StructBlock", + [ + [ + ("topic", 21), + ("metric", 22), + ("geography", 23), + ("geography_type", 24), + ("sex", 25), + ("age", 26), + ("stratum", 27), + ("chart_type", 69), + ("date_from", 29), + ("date_to", 30), + ("use_smooth_lines", 70), + ] + ], + {}, + ), + 72: ( + "wagtail.blocks.StreamBlock", + [[("plot", 71)]], + { + "help_text": "\nAdd the plots required for your chart. \nWithin each plot, you will be required to add a set of fields which will be used to fetch the supporting data \nfor that plot.\n", + "max_num": 1, + "required": True, + }, + ), + 73: ( + "wagtail.blocks.StructBlock", + [ + [ + ("title", 4), + ("sub_title", 66), + ("tag_manager_event_id", 11), + ("topic_page", 39), + ("x_axis", 67), + ("x_axis_title", 13), + ("y_axis", 68), + ("y_axis_title", 15), + ("y_axis_minimum_value", 16), + ("y_axis_maximum_value", 17), + ("chart", 72), + ] + ], + {}, + ), + 74: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "choices": cms.metrics_interface.field_choices_callables.get_possible_axis_choices, + "help_text": "\nAn optional choice of what to display along the x-axis of the chart.\nIf nothing is provided, `dates` will be used by default.\nDates are used by default\n", + }, + ), + 75: ( + "wagtail.blocks.MultipleChoiceBlock", + [], + { + "choices": cms.metrics_interface.field_choices_callables.get_all_subcategory_choices, + "help_text": "\nSelect a list of primary field values for the chart, these will be you're x-axis.\nFor example if we're creating a stacked bar chart that has a metric value in y and geographies along\nthe x-axis. The `primary field values` should be the list of geographies to include in the chart.\n", + "required": False, + }, + ), + 76: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "choices": cms.metrics_interface.field_choices_callables.get_possible_axis_choices, + "help_text": "\nAn optional choice of what to display along the y-axis of the chart.\nIf nothing is provided, `metric value` will be used by default.\n", + }, + ), + 77: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "choices": cms.metrics_interface.field_choices_callables.get_dual_category_chart_types, + "help_text": "\nThe name of the type of chart which you want to create e.g. bar\n", + "required": False, + }, + ), + 78: ( + "wagtail.blocks.StructBlock", + [ + [ + ("topic", 21), + ("metric", 57), + ("geography", 23), + ("geography_type", 24), + ("sex", 25), + ("age", 26), + ("stratum", 27), + ("date_from", 29), + ("date_to", 30), + ] + ], + {}, + ), + 79: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "choices": cms.metrics_interface.field_choices_callables.get_dual_chart_secondary_category_choices, + "help_text": "\nThis is for selecting the Second categorical variable type for Dual category charts.\nFor example when building a `Stacked bar chart` where the x-axis may be of type `Sex` and\ndisplay `Male` and `Female` along the x-axis. If our stacked bar chart then breaks each bar up into\nage groups, then our `Secondary Category` type is `Age`.\n", + }, + ), + 80: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "choices": cms.metrics_interface.field_choices_callables.get_all_subcategory_choices, + "help_text": "\nSelect the secondary field for a `Segments` this is the second categorical variable used to create segments\nof a `stacked bar` chart. For example if we're creating a stacked bar chart that has a metric in the y-axis\nand geographies along the x-axis. If each bar is broken into segments by `age group` this field\nshould be the age group for this segment.\n", + }, + ), + 81: ( + "wagtail.blocks.StructBlock", + [ + [ + ("secondary_field_value", 80), + ("colour", 32), + ("label", 31), + ] + ], + {}, + ), + 82: ( + "wagtail.blocks.StreamBlock", + [[("segment", 81)]], + {"min_num": 1}, + ), + 83: ( + "wagtail.blocks.StructBlock", + [ + [ + ("title", 4), + ("body", 5), + ("about", 6), + ("related_links", 10), + ("tag_manager_event_id", 11), + ("x_axis", 74), + ("x_axis_title", 13), + ("primary_field_values", 75), + ("y_axis", 76), + ("y_axis_title", 15), + ("y_axis_minimum_value", 16), + ("y_axis_maximum_value", 17), + ("chart_type", 77), + ("static_fields", 78), + ("second_category", 79), + ("segments", 82), + ] + ], + {}, + ), + 84: ( + "wagtail.blocks.StreamBlock", + [ + [ + ("chart_card", 38), + ("chart_with_description_card", 45), + ("headline_chart_card", 54), + ("chart_with_headline_and_trend_card", 65), + ("simplified_chart_with_link", 73), + ("dual_category_chart_card", 83), + ] + ], + { + "help_text": "\nHere you can add chart cards to a section and the layout will change based on the number of cards added.\nA single card will expand to take up half the row. When 2 or 3 cards are added they will share the width\nof a row equally, creating either a 2 or 3 column layout.\n", + "min_num": 1, + }, + ), + 85: ("wagtail.blocks.StructBlock", [[("cards", 84)]], {}), + 86: ( + "wagtail.blocks.TextBlock", + (), + { + "default": "Up to", + "help_text": "\nThis is the accompanying text for headline column dates Eg: `Up to` 27 Oct 2024 \n", + "required": True, + }, + ), + 87: ( + "wagtail.blocks.StreamBlock", + [ + [ + ("headline_number", 59), + ("trend_number", 62), + ("percentage_number", 63), + ] + ], + { + "help_text": "\nHere you can add up to 2 rows within this column component.\nEach row can be used to add a number block. \nThis can be a headline number, a trend number or a percentage number.\nIf you only add 1 row, then that block will be rendered on the upper half of the column.\nAnd the bottom row of the column will remain empty.\n", + "max_num": 2, + "min_num": 1, + "required": True, + }, + ), + 88: ( + "wagtail.blocks.StructBlock", + [[("title", 4), ("date_prefix", 86), ("rows", 87)]], + {}, + ), + 89: ( + "wagtail.blocks.StreamBlock", + [[("column", 88)]], + { + "help_text": "\nAdd up to 5 number column components within this row. \nThe columns are ordered from left to right, top to bottom respectively. \nSo by moving 1 column component above the other, that component will be rendered in the column left of the other. \n", + "max_num": 5, + "min_num": 1, + }, + ), + 90: ("wagtail.blocks.StructBlock", [[("columns", 89)]], {}), + 91: ( + "wagtail.blocks.TextBlock", + (), + { + "help_text": "\nThe sub title to display for this component.\n", + "required": True, + }, + ), + 92: ( + "wagtail.blocks.TextBlock", + (), + { + "help_text": "\nOptional description for the weather health alerts card.\n", + "required": False, + }, + ), + 93: ( + "wagtail.blocks.ChoiceBlock", + [], + { + "choices": cms.dynamic_content.cards.WHAlerts.get_alerts, + "help_text": "\nThis is used to select the current weather health alert type Eg: Heat or Cold alert season.\n", + }, + ), + 94: ( + "wagtail.blocks.StructBlock", + [ + [ + ("link_display_text", 41), + ("page", 42), + ("external_url", 43), + ] + ], + {"help_text": "\nOptional source link.\n", "required": False}, + ), + 95: ( + "wagtail.blocks.StructBlock", + [ + [ + ("title", 4), + ("sub_title", 91), + ("description", 92), + ("alert_type", 93), + ("source", 94), + ] + ], + {}, + ), + 96: ( + "wagtail.blocks.StreamBlock", + [ + [ + ("text_card", 3), + ("chart_card_section", 85), + ("headline_numbers_row_card", 90), + ("weather_health_alert_card", 95), + ] + ], + { + "help_text": "\nHere you can add any number of content row cards for this section.\nNote that these cards will be displayed across the available width.\n" + }, + ), + 97: ( + "wagtail.blocks.CharBlock", + (), + { + "help_text": '\nThis is the label used for the a section footer link badge"\n', + "required": True, + }, + ), + 98: ( + "wagtail.blocks.CharBlock", + (), + { + "help_text": "\nThis is the text to displayed along side a link in a the sections footer link.\n", + "required": True, + }, + ), + 99: ( + "wagtail.blocks.StructBlock", + [ + [ + ("link_display_text", 41), + ("page", 42), + ("external_url", 43), + ] + ], + { + "help_text": "\nThis is a link component that allows the user to setup an internal or external link along with a short description of the link's content.\n", + "required": True, + }, + ), + 100: ( + "wagtail.blocks.StructBlock", + [[("badge_label", 97), ("text", 98), ("link", 99)]], + {"max_num": 1}, + ), + 101: ( + "wagtail.blocks.StreamBlock", + [[("section_link", 100)]], + { + "help_text": "\nThis is an optional footer for a section to provide a link to further information.\n", + "required": False, + }, + ), + 102: ( + "wagtail.blocks.StructBlock", + [ + [ + ("heading", 0), + ("page_link", 1), + ("content", 96), + ("footer", 101), + ] + ], + {}, + ), + }, + ), + ), + ]