feat: add configurable help text to list pages

Resolves #103
This commit is contained in:
James Graham
2021-03-18 17:26:59 +00:00
parent 98e9148998
commit 1de4f741b8
3 changed files with 36 additions and 13 deletions

View File

@@ -125,7 +125,8 @@ SETTINGS_EXPORT = [
'GOOGLE_MAPS_API_KEY',
]
PARENT_PROJECT_NAME = config('PARENT_PROJECT_NAME', default='Parent Project Name')
PARENT_PROJECT_NAME = config('PARENT_PROJECT_NAME',
default='Parent Project Name')
PROJECT_LONG_NAME = config('PROJECT_LONG_NAME', default='Project Long Name')
PROJECT_SHORT_NAME = config('PROJECT_SHORT_NAME', default='shortname')
@@ -340,16 +341,23 @@ logger = logging.getLogger(__name__) # pylint: disable=invalid-name
# Admin panel variables
CONSTANCE_CONFIG = collections.OrderedDict([
('NOTICE_TEXT',
('',
'Text to be displayed in a notice banner at the top of every page.')),
('NOTICE_CLASS', ('alert-warning',
'CSS class to use for background of notice banner.')),
('CONSENT_TEXT',
('This is template consent text and should have been replaced. Please contact an admin.',
'Text to be displayed to ask for consent for data collection.'))
])
CONSTANCE_CONFIG = {
'NOTICE_TEXT': (
'',
'Text to be displayed in a notice banner at the top of every page.'),
'NOTICE_CLASS': (
'alert-warning',
'CSS class to use for background of notice banner.'),
'CONSENT_TEXT': (
'This is template consent text and should have been replaced. Please contact an admin.',
'Text to be displayed to ask for consent for data collection.'),
'PERSON_LIST_HELP': (
'',
'Help text to display at the top of the people list.'),
'ORGANISATION_LIST_HELP': (
'',
'Help text to display at the top of the organisaton list.'),
} # yapf: disable
CONSTANCE_CONFIG_FIELDSETS = {
'Notice Banner': (
@@ -357,17 +365,16 @@ CONSTANCE_CONFIG_FIELDSETS = {
'NOTICE_CLASS',
),
'Data Collection': ('CONSENT_TEXT', ),
'Help Text': ('PERSON_LIST_HELP', 'ORGANISATION_LIST_HELP'),
}
CONSTANCE_BACKEND = 'constance.backends.database.DatabaseBackend'
# Django Hijack settings
# See https://django-hijack.readthedocs.io/en/stable/
HIJACK_USE_BOOTSTRAP = True
# Bootstrap settings
# See https://django-bootstrap4.readthedocs.io/en/latest/settings.html

View File

@@ -14,6 +14,14 @@
<a class="btn btn-success"
href="{% url 'people:organisation.create' %}">New Organisation</a>
{% with config.ORGANISATION_LIST_HELP as help_text %}
{% if help_text %}
<div class="alert alert-info mt-3 pb-0">
{{ help_text|linebreaks }}
</div>
{% endif %}
{% endwith %}
<table class="table table-borderless">
<tbody>
{% for country, organisations in orgs_by_country.items %}

View File

@@ -14,6 +14,14 @@
<a class="btn btn-success"
href="{% url 'people:person.create' %}">New Person</a>
{% with config.PERSON_LIST_HELP as help_text %}
{% if help_text %}
<div class="alert alert-info mt-3 pb-0">
{{ help_text|linebreaks }}
</div>
{% endif %}
{% endwith %}
<table class="table table-borderless">
<thead>
<tr>