aboutsummaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorZarino Zappia <mail@zarino.co.uk>2018-08-17 15:26:17 +0100
committerZarino Zappia <mail@zarino.co.uk>2018-08-20 13:07:53 +0100
commit0caded8cc55ef78d9e65089387e97532566d0182 (patch)
tree74141494d8c1564b3a25d6d709264636fdf61f15 /templates
parentf607f2142f7986881d2975dbf682bb825266856d (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.
Diffstat (limited to 'templates')
-rw-r--r--templates/web/base/report/new/form_report.html13
1 files changed, 11 insertions, 2 deletions
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 %]