Skip to content

Commit af0a016

Browse files
committed
Remove response settings in favour of many more template customisation points
1 parent cdef842 commit af0a016

File tree

3 files changed

+27
-47
lines changed

3 files changed

+27
-47
lines changed

response/apps.py

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
from django.apps import AppConfig
22
from django.conf import settings as site_settings
3-
from django.templatetags.static import static
4-
from django.utils.functional import lazy
53

64

75
class ResponseConfig(AppConfig):
@@ -20,17 +18,6 @@ def ready(self):
2018

2119
from .core import signals as core_signals # noqa: F401
2220

23-
self.configure_setting("RESPONSE_LOGIN_REQUIRED", True)
24-
self.configure_setting("RESPONSE_APP_NAME", "Response")
25-
self.configure_setting(
26-
"RESPONSE_FAVICON", self.lazy_static_url("images/favicon.png")
21+
site_settings.RESPONSE_LOGIN_REQUIRED = getattr(
22+
site_settings, "RESPONSE_LOGIN_REQUIRED", True
2723
)
28-
self.configure_setting(
29-
"RESPONSE_LOGO", self.lazy_static_url("images/response.png")
30-
)
31-
32-
def configure_setting(self, name, default):
33-
setattr(site_settings, name, getattr(site_settings, name, default))
34-
35-
def lazy_static_url(self, name):
36-
return lazy(lambda: static(name))()

response/templates/response/base.html

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{% load static %}
2-
{% load response_settings %}
32
{% load bootstrap4_alerts %}
43

54
<!DOCTYPE html>
@@ -8,21 +7,28 @@
87
<head>
98
<title>
109
{% block title %}
11-
{% response_setting "RESPONSE_APP_NAME" %}
10+
Response
1211
{% endblock %}
1312
</title>
14-
<link rel="shortcut icon" href="{% response_setting 'RESPONSE_FAVICON' %}">
1513

16-
<meta charset="utf-8">
17-
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
18-
<meta name="description" content="{% response_setting "RESPONSE_APP_NAME" %}">
19-
<meta name="author" content="Monzo">
20-
<meta name="mobile-web-app-capable" content="yes">
21-
<meta name="apple-mobile-web-app-capable" content="yes">
22-
<link rel="manifest" href="{% static 'manifest.json' %}">
14+
{% block favicon %}
15+
<link rel="shortcut icon" href="{% static 'images/favicon.png' %}">
16+
{% endblock %}
17+
18+
{% block meta %}
19+
<meta charset="utf-8">
20+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
21+
<meta name="description" content="Response">
22+
<meta name="author" content="Monzo">
23+
<meta name="mobile-web-app-capable" content="yes">
24+
<meta name="apple-mobile-web-app-capable" content="yes">
25+
{% endblock %}
2326

24-
<link href="{% static 'bootstrap/css/bootstrap.css' %}" rel="stylesheet">
25-
<link href="{% static 'common.css' %}" rel="stylesheet">
27+
{% block static %}
28+
<link rel="manifest" href="{% static 'manifest.json' %}">
29+
<link href="{% static 'bootstrap/css/bootstrap.css' %}" rel="stylesheet">
30+
<link href="{% static 'common.css' %}" rel="stylesheet">
31+
{% endblock %}
2632

2733
{% block head %}{% endblock %}
2834

@@ -34,10 +40,12 @@
3440
{% block navigation %}
3541
<nav class="navbar navbar-expand-lg navbar-dark bg-dark static-top">
3642
<div class="{% block navbar_container_class %}container{% endblock %}">
37-
<a class="navbar-brand" href="/">
38-
<img id="logo" src="{% response_setting 'RESPONSE_LOGO' %}" />
39-
<strong>{% response_setting "RESPONSE_APP_NAME" %}</strong>
40-
</a>
43+
{% block navigation_brand %}
44+
<a class="navbar-brand" href="/">
45+
<img id="logo" src="{% static 'images/response.png' %}" />
46+
<strong>Response</strong>
47+
</a>
48+
{% endblock %}
4149

4250
<button
4351
class="navbar-toggler"
@@ -53,7 +61,7 @@
5361

5462
<div class="collapse navbar-collapse" id="navbarResponsive">
5563
<ul class="navbar-nav ml-auto">
56-
{% block navbar %}{% endblock %}
64+
{% block navigation_items %}{% endblock %}
5765
</ul>
5866
</div>
5967
</div>

response/templatetags/response_settings.py

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)