diff --git a/lawlibrary/constants.py b/lawlibrary/constants.py new file mode 100644 index 000000000..8dc7106c1 --- /dev/null +++ b/lawlibrary/constants.py @@ -0,0 +1 @@ +PROVINCIAL_CODES = ["ec", "fs", "gp", "lp", "mp", "nc", "nw", "wc", "kzn", "transvaal"] diff --git a/lawlibrary/context_processors.py b/lawlibrary/context_processors.py new file mode 100644 index 000000000..6e3bbf4cf --- /dev/null +++ b/lawlibrary/context_processors.py @@ -0,0 +1,10 @@ +from lawlibrary.constants import PROVINCIAL_CODES + + +def lawlibrary(request): + """ + Add some useful context to templates. + """ + return { + "PROVINCIAL_CODES": PROVINCIAL_CODES, + } diff --git a/lawlibrary/settings.py b/lawlibrary/settings.py index a2a3e2b45..39923b304 100644 --- a/lawlibrary/settings.py +++ b/lawlibrary/settings.py @@ -7,3 +7,8 @@ JAZZMIN_SETTINGS["site_title"] = "Lawlibrary" # noqa JAZZMIN_SETTINGS["site_header"] = "Lawlibrary" # noqa JAZZMIN_SETTINGS["site_brand"] = "Lawlibrary.org.za" # noqa + + +TEMPLATES[0]["OPTIONS"]["context_processors"].append( # noqa + "lawlibrary.context_processors.lawlibrary" +) diff --git a/lawlibrary/templates/peachjam/_header.html b/lawlibrary/templates/peachjam/_header.html index 14de65d0e..e4ca84bd8 100644 --- a/lawlibrary/templates/peachjam/_header.html +++ b/lawlibrary/templates/peachjam/_header.html @@ -27,6 +27,12 @@ {% trans 'Provincial Legislation' %} + - + {% if show_subleg %} + + {% endif %}