-
-
Notifications
You must be signed in to change notification settings - Fork 235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make it easier to prevent a form_detail_placeholder being printed #2212
Conversation
Requires mysociety/fixmystreet#2212 in core.
Codecov Report
@@ Coverage Diff @@
## master #2212 +/- ##
=========================================
Coverage ? 79.46%
=========================================
Files ? 182
Lines ? 11830
Branches ? 2206
=========================================
Hits ? 9401
Misses ? 1665
Partials ? 764 Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One possible change to reduce the change is all :)
@@ -49,13 +49,22 @@ <h2 class="form-section-heading">[% loc( 'Public details' ) %]</h2> | |||
[% 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…’') %] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What you have works fine, but I wonder if it would be clearer if this line became [% IF NOT form_detail_placeholder.defined %][% SET form_detail_placeholder = ... %][% END %]
and then below would be [% IF form_detail_placeholder %]...
without needing to duplicate e.g. the aria_describedby line. What do you think? Not much in it.
df076c0
to
3d3d940
Compare
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.
3d3d940
to
0caded8
Compare
Requires mysociety/fixmystreet#2212 in core.
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 thearia-describedby
attribute on the textarea so it doesn’t end up referencing a hint element that doesn’t exist.I needed this for mysociety/collideoscope#28, because the existing
[% DEFAULT form_detail_placeholder = … %]
block gave me no easy way to prevent the hint being shown.How it looks:
When no custom
form_detail_placeholder
is defined in the cobrand, eg:When a custom
form_detail_placeholder
is defined in the cobrand, eg:NEW: When
form_detail_placeholder
is set to a falsey value, eg: