diff options
author | Dave Arter <davea@mysociety.org> | 2018-04-09 12:57:11 +0100 |
---|---|---|
committer | Dave Arter <davea@mysociety.org> | 2018-04-10 10:42:34 +0100 |
commit | 9f964227db5bf38118de5f4d541d2e36ef967a5d (patch) | |
tree | e6e93740f1c178d81aae5841b8d2dc1886f6074e | |
parent | 02c0c00c261f3374c2f3a177ffce5fa2cf52f56d (diff) |
[BANES/Buckinghamshire] Make it simpler to override report form elements
5 files changed, 17 insertions, 135 deletions
diff --git a/templates/web/base/report/new/form_report.html b/templates/web/base/report/new/form_report.html index 9fce25248..3c7012348 100644 --- a/templates/web/base/report/new/form_report.html +++ b/templates/web/base/report/new/form_report.html @@ -6,6 +6,7 @@ [% PROCESS "report/new/category_wrapper.html" %] [% TRY %][% PROCESS 'report/new/after_category.html' %][% CATCH file %][% END %] +[% TRY %][% PROCESS 'report/new/_form_labels.html' %][% CATCH file %][% END %] <h2 class="form-section-heading">[% loc( 'Public details' ) %]</h2> <div class="form-section-description" id="js-councils_text"> @@ -16,11 +17,13 @@ [% END %] </div> - <label for="form_title">[% loc('Summarise the problem') %]</label> + [% DEFAULT form_title = loc('Summarise the problem') %] + <label for="form_title">[% form_title %]</label> [% IF field_errors.title %] <p class='form-error'>[% field_errors.title %]</p> [% END %] - <input class="form-control" type="text" value="[% report.title | html %]" name="title" id="form_title" placeholder="[% loc('10 inch pothole on Example St, near post box') %]" required> + [% DEFAULT form_title_placeholder = loc('10 inch pothole on Example St, near post box') %] + <input class="form-control" type="text" value="[% report.title | html %]" name="title" id="form_title" placeholder="[% form_title_placeholder %]" required> [% TRY %][% PROCESS 'report/new/after_title.html' %][% CATCH file %][% END %] @@ -55,7 +58,8 @@ [% 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" placeholder="[% loc('This pothole has been here for two months and…') %]" required>[% report.detail | html %]</textarea> + [% DEFAULT form_detail_placeholder = loc('This pothole has been here for two months and…') %] + <textarea class="form-control" rows="7" cols="26" name="detail" id="form_detail" placeholder="[% form_detail_placeholder %]" required>[% report.detail | html %]</textarea> [% TRY %][% PROCESS 'report/new/inline-tips.html' %][% CATCH file %][% END %] diff --git a/templates/web/bathnes/report/new/_form_labels.html b/templates/web/bathnes/report/new/_form_labels.html new file mode 100644 index 000000000..de2e1dfb3 --- /dev/null +++ b/templates/web/bathnes/report/new/_form_labels.html @@ -0,0 +1,5 @@ +[% +SET form_title = 'Summarise the problem and location'; +SET form_title_placeholder = 'e.g. ‘pothole on Example St, near post box’'; +SET form_detail_placeholder = 'e.g. ‘This pothole has been here for two months and…’'; +%]
\ No newline at end of file diff --git a/templates/web/bathnes/report/new/form_report.html b/templates/web/bathnes/report/new/form_report.html deleted file mode 100644 index 495b465ab..000000000 --- a/templates/web/bathnes/report/new/form_report.html +++ /dev/null @@ -1,66 +0,0 @@ -[% INCLUDE 'report/new/form_heading.html' %] - -[% IF field_errors.bodies %] - <p class='form-error'>[% field_errors.bodies %]</p> -[% END %] - -[% PROCESS "report/new/category_wrapper.html" %] -[% TRY %][% PROCESS 'report/new/after_category.html' %][% CATCH file %][% END %] - - <h2 class="form-section-heading">[% loc( 'Public details' ) %]</h2> - <div class="form-section-description" id="js-councils_text"> - [% IF js %] - [% PROCESS 'report/new/councils_text_all.html' list_of_names = [ loc('the local council') ] %] - [% ELSE %] - [% PROCESS 'report/new/councils_text.html' %] - [% END %] - </div> - - <label for="form_title">[% loc('Summarise the problem and location') %]</label> -[% IF field_errors.title %] - <p class='form-error'>[% field_errors.title %]</p> -[% END %] - <input class="form-control" type="text" value="[% report.title | html %]" name="title" id="form_title" placeholder="e.g. ‘pothole on Example St, near post box’" required> - -[% TRY %][% PROCESS 'report/new/after_title.html' %][% CATCH file %][% END %] - -[% IF c.cobrand.allow_photo_upload %] - <input type="hidden" name="upload_fileid" value="[% upload_fileid %]"> - <label for="form_photo"> - <span data-singular="[% loc('Photo') %]" data-plural="[% loc('Photos') %]">[% loc('Photo') %]</span> - </label> - - [% IF field_errors.photo %] - <p class='form-error'>[% field_errors.photo %]</p> - [% END %] - - <div id="form_photos"> - [% IF upload_fileid %] - <p>[% loc('You have already attached photos to this report. Note that you can attach a maximum of 3 to this report (if you try to upload more, the oldest will be removed).') %]</p> - [% FOREACH id IN upload_fileid.split(',') %] - <img align="right" src="/photo/temp.[% id %]" alt=""> - [% END %] - [% END %] - <input type="file" name="photo1" id="form_photo"> - <label for="form_photo2">[% loc('Photo') %]</label> - <input type="file" name="photo2" id="form_photo2"> - <label for="form_photo3">[% loc('Photo') %]</label> - <input type="file" name="photo3" id="form_photo3"> - </div> -[% END %] - -[% TRY %][% PROCESS 'report/new/after_photo.html' %][% CATCH file %][% END %] - - <label for="form_detail">[% loc('Explain what’s wrong') %]</label> -[% 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" placeholder="e.g. ‘This pothole has been here for two months and…’" required>[% report.detail | html %]</textarea> - -[% TRY %][% PROCESS 'report/new/inline-tips.html' %][% CATCH file %][% END %] - -[% IF partial_token %] - <input type="hidden" name="partial" value="[% partial_token.token %]"> -[% END %] - - <input type="hidden" name="submit_problem" value="1"> diff --git a/templates/web/buckinghamshire/report/new/_form_labels.html b/templates/web/buckinghamshire/report/new/_form_labels.html new file mode 100644 index 000000000..1fb1201ce --- /dev/null +++ b/templates/web/buckinghamshire/report/new/_form_labels.html @@ -0,0 +1,5 @@ +[% +SET form_title = 'Location of the problem'; +SET form_title_placeholder = 'Exact location, including any landmarks'; +SET form_detail_placeholder = 'Dimensions, landmarks, direction of travel etc.'; +%]
\ No newline at end of file diff --git a/templates/web/buckinghamshire/report/new/form_report.html b/templates/web/buckinghamshire/report/new/form_report.html deleted file mode 100644 index 729b0e807..000000000 --- a/templates/web/buckinghamshire/report/new/form_report.html +++ /dev/null @@ -1,66 +0,0 @@ -[% INCLUDE 'report/new/form_heading.html' %] - -[% IF field_errors.bodies %] - <p class='form-error'>[% field_errors.bodies %]</p> -[% END %] - -[% PROCESS "report/new/category_wrapper.html" %] -[% TRY %][% PROCESS 'report/new/after_category.html' %][% CATCH file %][% END %] - - <h2 class="form-section-heading">[% loc( 'Public details' ) %]</h2> - <div class="form-section-description" id="js-councils_text"> - [% IF js %] - [% PROCESS 'report/new/councils_text_all.html' list_of_names = [ loc('the local council') ] %] - [% ELSE %] - [% PROCESS 'report/new/councils_text.html' %] - [% END %] - </div> - - <label for="form_title">[% loc('Location of the problem') %]</label> -[% IF field_errors.title %] - <p class='form-error'>[% field_errors.title %]</p> -[% END %] - <input class="form-control" type="text" value="[% report.title | html %]" name="title" id="form_title" placeholder="Exact location, including any landmarks" required> - -[% TRY %][% PROCESS 'report/new/after_title.html' %][% CATCH file %][% END %] - -[% IF c.cobrand.allow_photo_upload %] - <input type="hidden" name="upload_fileid" value="[% upload_fileid %]"> - <label for="form_photo"> - <span data-singular="[% loc('Photo') %]" data-plural="[% loc('Photos') %]">[% loc('Photo') %]</span> - </label> - - [% IF field_errors.photo %] - <p class='form-error'>[% field_errors.photo %]</p> - [% END %] - - <div id="form_photos"> - [% IF upload_fileid %] - <p>[% loc('You have already attached photos to this report. Note that you can attach a maximum of 3 to this report (if you try to upload more, the oldest will be removed).') %]</p> - [% FOREACH id IN upload_fileid.split(',') %] - <img align="right" src="/photo/temp.[% id %]" alt=""> - [% END %] - [% END %] - <input type="file" name="photo1" id="form_photo"> - <label for="form_photo2">[% loc('Photo') %]</label> - <input type="file" name="photo2" id="form_photo2"> - <label for="form_photo3">[% loc('Photo') %]</label> - <input type="file" name="photo3" id="form_photo3"> - </div> -[% END %] - -[% TRY %][% PROCESS 'report/new/after_photo.html' %][% CATCH file %][% END %] - - <label for="form_detail">[% loc('Explain what’s wrong') %]</label> -[% 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" placeholder="Dimensions, landmarks, direction of travel etc." required>[% report.detail | html %]</textarea> - -[% TRY %][% PROCESS 'report/new/inline-tips.html' %][% CATCH file %][% END %] - -[% IF partial_token %] - <input type="hidden" name="partial" value="[% partial_token.token %]"> -[% END %] - - <input type="hidden" name="submit_problem" value="1"> |