Skip to content

Commit 3f4c9e0

Browse files
CDD-3163: Implement section footer for landing & topic_list page
1 parent 27d5129 commit 3f4c9e0

File tree

5 files changed

+2203
-38
lines changed

5 files changed

+2203
-38
lines changed

cms/dynamic_content/blocks.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,3 +198,16 @@ def _validate_only_one_of_page_or_external_url(
198198
if page and external_url:
199199
error_message = "Use either page OR external_url, not both."
200200
raise ValidationError(error_message)
201+
202+
203+
class SectionFooterLink(blocks.StructBlock):
204+
badge_label = blocks.CharBlock(
205+
help_text=help_texts.SECTION_FOOTER_BADGE_LABEL, required=True
206+
)
207+
text = blocks.CharBlock(
208+
help_text=help_texts.SECTION_FOOTER_LINK_TEXT, required=True
209+
)
210+
link = SourceLinkBlock(help_text=help_texts.SECTION_FOOTER_LINK, required=True)
211+
212+
class Meta:
213+
icon = "link"

cms/dynamic_content/help_texts.py

Lines changed: 48 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
HEADLINE_COLUMNS_FIELD: str = """
2-
Add up to {} number column components within this row.
3-
The columns are ordered from left to right, top to bottom respectively.
4-
So by moving 1 column component above the other, that component will be rendered in the column left of the other.
2+
Add up to {} number column components within this row.
3+
The columns are ordered from left to right, top to bottom respectively.
4+
So by moving 1 column component above the other, that component will be rendered in the column left of the other.
55
"""
66

77
HEADLINE_COLUMNS_IN_CHART_CARD: str = """
@@ -22,15 +22,15 @@
2222

2323
NUMBERS_ROW_FIELD: str = """
2424
Here you can add up to {} rows within this column component.
25-
Each row can be used to add a number block.
25+
Each row can be used to add a number block.
2626
This can be a headline number, a trend number or a percentage number.
2727
If you only add 1 row, then that block will be rendered on the upper half of the column.
2828
And the bottom row of the column will remain empty.
2929
"""
3030

3131
CHART_BLOCK_FIELD: str = """
32-
Add the plots required for your chart.
33-
Within each plot, you will be required to add a set of fields which will be used to fetch the supporting data
32+
Add the plots required for your chart.
33+
Within each plot, you will be required to add a set of fields which will be used to fetch the supporting data
3434
for that plot.
3535
"""
3636

@@ -57,7 +57,7 @@
5757
"""
5858
TREND_BLOCK_FIELD: str = """
5959
This component will display a trend number type metric.
60-
This will display an arrow pointing in the direction of the metric change
60+
This will display an arrow pointing in the direction of the metric change
6161
as well as colouring of the block to indicate the context of the change.
6262
You can also optionally add a body of text to accompany that headline number.
6363
E.g. "Last 7 days"
@@ -90,15 +90,15 @@
9090
"""
9191

9292
TEXT_CARD: str = """
93-
This section of text will comprise this card.
93+
This section of text will comprise this card.
9494
Note that this card will span the length of the available page width if sufficient text content is provided.
9595
"""
9696
BODY_FIELD: str = "The section of text which will accommodate this block."
9797
BODY_FIELD_ABOVE_BLOCK: str = f"""
9898
{BODY_FIELD} Note that this text will be placed above the main content of the block.
9999
"""
100100
HEADING_BLOCK: str = """
101-
The text you add here will be used as the heading for this section.
101+
The text you add here will be used as the heading for this section.
102102
"""
103103

104104
CONTENT_ROW_CARDS: str = """
@@ -126,23 +126,23 @@
126126
"""
127127

128128
TREND_METRIC_FIELD: str = """
129-
The name of the trend type metric to pull data e.g. "COVID-19_headline_ONSdeaths_7daychange".
129+
The name of the trend type metric to pull data e.g. "COVID-19_headline_ONSdeaths_7daychange".
130130
Note that only 'change' type metrics are available for selection for this field type.
131131
"""
132132
TREND_PERCENTAGE_METRIC_FIELD: str = """
133-
The name of the accompanying percentage trend type metric to pull data
134-
e.g. "COVID-19_headline_ONSdeaths_7daypercentchange".
133+
The name of the accompanying percentage trend type metric to pull data
134+
e.g. "COVID-19_headline_ONSdeaths_7daypercentchange".
135135
Note that only 'percent' type metrics are available for selection for this field type.
136136
"""
137137
CHART_TYPE_FIELD: str = """
138138
The name of the type of chart which you want to create e.g. bar
139139
"""
140140
DATE_FROM_FIELD: str = """
141-
The date from which to begin the supporting plot data.
141+
The date from which to begin the supporting plot data.
142142
Note that if nothing is provided, a default of 1 year ago from the current date will be applied.
143143
"""
144144
DATE_TO_FIELD: str = """
145-
The date to which to end the supporting plot data.
145+
The date to which to end the supporting plot data.
146146
Note that if nothing is provided, a default of the current date will be applied.
147147
"""
148148
SEX_FIELD: str = """
@@ -179,7 +179,7 @@
179179
"""
180180

181181
TITLE_FIELD: str = """
182-
The title to display for this component.
182+
The title to display for this component.
183183
Note that this will be shown in the hex colour #505A5F
184184
"""
185185
SUB_TITLE_FIELD: str = """
@@ -216,7 +216,7 @@
216216
"""
217217

218218
PAGE_DESCRIPTION_FIELD: str = """
219-
An optional body of text which will be rendered at the top of the page.
219+
An optional body of text which will be rendered at the top of the page.
220220
This text will be displayed after the title of the page and before any of the main content.
221221
"""
222222

@@ -258,7 +258,7 @@
258258
CHART_Y_AXIS_MAXIMUM_VALUE: str = """
259259
This field allows you to set the last value in the chart's y-axis range. Please
260260
note that a value provided here, which is lower than the highest value in the data will
261-
be overridden and the value from the dataset will be used.
261+
be overridden and the value from the dataset will be used.
262262
"""
263263

264264
REQUIRED_CHART_Y_AXIS: str = """
@@ -267,7 +267,7 @@
267267

268268
USE_SMOOTH_LINES: str = """
269269
If set to true, draws the plot as a spline line, resulting in smooth curves between data points.
270-
If set to false, draws the plot as a linear line,
270+
If set to false, draws the plot as a linear line,
271271
resulting in linear point-to-point lines being drawn between data points.
272272
This is only applicable to line-type charts.
273273
"""
@@ -308,13 +308,13 @@
308308
"""
309309

310310
GLOBAL_BANNER_IS_ACTIVE: str = """
311-
Whether to activate this banner across every page in the dashboard.
311+
Whether to activate this banner across every page in the dashboard.
312312
Multiple banners can be active across the dashboard.
313313
Note: Warning banners are prioritised across the dashboard and will be displayed above information banners.
314314
"""
315315

316316
TAG_MANAGER_EVENT_ID_FIELD: str = """
317-
The ID to associate with this component.
317+
The ID to associate with this component.
318318
This allows for tracking of events when users interact with this component.
319319
Note that changing this multiple times will result in the recording of different groups of events.
320320
"""
@@ -344,7 +344,7 @@
344344
"""
345345

346346
HEADLINE_DATE_PREFIX: str = """
347-
This is the accompanying text for headline column dates Eg: `Up to` 27 Oct 2024
347+
This is the accompanying text for headline column dates Eg: `Up to` 27 Oct 2024
348348
"""
349349

350350
CHART_DATE_PREFIX: str = """
@@ -370,8 +370,8 @@
370370
"""
371371

372372
ANNOUNCEMENT_BANNER_IS_ACTIVE: str = """
373-
Whether to activate this banner only on this individual page.
374-
Note that multiple page banners can be active on one page. Consider
373+
Whether to activate this banner only on this individual page.
374+
Note that multiple page banners can be active on one page. Consider
375375
carefully if you need multiple announcements to be active at once as
376376
this can have an impact on user experience of the dashboard page.
377377
"""
@@ -398,21 +398,21 @@
398398

399399
GLOBAL_FILTER_COMPONENT: str = """
400400
The global filter component enables a user of the dashboard to create a variable number of filters
401-
which can be applied across multi components on a dashboard page. This CMS component can be used to configure
401+
which can be applied across multi components on a dashboard page. This CMS component can be used to configure
402402
those options.
403403
"""
404404

405405
GLOBAL_FILTER_TIME_RANGE: str = """
406406
This mandatory time range is used to set the time range that a user can navigate through when
407407
interacting with a filter linked chart or map card. Eg. Year selection can include a range of
408408
years as dates that can be displayed and navigated between.
409-
When entering multiple periods in the time filter each proceeding `date_from` must be 1 day after the `date_to`
409+
When entering multiple periods in the time filter each proceeding `date_from` must be 1 day after the `date_to`
410410
that came before it to maintain sequence order.
411411
"""
412412

413413
GLOBAL_FILTER_TIME_RANGE_DATE_FROM_FIELD: str = """
414414
This field is used to provide a start date for the current time range option. Its date
415-
must be earlier than the date provided for the corresponding `date_to`field.
415+
must be earlier than the date provided for the corresponding `date_to`field.
416416
"""
417417

418418
GLOBAL_FILTER_TIME_RANGE_DATE_TO_FIELD: str = """
@@ -500,25 +500,25 @@
500500

501501
FILTER_LINKED_SUB_PLOT_CHART_TEMPLATE: str = """
502502
This filter linked sub plot chart can be used to display metric data configured through a data filter
503-
in the global filter component.
504-
This template will render a new chart for each geography selected by the user
503+
in the global filter component.
504+
This template will render a new chart for each geography selected by the user
505505
for the selected entities according to the data filter.
506506
"""
507507

508508
FILTER_LINKED_SUB_PLOT_CHART_LEGEND_TITLE: str = """
509-
This legend title will be used for the title of the sub plot chart legends.
509+
This legend title will be used for the title of the sub plot chart legends.
510510
Eg. the colours associated with the geographies from global filter.
511511
"""
512512

513513
FILTER_LINKED_TIME_SERIES_CHART_TEMPLATE: str = """
514514
This filter linked time series chart can be used to display metric data configured through a data filter
515-
in the global filter component.
516-
This template will render a new chart for each geography selected by the user
515+
in the global filter component.
516+
This template will render a new chart for each geography selected by the user
517517
for the selected entities according to the data filter.
518518
"""
519519

520520
FILTER_LINKED_TIME_SERIES_CHART_LEGEND_TITLE: str = """
521-
This legend title will be used for the title of the time series chart legends.
521+
This legend title will be used for the title of the time series chart legends.
522522
Eg. the colours associated with the selected data entities from global filter.
523523
"""
524524

@@ -588,3 +588,19 @@
588588
PAGE_CLASSIFICATION: str = """
589589
The classification level of all data on this page (only applies to non-public pages). Defaults to `Official-Sensitive`.
590590
"""
591+
592+
SECTION_FOOTER_BLOCKS: str = """
593+
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)
594+
"""
595+
SECTION_FOOTER: str = """
596+
This is an optional footer for a section to provide a link to further information.
597+
"""
598+
SECTION_FOOTER_BADGE_LABEL: str = """
599+
This is the label used for the a section footer link badge"
600+
"""
601+
SECTION_FOOTER_LINK_TEXT: str = """
602+
This is the text to displayed along side a link in a the sections footer link.
603+
"""
604+
SECTION_FOOTER_LINK: str = """
605+
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.
606+
"""

cms/dynamic_content/sections.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
from wagtail.blocks import (
2-
RichTextBlock,
3-
StreamBlock,
4-
StructBlock,
5-
TextBlock,
6-
)
1+
from wagtail.blocks import RichTextBlock, StreamBlock, StructBlock, TextBlock
72

83
from cms.dynamic_content import blocks, cards, help_texts
94
from cms.dynamic_content.global_filter.card import GlobalFilterCard
@@ -35,6 +30,10 @@ class ContentCards(StreamBlock):
3530
)
3631

3732

33+
class FooterCardsSectionWithLink(StreamBlock):
34+
section_link = blocks.SectionFooterLink(help_texts="testing", max_num=1)
35+
36+
3837
class ContentCardsSectionWithLink(StreamBlock):
3938
text_card = cards.TextCard()
4039
chart_card_section = cards.ChartCardSection()
@@ -58,6 +57,9 @@ class SectionWithLink(StructBlock):
5857
help_text=help_texts.INDEX_PAGE_FIELD,
5958
)
6059
content = ContentCardsSectionWithLink(help_text=help_texts.CONTENT_ROW_CARDS)
60+
footer = FooterCardsSectionWithLink(
61+
help_text=help_texts.SECTION_FOOTER, required=False
62+
)
6163

6264
class Meta:
6365
icon = "thumbtack"

0 commit comments

Comments
 (0)