From c8d74a83513bf09f4a20134acfcbe36d38a168e5 Mon Sep 17 00:00:00 2001 From: Anna Sidwell Date: Sun, 15 Apr 2018 22:10:05 +1000 Subject: [PATCH] Hide and show negative case reasons 'other' field appropriately, closes #44 --- apps/map/models.py | 7 +++++++ apps/map/templates/map/form.html | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/apps/map/models.py b/apps/map/models.py index 1134d1e..3b62e40 100644 --- a/apps/map/models.py +++ b/apps/map/models.py @@ -211,6 +211,13 @@ class CaseStudy(models.Model): etc')), ('ALAB', _('Abusive labour practices')), ('CRUP', _('Corruption and/or irregular permitting or contracting, conflicts of interest etc')), + # + # N.B. + # If you add another field in here, you need to edit conditionalCheckboxes + # in templates/map/form.html and increment the check for the 'other' field there. + # If you don't, the 'other' detail entry won't show and hide at the appropriate + # times. + # ('OTHR', NEGATIVE_CASE_REASONS_OTHER_TEXT) ) diff --git a/apps/map/templates/map/form.html b/apps/map/templates/map/form.html index 4a03985..7c91cc6 100644 --- a/apps/map/templates/map/form.html +++ b/apps/map/templates/map/form.html @@ -190,6 +190,10 @@ { "checkbox": "#id_shown_on_other_platforms", "showHide": "#div_id_shown_on_other_platforms_detail" + }, + { + "checkbox": "#id_negative_case_reasons_8", + "showHide": "#div_id_negative_case_reasons_other" } ];