Skip to content

Commit

Permalink
TWE-24 Add CTA fields (text+link) to footer
Browse files Browse the repository at this point in the history
  • Loading branch information
bmispelon committed Feb 10, 2025
1 parent 9165b1b commit 1a7a613
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 5.1.5 on 2025-02-10 08:23

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('navigation', '0006_use_custom_streamfield'),
]

operations = [
migrations.AddField(
model_name='navigationsettings',
name='footer_newsletter_cta_text',
field=models.TextField(blank=True),
),
migrations.AddField(
model_name='navigationsettings',
name='footer_newsletter_cta_url',
field=models.URLField(blank=True),
),
]
6 changes: 6 additions & 0 deletions tbx/navigation/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,17 @@ class NavigationSettings(BaseSiteSetting, ClusterableModel):
blank=True,
help_text="Single list of logos that appear before the footer box",
)
footer_newsletter_cta_url = models.URLField(blank=True)
footer_newsletter_cta_text = models.TextField(blank=True)

panels = [
FieldPanel("primary_navigation"),
FieldPanel("footer_links"),
FieldPanel("footer_logos"),
MultiFieldPanel([
FieldPanel("footer_newsletter_cta_url"),
FieldPanel("footer_newsletter_cta_text"),
], heading="Footer newsletter CTA")
]

def save(self, **kwargs):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,15 @@
{% wagtailcache 600 "footerlinks" current_site.pk is_pattern_library %}
{% footerlinks %}
{% endwagtailcache %}
<a href="#" class="footer__newsletter-link">Sign up for news and insights{% include "patterns/atoms/icons/icon.html" with name="arrow-wide" classname="footer__arrow" %}</a>
{% with settings.navigation.NavigationSettings as global_settings %}
{% if global_settings.footer_newsletter_cta_url and global_settings.footer_newsletter_cta_text %}
<a href="{{ global_settings.footer_newsletter_cta_url }}"
class="footer__newsletter-link">
{{ global_settings.footer_newsletter_cta_text }}
{% include "patterns/atoms/icons/icon.html" with name="arrow-wide" classname="footer__arrow" %}
</a>
{% endif %}
{% endwith %}
<ul class="footer__socials">
<li>
<a aria-label="Follow us on Bluesky"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ context:
url: '#'
alt_text: 'We are carbon neutral'
image: fake
footer_newsletter_cta_url: '#'
footer_newsletter_cta_text: 'Sign up for news and insights'

tags:
srcset_image:
Expand Down

0 comments on commit 1a7a613

Please sign in to comment.