Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions cms/dynamic_content/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
16 changes: 16 additions & 0 deletions cms/dynamic_content/help_texts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""
14 changes: 8 additions & 6 deletions cms/dynamic_content/sections.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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()
Expand All @@ -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"
Expand Down
Loading
Loading