root: fix passbook.footer_links not being rendered
This commit is contained in:
parent
9feea155fe
commit
429627494c
|
@ -46,10 +46,11 @@
|
||||||
<footer class="pf-c-login__footer">
|
<footer class="pf-c-login__footer">
|
||||||
<p></p>
|
<p></p>
|
||||||
<ul class="pf-c-list pf-m-inline">
|
<ul class="pf-c-list pf-m-inline">
|
||||||
|
{% for link in config.passbook.footer_links %}
|
||||||
<li>
|
<li>
|
||||||
<a href="https://passbook.beryju.org/">{% trans 'Documentation' %}</a>
|
<a href="{{ link.href }}">{{ link.name }}</a>
|
||||||
</li>
|
</li>
|
||||||
<!-- TODO:load config.passbook.footer.links -->
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -51,10 +51,11 @@
|
||||||
<footer class="pf-c-login__footer">
|
<footer class="pf-c-login__footer">
|
||||||
<p></p>
|
<p></p>
|
||||||
<ul class="pf-c-list pf-m-inline">
|
<ul class="pf-c-list pf-m-inline">
|
||||||
|
{% for link in config.passbook.footer_links %}
|
||||||
<li>
|
<li>
|
||||||
<a href="https://passbook.beryju.org/">{% trans 'Documentation' %}</a>
|
<a href="{{ link.href }}">{{ link.name }}</a>
|
||||||
</li>
|
</li>
|
||||||
<!-- TODO: load config.passbook.footer.links -->
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -56,10 +56,11 @@
|
||||||
<footer class="pf-c-login__footer">
|
<footer class="pf-c-login__footer">
|
||||||
<p></p>
|
<p></p>
|
||||||
<ul class="pf-c-list pf-m-inline">
|
<ul class="pf-c-list pf-m-inline">
|
||||||
|
{% for link in config.passbook.footer_links %}
|
||||||
<li>
|
<li>
|
||||||
<a href="https://passbook.beryju.org/">{% trans 'Documentation' %}</a>
|
<a href="{{ link.href }}">{{ link.name }}</a>
|
||||||
</li>
|
</li>
|
||||||
<!-- TODO:load config.passbook.footer.links -->
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -3,11 +3,12 @@ import os
|
||||||
from collections.abc import Mapping
|
from collections.abc import Mapping
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
from glob import glob
|
from glob import glob
|
||||||
from typing import Any
|
from typing import Any, Dict
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
from django.conf import ImproperlyConfigured
|
from django.conf import ImproperlyConfigured
|
||||||
|
from django.http import HttpRequest
|
||||||
from structlog import get_logger
|
from structlog import get_logger
|
||||||
|
|
||||||
SEARCH_PATHS = ["passbook/lib/default.yml", "/etc/passbook/config.yml", ""] + glob(
|
SEARCH_PATHS = ["passbook/lib/default.yml", "/etc/passbook/config.yml", ""] + glob(
|
||||||
|
@ -18,6 +19,12 @@ ENV_PREFIX = "PASSBOOK"
|
||||||
ENVIRONMENT = os.getenv(f"{ENV_PREFIX}_ENV", "local")
|
ENVIRONMENT = os.getenv(f"{ENV_PREFIX}_ENV", "local")
|
||||||
|
|
||||||
|
|
||||||
|
def context_processor(request: HttpRequest) -> Dict[str, Any]:
|
||||||
|
"""Context Processor that injects config object into every template"""
|
||||||
|
kwargs = {"config": CONFIG.raw}
|
||||||
|
return kwargs
|
||||||
|
|
||||||
|
|
||||||
class ConfigLoader:
|
class ConfigLoader:
|
||||||
"""Search through SEARCH_PATHS and load configuration. Environment variables starting with
|
"""Search through SEARCH_PATHS and load configuration. Environment variables starting with
|
||||||
`ENV_PREFIX` are also applied.
|
`ENV_PREFIX` are also applied.
|
||||||
|
|
|
@ -18,7 +18,9 @@ log_level: warning
|
||||||
error_reporting: false
|
error_reporting: false
|
||||||
|
|
||||||
passbook:
|
passbook:
|
||||||
|
# Optionally add links to the footer on the login page
|
||||||
footer_links:
|
footer_links:
|
||||||
# Optionally add links to the footer on the login page
|
- name: Documentation
|
||||||
|
href: https://passbook.beryju.org/
|
||||||
# - name: test
|
# - name: test
|
||||||
# href: https://test
|
# href: https://test
|
||||||
|
|
|
@ -181,6 +181,7 @@ TEMPLATES = [
|
||||||
"django.template.context_processors.request",
|
"django.template.context_processors.request",
|
||||||
"django.contrib.auth.context_processors.auth",
|
"django.contrib.auth.context_processors.auth",
|
||||||
"django.contrib.messages.context_processors.messages",
|
"django.contrib.messages.context_processors.messages",
|
||||||
|
"passbook.lib.config.context_processor",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Reference in a new issue