From 1d63c5c39c58dc3b7b62fcc365b7de9f43a02529 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felipe=20Mart=C3=ADn?= Date: Fri, 24 May 2013 12:37:27 +0200 Subject: [PATCH] Added SITE_TITLE and layout block head_title to manage tag --- minecraftcodex/database/templates/about.html | 4 ++++ minecraftcodex/database/templates/layout.html | 3 ++- minecraftcodex/database/templates/versions.html | 4 ++++ minecraftcodex/herobrine/context.py | 8 +++++++- minecraftcodex/herobrine/settings.py | 6 +++++- 5 files changed, 22 insertions(+), 3 deletions(-) diff --git a/minecraftcodex/database/templates/about.html b/minecraftcodex/database/templates/about.html index 47206d5..371a711 100644 --- a/minecraftcodex/database/templates/about.html +++ b/minecraftcodex/database/templates/about.html @@ -1,5 +1,9 @@ {% extends "layout.html" %} +{% block head_title %} +{{ super() }} | About +{% endblock %} + {% block content %} About page {% endblock %} diff --git a/minecraftcodex/database/templates/layout.html b/minecraftcodex/database/templates/layout.html index c95fb1e..51d178c 100644 --- a/minecraftcodex/database/templates/layout.html +++ b/minecraftcodex/database/templates/layout.html @@ -4,7 +4,8 @@ <link rel="stylesheet" href="/static/lib/font-awesome.3.1.1.css" /> <link rel="stylesheet" href="/static/lib/bootstrap.css" /> <link rel="stylesheet" href="/static/lib/responsive.css" /> - <title>Title + {% include "head.html" %} + {% block head_title %}{{ site_title }}{% endblock %}
diff --git a/minecraftcodex/database/templates/versions.html b/minecraftcodex/database/templates/versions.html index 5584f09..92c9981 100644 --- a/minecraftcodex/database/templates/versions.html +++ b/minecraftcodex/database/templates/versions.html @@ -1,5 +1,9 @@ {% extends "layout.html" %} +{% block head_title %} +{{ super() }} | Versions +{% endblock %} + {% block content %} diff --git a/minecraftcodex/herobrine/context.py b/minecraftcodex/herobrine/context.py index 6f55831..732fc51 100644 --- a/minecraftcodex/herobrine/context.py +++ b/minecraftcodex/herobrine/context.py @@ -1,8 +1,14 @@ from django.conf import settings -def templateContext(request): +def TemplateContext(request): result = {} if hasattr(settings, 'TEMPLATE_CONTEXT'): for item in settings.TEMPLATE_CONTEXT: result[item[0]] = item[1] return result + + +def SiteTitleContext(request): + return { + 'site_title': settings.SITE_TITLE + } diff --git a/minecraftcodex/herobrine/settings.py b/minecraftcodex/herobrine/settings.py index ca67399..55f7498 100644 --- a/minecraftcodex/herobrine/settings.py +++ b/minecraftcodex/herobrine/settings.py @@ -94,7 +94,8 @@ TEMPLATE_LOADERS = ( ) TEMPLATE_CONTEXT_PROCESSORS = global_settings.TEMPLATE_CONTEXT_PROCESSORS + ( - 'herobrine.context.templateContext', + 'herobrine.context.TemplateContext', + 'herobrine.context.SiteTitleContext', ) JINGO_INCLUDE_PATTERN = r'\.html' @@ -147,6 +148,9 @@ JINJA_CONFIG = { } #from herobrine import filters +# SITE TITLE +SITE_TITLE = 'MinecraftCodex' + try: LOCAL_SETTINGS