Add a footer with a legal page

This commit is contained in:
Rodolphe Breard 2018-06-03 11:02:55 +02:00
parent 4bdfe2d05c
commit 2e7c42f61f
4 changed files with 30 additions and 6 deletions

View file

@ -11,6 +11,14 @@ html,body {
opacity: 0.8;
}
#page-footer {
text-align: center;
}
#messages {
margin-top: 10px;
}
.tooltip-inner {
background-color: #efeded;
color: #222;
@ -40,7 +48,3 @@ html,body {
font-style: italic;
color: #9073FF;
}
.messages {
margin-top: 10px;
}

View file

@ -1,4 +1,4 @@
{% load static %}{% load i18n %}{% load navbar %}{% get_current_language as LANGUAGE_CODE %}<!doctype html>
{% load static %}{% load i18n %}{% load navbar %}{% load get_page %}{% get_current_language as LANGUAGE_CODE %}<!doctype html>
<html lang="{{ LANGUAGE_CODE }}">
<head>
<!-- Begin bootstrap headers -->
@ -22,7 +22,7 @@
{% navbar %}
<div class="container" id="main-content">
{% if messages %}
<div class="messages">
<div id="messages">
{% for message in messages %}
<div class="alert alert-{% if message.level == DEFAULT_MESSAGE_LEVELS.ERROR %}danger{% elif message.level == DEFAULT_MESSAGE_LEVELS.WARNING %}warning{% elif message.level == DEFAULT_MESSAGE_LEVELS.SUCCESS %}success{% elif message.level == DEFAULT_MESSAGE_LEVELS.INFO %}info{% else %}secondary{% endif %}" role="alert">
{% if 'safe' in message.tags %}
@ -35,6 +35,12 @@
</div>
{% endif %}
{% block content %}{% endblock %}
<footer id="page-footer" class="content-bloc">
{% get_page 'legal' as legal_page %}
{% if legal_page %}
<a href="{% url 'page' 'legal' %}">{{ legal_page.title }}</a>
{% endif %}
</footer>
</div>
<script src="{% static "khaganat/jquery-3.2.1.min.js" %}"></script>
<script src="{% static "khaganat/bootstrap/4.0.0-beta.3/js/bootstrap.bundle.min.js" %}"></script>

View file

View file

@ -0,0 +1,14 @@
from django.utils.translation import get_language
from pages.models import PageContent
from django import template
register = template.Library()
@register.simple_tag(takes_context=True)
def get_page(context, slug):
request = context['request']
obj = PageContent.objects.filter(
language=get_language(),
page__slug=slug
).first
return obj