Skip to content

Commit

Permalink
Add optional description field to CTA block
Browse files Browse the repository at this point in the history
  • Loading branch information
SharmaineLim committed Jan 10, 2025
1 parent b563d3f commit 6af702e
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tbx/core/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<div class="call-to-action grid__call-to-action">
<div class="call-to-action__inner">
<p class="call-to-action__text">{{ value.text }}</p>
{% if value.description %}{{ value.description|richtext }}{% endif %}

{% if value.button_text and value.button_link %}
<a href="{{ value.get_button_link }}" class="call-to-action__button button">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
context:
value:
text: Get in touch to learn about our journey to becoming employee-owned
# description: '<p>Speak to our team to boost regular giving, improve supporter loyalty, or mobilise people behind your cause.</p>'
button_text: 'Contact Us'
button_link:
- internal_link:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<div class="contact-cta grid__contact-cta">
{% for cta in value.call_to_action %}
<h2 class="contact-cta__text heading heading--three heading--light">{{ cta.value.text }}</h2>
{% if cta.value.description %}{{ cta.value.description|richtext }}{% endif %}
{% endfor %}

{% if value.person %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ context:
call_to_action:
- value:
text: Get in touch to learn about our journey to becoming employee-owned
# description: '<p>Speak to our team to boost regular giving, improve supporter loyalty, or mobilise people behind your cause.</p>'
button_text: 'Contact Us'
button_link: True
person:
Expand Down

0 comments on commit 6af702e

Please sign in to comment.