From 6af702ee15b62e1cd7fc7f27e214d0d75e98e432 Mon Sep 17 00:00:00 2001 From: Amanda Lim-Cabuloy Date: Fri, 10 Jan 2025 17:26:33 +0800 Subject: [PATCH] Add optional description field to CTA block --- tbx/core/blocks.py | 3 +++ .../patterns/molecules/streamfield/blocks/call_to_action.html | 1 + .../patterns/molecules/streamfield/blocks/call_to_action.yaml | 1 + .../molecules/streamfield/blocks/contact_call_to_action.html | 1 + .../molecules/streamfield/blocks/contact_call_to_action.yaml | 1 + 5 files changed, 7 insertions(+) diff --git a/tbx/core/blocks.py b/tbx/core/blocks.py index 9c3e5c909..ee514d1f9 100644 --- a/tbx/core/blocks.py +++ b/tbx/core/blocks.py @@ -235,6 +235,9 @@ def get_button_file_size(self): class CallToActionBlock(blocks.StructBlock): text = blocks.CharBlock(required=True, max_length=255) + description = blocks.RichTextBlock( + features=settings.PARAGRAPH_RICH_TEXT_FEATURES, required=False + ) button_text = blocks.CharBlock(max_length=55) button_link = blocks.StreamBlock( [ diff --git a/tbx/project_styleguide/templates/patterns/molecules/streamfield/blocks/call_to_action.html b/tbx/project_styleguide/templates/patterns/molecules/streamfield/blocks/call_to_action.html index 531ba6910..53b9c6d0a 100644 --- a/tbx/project_styleguide/templates/patterns/molecules/streamfield/blocks/call_to_action.html +++ b/tbx/project_styleguide/templates/patterns/molecules/streamfield/blocks/call_to_action.html @@ -3,6 +3,7 @@

{{ value.text }}

+ {% if value.description %}{{ value.description|richtext }}{% endif %} {% if value.button_text and value.button_link %} diff --git a/tbx/project_styleguide/templates/patterns/molecules/streamfield/blocks/call_to_action.yaml b/tbx/project_styleguide/templates/patterns/molecules/streamfield/blocks/call_to_action.yaml index 863f282e7..0c29d660f 100644 --- a/tbx/project_styleguide/templates/patterns/molecules/streamfield/blocks/call_to_action.yaml +++ b/tbx/project_styleguide/templates/patterns/molecules/streamfield/blocks/call_to_action.yaml @@ -1,6 +1,7 @@ context: value: text: Get in touch to learn about our journey to becoming employee-owned + # description: '

Speak to our team to boost regular giving, improve supporter loyalty, or mobilise people behind your cause.

' button_text: 'Contact Us' button_link: - internal_link: diff --git a/tbx/project_styleguide/templates/patterns/molecules/streamfield/blocks/contact_call_to_action.html b/tbx/project_styleguide/templates/patterns/molecules/streamfield/blocks/contact_call_to_action.html index 539eb01ad..f7b416df1 100644 --- a/tbx/project_styleguide/templates/patterns/molecules/streamfield/blocks/contact_call_to_action.html +++ b/tbx/project_styleguide/templates/patterns/molecules/streamfield/blocks/contact_call_to_action.html @@ -2,6 +2,7 @@
{% for cta in value.call_to_action %}

{{ cta.value.text }}

+ {% if cta.value.description %}{{ cta.value.description|richtext }}{% endif %} {% endfor %} {% if value.person %} diff --git a/tbx/project_styleguide/templates/patterns/molecules/streamfield/blocks/contact_call_to_action.yaml b/tbx/project_styleguide/templates/patterns/molecules/streamfield/blocks/contact_call_to_action.yaml index fd8e82f43..d177b551a 100644 --- a/tbx/project_styleguide/templates/patterns/molecules/streamfield/blocks/contact_call_to_action.yaml +++ b/tbx/project_styleguide/templates/patterns/molecules/streamfield/blocks/contact_call_to_action.yaml @@ -3,6 +3,7 @@ context: call_to_action: - value: text: Get in touch to learn about our journey to becoming employee-owned + # description: '

Speak to our team to boost regular giving, improve supporter loyalty, or mobilise people behind your cause.

' button_text: 'Contact Us' button_link: True person: