diff options
author | Zarino Zappia <mail@zarino.co.uk> | 2018-08-17 15:26:17 +0100 |
---|---|---|
committer | Zarino Zappia <mail@zarino.co.uk> | 2018-08-20 13:07:53 +0100 |
commit | 0caded8cc55ef78d9e65089387e97532566d0182 (patch) | |
tree | 74141494d8c1564b3a25d6d709264636fdf61f15 | |
parent | f607f2142f7986881d2975dbf682bb825266856d (diff) |
Make it easier to prevent a form_detail_placeholder being printed
Previously, if you didn’t want a hint to appear under the main "details"
textarea on the new report form, you had to override the entire
`form_report.html` template, or leave the hint element in the markup but
hide it with CSS.
Now, you can set `form_detail_placeholder` to a falsey value, and the
template won’t output the hint element at all. It also amends the
`aria-describedby` attribute on the textarea so it doesn’t end up
referencing a hint element that doesn’t exist.
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | templates/web/base/report/new/form_report.html | 13 |
2 files changed, 12 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index ade890b0d..df48083e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ - Cobrand hook for presenting custom search results. #2183 - Cobrand hook to allow extra login conditions #2092 - Add ability for client to set bodies not to be sent to. + - Make it easier to prevent a form_detail_placeholder being printed. * v2.3.4 (7th June 2018) diff --git a/templates/web/base/report/new/form_report.html b/templates/web/base/report/new/form_report.html index ce8f69855..b4688f950 100644 --- a/templates/web/base/report/new/form_report.html +++ b/templates/web/base/report/new/form_report.html @@ -49,13 +49,22 @@ [% TRY %][% PROCESS 'report/new/after_photo.html' %][% CATCH file %][% END %] [% DEFAULT form_detail_label = loc('Explain what’s wrong') %] - [% DEFAULT form_detail_placeholder = loc('e.g. ‘This pothole has been here for two months and…’') %] <label for="form_detail">[% form_detail_label %]</label> + +[%# You can prevent a hint being printed by setting form_detail_placeholder to a Falsey value %] +[% IF NOT form_detail_placeholder.defined %] + [% SET form_detail_placeholder = loc('e.g. ‘This pothole has been here for two months and…’') %] +[% END %] + +[% IF form_detail_placeholder %] <p class="form-hint" id="detail-hint">[% form_detail_placeholder %]</p> +[% END %] + [% IF field_errors.detail %] <p class='form-error'>[% field_errors.detail %]</p> [% END %] - <textarea class="form-control" rows="7" cols="26" name="detail" id="form_detail" aria-describedby="detail-hint" required>[% report.detail | html %]</textarea> + + <textarea class="form-control" rows="7" cols="26" name="detail" id="form_detail" [% IF form_detail_placeholder %]aria-describedby="detail-hint"[% END %] required>[% report.detail | html %]</textarea> [% TRY %][% PROCESS 'report/new/inline-tips.html' %][% CATCH file %][% END %] |