Browse Source

Add header settings via Cadastro Casa Legislativa.

pull/98/head
Edward Ribeiro 9 years ago
parent
commit
e33d9f4527
  1. 21
      sapl/context_processors.py
  2. 8
      templates/base.html

21
sapl/context_processors.py

@ -1,6 +1,15 @@
from base.models import CasaLegislativa
# TODO: this need to be cached and retrieved once!!!
def query_database():
return CasaLegislativa.objects.first()
def parliament_info(request): def parliament_info(request):
return { context = {
'state': 'Estado', 'state': 'Estado',
'state_abbr': 'UF', 'state_abbr': 'UF',
'city': 'Cidade', 'city': 'Cidade',
@ -11,3 +20,13 @@ def parliament_info(request):
'url_portal': '#', 'url_portal': '#',
'url_email': '#', 'url_email': '#',
} }
casa_legislativa = query_database()
if casa_legislativa:
context['parliament_type'] = casa_legislativa.nome
context['city'] = casa_legislativa.municipio
context['state'] = casa_legislativa.uf
context['logotipo'] = casa_legislativa.logotipo
return context;

8
templates/base.html

@ -117,8 +117,12 @@
{% block main_header %} {% block main_header %}
<header id="masthead" class="masthead page__row"> <header id="masthead" class="masthead page__row">
<div class="container"> <div class="container">
<a class="masthead__logo" href="#"> <a class="masthead__logo" href="#">
<img src="{% static 'img/logo.png' %}" alt="Logo"> {% if logotipo %}
<img src="{{ MEDIA_URL }}{{ logotipo }}" alt="Logo">
{% else %}
<img src="{% static 'img/logo.png' %}" alt="Logo">
{% endif %}
</a> </a>
<div class="masthead__heading"> <div class="masthead__heading">
{# XXX Make better use of translation tags in html blocks ie. actually use the proper blocktrans tag efficiently #} {# XXX Make better use of translation tags in html blocks ie. actually use the proper blocktrans tag efficiently #}

Loading…
Cancel
Save