diff --git a/publichealth/home/models/snippets.py b/publichealth/home/models/snippets.py index 8898e46..4dc397e 100644 --- a/publichealth/home/models/snippets.py +++ b/publichealth/home/models/snippets.py @@ -39,7 +39,7 @@ class Contact(models.Model): def www_domain(self): return self.www.replace('http://', '').replace('https://', '') def trans_title_styled(self): - v = self.trans_title + v = self.trans_title.split(' ') if len(v) != 3: return v return "%s %s %s" % tuple(v) def __str__(self): diff --git a/publichealth/home/templates/tags/contact_links.html b/publichealth/home/templates/tags/contact_links.html new file mode 100644 index 0000000..1fbe73f --- /dev/null +++ b/publichealth/home/templates/tags/contact_links.html @@ -0,0 +1,7 @@ + + + + + + + diff --git a/publichealth/home/templates/tags/contact_name.html b/publichealth/home/templates/tags/contact_name.html new file mode 100644 index 0000000..91b73c6 --- /dev/null +++ b/publichealth/home/templates/tags/contact_name.html @@ -0,0 +1 @@ +{{ contact.trans_title_styled|safe }} diff --git a/publichealth/home/templatetags/information.py b/publichealth/home/templatetags/information.py index ddf9351..090ce05 100644 --- a/publichealth/home/templatetags/information.py +++ b/publichealth/home/templatetags/information.py @@ -19,3 +19,17 @@ def contact_form(): return { 'contact': Contact.objects.last(), } + +# Contact links (header) +@register.inclusion_tag('tags/contact_links.html') +def contact_links(): + return { + 'contact': Contact.objects.last(), + } + +# Styled contact name (header) +@register.inclusion_tag('tags/contact_name.html') +def contact_name(): + return { + 'contact': Contact.objects.last(), + } diff --git a/publichealth/templates/header.html b/publichealth/templates/header.html index 306a435..8d5f9c8 100644 --- a/publichealth/templates/header.html +++ b/publichealth/templates/header.html @@ -1,4 +1,4 @@ -{% load wagtailcore_tags navigation %} +{% load wagtailcore_tags navigation information %} {% get_site_root as site_root %}