Allow for overriding title

This simply adds a global template variable taken from
LODGEIT_TITLE_OVERRIDE that allows setting the site title for some
minimal customisation.

Previously, the opendev puppet would copy a custom layout.html over
the shipped version.  This allows us to simply set a variable and not
have duplicate copies of templates in config managment.

Change-Id: If25dcece0ecd2b7dfc0178c6886559ac2507b28f
This commit is contained in:
Ian Wienand 2021-06-29 16:13:19 +10:00
parent 2b0ca071f9
commit a1e1667a36
3 changed files with 10 additions and 1 deletions

6
README
View File

@ -64,3 +64,9 @@ Now start the development server::
python manage.py runserver python manage.py runserver
Enjoy! Enjoy!
Environment Settings
====================
LODGEIT_TITLE_OVERRIDE : <string>
Arbitrary string to override the main heading for site customisation

View File

@ -8,6 +8,7 @@
:license: BSD :license: BSD
""" """
import base64 import base64
import os
import re import re
import time import time
from os import path from os import path
@ -45,6 +46,8 @@ def url_for(endpoint, external=False, **values):
jinja_environment.globals['url_for'] = url_for jinja_environment.globals['url_for'] = url_for
jinja_environment.globals['title'] = \
os.getenv('LODGEIT_TITLE_OVERRIDE', 'Lodge It')
def generate_user_hash(): def generate_user_hash():

View File

@ -18,7 +18,7 @@
<body> <body>
<div class="page"> <div class="page">
<div id="header"> <div id="header">
<h1>Lodge It</h1> <h1>{{ title }}</h1>
</div> </div>
<ul id="navigation"> <ul id="navigation">
{%- for href, id, caption in [ {%- for href, id, caption in [