Contact info header

This commit is contained in:
Oleg Lavrovsky 2017-04-11 23:38:59 +02:00
parent 368e938a47
commit 41bc3c036a
5 changed files with 28 additions and 10 deletions

View File

@ -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 "<strong>%s %s</strong> %s" % tuple(v)
def __str__(self):

View File

@ -0,0 +1,7 @@
<a href="{{ contact.phone_link }}">
<span class="glyphicon glyphicon-earphone" aria-hidden="true"></span>
<span class="hidden-xs">{{ contact.phone }}</span></a>
<a href="{{ contact.email_link }}">
<span class="glyphicon glyphicon-envelope" aria-hidden="true"></span>
<span class="hidden-xs">{{ contact.email }}</span></a>

View File

@ -0,0 +1 @@
{{ contact.trans_title_styled|safe }}

View File

@ -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(),
}

View File

@ -1,4 +1,4 @@
{% load wagtailcore_tags navigation %}
{% load wagtailcore_tags navigation information %}
{% get_site_root as site_root %}
<nav class="navbar-pre navbar-fixed-top">
@ -6,12 +6,7 @@
<div class="nav">
<span class="contact-nav">
<a class="link" href="#contact">Kontakt</a>
<a href="{{ contact.phone_link }}">
<span class="glyphicon glyphicon-earphone" aria-hidden="true"></span>
<span class="hidden-xs">{{ contact.phone }}</span></a>
<a href="{{ contact.email_link }}">
<span class="glyphicon glyphicon-envelope" aria-hidden="true"></span>
<span class="hidden-xs">{{ contact.email }}</span></a>
{% contact_links %}
</span>
<span class="language-nav">
{% language_switcher %}
@ -29,8 +24,9 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="{% pageurl site_root %}"><img src="/static/images/public-health-logo-sign.png" alt="[logo]">
<span class="hidden-xs">{{ contact.trans_title }}</span></a>
<a class="navbar-brand" href="{% pageurl site_root %}">
<img src="/static/images/public-health-logo-sign.png" alt="[logo]">
<span class="hidden-xs">{% contact_name %}</span></a>
</div>
{% block menu %}