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. 6
      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):
return {
context = {
'state': 'Estado',
'state_abbr': 'UF',
'city': 'Cidade',
@ -11,3 +20,13 @@ def parliament_info(request):
'url_portal': '#',
'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;

6
templates/base.html

@ -118,7 +118,11 @@
<header id="masthead" class="masthead page__row">
<div class="container">
<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>
<div class="masthead__heading">
{# XXX Make better use of translation tags in html blocks ie. actually use the proper blocktrans tag efficiently #}

Loading…
Cancel
Save