From c57392e83c3da27e4659f27db3c5ffe2e1fa735f Mon Sep 17 00:00:00 2001 From: James Graham Date: Mon, 10 May 2021 13:21:37 +0100 Subject: [PATCH] feat: add configurable help text for relationships Displayed at the top of relationship forms --- breccia_mapper/settings.py | 15 ++++++++++++--- people/templates/people/relationship/create.html | 8 ++++++++ people/templates/people/relationship/update.html | 8 ++++++++ 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/breccia_mapper/settings.py b/breccia_mapper/settings.py index 2c74594..5cfa1ad 100644 --- a/breccia_mapper/settings.py +++ b/breccia_mapper/settings.py @@ -357,6 +357,9 @@ CONSTANCE_CONFIG = { 'ORGANISATION_LIST_HELP': ( '', 'Help text to display at the top of the organisaton list.'), + 'RELATIONSHIP_FORM_HELP': ( + '', + 'Help text to display at the top of relationship forms.'), } # yapf: disable CONSTANCE_CONFIG_FIELDSETS = { @@ -364,9 +367,15 @@ CONSTANCE_CONFIG_FIELDSETS = { 'NOTICE_TEXT', 'NOTICE_CLASS', ), - 'Data Collection': ('CONSENT_TEXT', ), - 'Help Text': ('PERSON_LIST_HELP', 'ORGANISATION_LIST_HELP'), -} + 'Data Collection': ( + 'CONSENT_TEXT', + ), + 'Help Text': ( + 'PERSON_LIST_HELP', + 'ORGANISATION_LIST_HELP', + 'RELATIONSHIP_FORM_HELP', + ), +} # yapf: disable CONSTANCE_BACKEND = 'constance.backends.database.DatabaseBackend' diff --git a/people/templates/people/relationship/create.html b/people/templates/people/relationship/create.html index 6f7d8e5..e9d1749 100644 --- a/people/templates/people/relationship/create.html +++ b/people/templates/people/relationship/create.html @@ -15,6 +15,14 @@

Add Relationship

+ {% with config.RELATIONSHIP_FORM_HELP as help_text %} + {% if help_text %} +
+ {{ help_text|linebreaks }} +
+ {% endif %} + {% endwith %} +
Update Relationship + {% with config.RELATIONSHIP_FORM_HELP as help_text %} + {% if help_text %} +
+ {{ help_text|linebreaks }} +
+ {% endif %} + {% endwith %} +