Skip to content

Commit f7fc2ef

Browse files
CDD-3163: Implement section footer for landing & topic_list page
1 parent 64a6d3e commit f7fc2ef

File tree

5 files changed

+2171
-6
lines changed

5 files changed

+2171
-6
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: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,3 +584,19 @@
584584
SOURCE_LINK_URL: str = """
585585
For linking to external url. (Only one of page or external_url must be filled not both).
586586
"""
587+
588+
SECTION_FOOTER_BLOCKS: str = """
589+
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)
590+
"""
591+
SECTION_FOOTER: str = """
592+
This is an optional footer for a section to provide a link to further information.
593+
"""
594+
SECTION_FOOTER_BADGE_LABEL: str = """
595+
This is the label used for the a section footer link badge"
596+
"""
597+
SECTION_FOOTER_LINK_TEXT: str = """
598+
This is the text to displayed along side a link in a the sections footer link.
599+
"""
600+
SECTION_FOOTER_LINK: str = """
601+
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.
602+
"""

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)