diff options
Diffstat (limited to 'templates/web/base')
74 files changed, 1032 insertions, 238 deletions
diff --git a/templates/web/base/admin/bodies/_category_field.html b/templates/web/base/admin/bodies/_category_field.html index 8c5a1c352..c45cc5524 100644 --- a/templates/web/base/admin/bodies/_category_field.html +++ b/templates/web/base/admin/bodies/_category_field.html @@ -9,7 +9,10 @@ </div> <p> - <strong>[% loc('Category') %] </strong><input type="text" class="form-control" name="category" size="30" value="[% contact.category | html %]" required> + <label for="category">[% loc('Category') %]</label> + <input type="text" class="form-control" id="category" name="category" + size="30" value="[% contact.category %]" + [% contact.category_uneditable ? 'readonly' : 'required' %]> </p> [% IF contact.in_storage %] diff --git a/templates/web/base/admin/bodies/contact-form.html b/templates/web/base/admin/bodies/contact-form.html index 35fab4541..fab485a2f 100644 --- a/templates/web/base/admin/bodies/contact-form.html +++ b/templates/web/base/admin/bodies/contact-form.html @@ -63,13 +63,45 @@ <textarea id="disabled-message" name="disable_message" class="form-control">[% contact.disable_form_field.description %]</textarea> </p> - [% IF body.send_method == 'Open311' %] + <p class="form-check"> + <input type="checkbox" name="updates_disallowed" value="1" id="updates_disallowed" [% ' checked' IF contact.get_extra_metadata('updates_disallowed') %]> + <label for="updates_disallowed">[% loc('Disable updates on reports in this category') %]</label> + [% TRY %][% INCLUDE admin/bodies/_updates_disallowed_hint.html %][% CATCH file %][% END %] + </p> + + <p class="form-check"> + <input type="checkbox" name="reopening_disallowed" value="1" id="reopening_disallowed" [% ' checked' IF contact.get_extra_metadata('reopening_disallowed') %]> + <label for="reopening_disallowed">[% loc('Disable reopening of reports in this category') %]</label> + <span class='form-hint'>[% loc('Use this where you do not want problem reporters to be able to reopen their fixed or closed reports when leaving an update.') %]</span> + </p> + + [% IF body.get_cobrand_handler.anonymous_account %] + <p class="form-check"> + <input type="checkbox" name="anonymous_allowed" value="1" id="anonymous_allowed" [% ' checked' IF contact.get_extra_metadata('anonymous_allowed') %]> + <label for="anonymous_allowed">[% loc('Allow anonymous reports on this category') %]</label> + </p> + [% END %] + + [% IF contact.sent_by_open311 %] <p class="form-check"> <input type="checkbox" name="open311_protect" value="1" id="open311_protect"[% ' checked' IF contact.get_extra_metadata('open311_protect') %]> <label for="open311_protect">[% loc("Protect this category's name and group(s) from Open311 changes") %]</label> </p> [% END %] + [% IF c.user.is_superuser %] + <p class="form-check"> + <input type="checkbox" name="hardcoded" value="1" id="hardcoded"[% ' checked' IF contact.get_extra_metadata('hardcoded') %]> + <label for="hardcoded">[% loc("Protect this category from being re-named") %]</label> + </p> + [% END %] + + <p class="form-check"> + <input type="checkbox" name="assigned_users_only" value="1" id="assigned_users_only" [% ' checked' IF contact.extra.assigned_users_only %]> + <label for="assigned_users_only">[% loc('Frontend staff access only to users assigned to this category') %]</label> + <span class='form-hint'>[% loc('Use this if you wish only users assigned to this category to see staff-related features (such as the inspector form) in the front end.') %]</span> + </p> + [% IF body.can_be_devolved %] <div class="admin-hint"> <p> @@ -114,6 +146,7 @@ <h2>[% loc('Extra data:') %] </h2> <dl> [% FOR pair IN contact.get_extra_metadata %] + [% NEXT IF pair.key == 'group' OR pair.key == 'assigned_users_only' %] <dt>[% pair.key %]</dt> <dd>[% pair.value OR '<em>-</em>' %]</dd> [% END %] </dl> diff --git a/templates/web/base/admin/extra-metadata-item.html b/templates/web/base/admin/extra-metadata-item.html index 66cb6f79c..aa563e851 100644 --- a/templates/web/base/admin/extra-metadata-item.html +++ b/templates/web/base/admin/extra-metadata-item.html @@ -67,6 +67,7 @@ DEFAULT behaviour = 'question'; <label for="metadata-[% i %]-datatype">[% loc('Display as') %]</label> <select class="form-control" name="metadata[[% i %]].datatype" id="metadata-[% i %]-datatype"> <option value="string" data-hide="#metadata-[% i %]-options-group" [% 'selected' IF meta.datatype == 'string' %]>[% loc('Text field') %]</option> + <option value="text" data-hide="#metadata-[% i %]-options-group" [% 'selected' IF meta.datatype == 'text' %]>[% loc('Textarea') %]</option> <option value="singlevaluelist" data-show="#metadata-[% i %]-options-group" [% 'selected' IF meta.datatype == 'singlevaluelist' %]>[% loc('Drop-down list') %]</option> </select> </div> diff --git a/templates/web/base/admin/report-category.html b/templates/web/base/admin/report-category.html index e76106f7f..b15f57e71 100644 --- a/templates/web/base/admin/report-category.html +++ b/templates/web/base/admin/report-category.html @@ -1,12 +1,10 @@ -[%~ IF NOT select_name %] - [%~ select_name = 'category' %] -[%~ END %] [%~ BLOCK category_option ~%] <option value="[% cat.category | html %]"[% ' selected' IF problem.category == cat.category %]>[% cat.category_display | html %]</option> [%~ END ~%] -<select class="form-control" name="[% select_name %]" id="[% select_name %]"> - [% IF NOT problem.category OR NOT categories_hash.${problem.category} %] +<select class="form-control" name="category" id="category"> + [% SET category_safe = mark_safe(problem.category) ~%] + [% IF NOT problem.category OR NOT categories_hash.$category_safe %] <optgroup label="[% loc('Existing category') %]"> <option selected value="[% problem.category | html %]">[% (problem.category_display OR '-') | html %]</option> </optgroup> diff --git a/templates/web/base/admin/reports/edit.html b/templates/web/base/admin/reports/edit.html index d2b866d01..6e7cff4cf 100644 --- a/templates/web/base/admin/reports/edit.html +++ b/templates/web/base/admin/reports/edit.html @@ -131,7 +131,20 @@ class="admin-offsite-link">[% problem.latitude %], [% problem.longitude %]</a> <li><label class="inline-text" for="category">[% loc('Category:') %]</label> [% INCLUDE 'admin/report-category.html' %] </li> -<li>[% loc('Extra data:') %] [% IF extra_fields.size %]<ul>[% FOREACH field IN extra_fields %]<li><strong>[% field.name %]</strong>: [% field.val %]</li>[% END %]</ul>[% ELSE %]No[% END %]</li> +<li>[% loc('Extra data:') ~%] + [%~ IF extra_fields.size ~%] + <ul> + [%~ FOREACH field IN extra_fields ~%] + <li><strong>[%~ field.name ~%]</strong>: [% IF field.val.0.defined ~%] + [%~ field.val.list.join(", ") ~%] + [%~ ELSE ~%] + [%~ field.val ~%] + [%~ END ~%] + </li> + [%~ END ~%] + </ul> + [%~ ELSE %] No[% END ~%] +</li> <li><label class="inline-text" for="anonymous">[% loc('Anonymous:') %]</label> <select class="form-control" name="anonymous" id="anonymous"> <option [% 'selected ' IF problem.anonymous %]value="1">[% loc('Yes') %]</option> diff --git a/templates/web/base/admin/templates/_external.html b/templates/web/base/admin/templates/_external.html new file mode 100644 index 000000000..d25d2b39c --- /dev/null +++ b/templates/web/base/admin/templates/_external.html @@ -0,0 +1,12 @@ +[% IF errors.external_status_code %] + <div class="form-error">[% errors.external_status_code %]</div> +[% END %] +<div class="admin-hint"> + <p> + [% loc('If you want to use this template to prefill the update field when a report’s <strong>external</strong> (e.g. Confirm) status code changes, enter the status code here.') %] + </p> +</div> +<p> + <label for="external_status_code">[% loc('External status code') %]</label> + <input type="text" id="external_status_code" name="external_status_code" class="form-control" size="30" value="[% rt.external_status_code | html %]"> +</p> diff --git a/templates/web/base/admin/templates/edit.html b/templates/web/base/admin/templates/edit.html index 7ce67f96f..f52c26b49 100644 --- a/templates/web/base/admin/templates/edit.html +++ b/templates/web/base/admin/templates/edit.html @@ -51,18 +51,7 @@ [% INCLUDE 'report/inspect/state_groups_select.html' current_state=rt.state include_empty=1 %] </p> - [% IF errors.external_status_code %] - <div class="form-error">[% errors.external_status_code %]</div> - [% END %] - <div class="admin-hint"> - <p> - [% loc('If you want to use this template to prefill the update field when a report’s <strong>external</strong> (e.g. Confirm) status code changes, enter the status code here.') %] - </p> - </div> - <p> - <label for="external_status_code">[% loc('External status code') %]</label> - <input type="text" name="external_status_code" class="form-control" size="30" value="[% rt.external_status_code | html %]"> - </p> + [% PROCESS 'admin/templates/_external.html' %] [% IF errors.auto_response %] <div class="form-error">[% errors.auto_response %]</div> diff --git a/templates/web/base/admin/triage/_inspect.html b/templates/web/base/admin/triage/_inspect.html index 926197ceb..bd76a47f7 100644 --- a/templates/web/base/admin/triage/_inspect.html +++ b/templates/web/base/admin/triage/_inspect.html @@ -24,7 +24,6 @@ </select> [% END %] -[% permissions = c.user.permissions(problem) %] [% second_column = BLOCK -%] <div id="side-inspect"> diff --git a/templates/web/base/admin/triage/_list-filters.html b/templates/web/base/admin/triage/_list-filters.html index dd3e17875..29f48f0bb 100644 --- a/templates/web/base/admin/triage/_list-filters.html +++ b/templates/web/base/admin/triage/_list-filters.html @@ -2,8 +2,9 @@ [% IF filter_categories.size %] <select class="form-control js-multiple" name="filter_category" id="filter_categories" multiple data-all="[% loc('Everything') %]"> [% FOR cat IN filter_categories %] - <option value="[% cat.category | html %]"[% ' selected' IF filter_category.${cat.category} %]> - [% cat.category_display | html %] + [%~ SET cat_safe = mark_safe(cat.category) %] + <option value="[% cat.category %]"[% ' selected' IF filter_category.$cat_safe %]> + [% cat.category_display %] [%~ IF cat.get_extra_metadata('help_text') %] ([% cat.get_extra_metadata('help_text') %])[% END ~%] </option> [% END %] diff --git a/templates/web/base/admin/users/_form_details.html b/templates/web/base/admin/users/_form_details.html new file mode 100644 index 000000000..78debca32 --- /dev/null +++ b/templates/web/base/admin/users/_form_details.html @@ -0,0 +1,33 @@ +<li> + <div class="admin-hint"> + <p> + [% loc( + "The user's <strong>name</strong> is displayed publicly on reports that have not been marked <em>anonymous</em>. + Names are not necessarily unique.") + %] + </p> + </div> + <label for="name">[% loc('Name:') %]</label> + <input type='text' class="form-control" name='name' id='name' value='[% user.name | html %]'> +</li> + +<li><label for="email">[% loc('Email:') %]</label> +<input type='text' class="form-control" id='email' name='email' value='[% user.email | html %]'> +[% IF user %] + <input class="btn" type="submit" name="send_login_email" value="[% loc('Send login email') %]"> +[% END %] +</li> + +<li><label class="inline-text" for="email_verified">[% loc('Email verified:') %]</label> +<input type="checkbox" id="email_verified" name="email_verified" value="1" [% user.email_verified ? ' checked' : '' %]> + +<li><label for="phone">[% loc('Phone:') %]</label> +<input type='text' class="form-control" id='phone' name='phone' value='[% user.phone | html %]'></li> +<li><label class="inline-text" for="phone_verified">[% loc('Phone verified:') %]</label> +<input type="checkbox" id="phone_verified" name="phone_verified" value="1" [% user.phone_verified ? ' checked' : '' %]> + +[% IF username_in_abuse %] +<li> + <p class="error">[% loc('User in abuse table') %] <input name="unban" type="submit" value="[% loc('Unban') %]"></p> +</li> +[% END %] diff --git a/templates/web/base/admin/users/form.html b/templates/web/base/admin/users/form.html index 495da8648..c782b7172 100644 --- a/templates/web/base/admin/users/form.html +++ b/templates/web/base/admin/users/form.html @@ -7,38 +7,9 @@ [% INCLUDE 'errors.html' errors = field_errors.values %] <ul class="no-bullets"> - <li> - <div class="admin-hint"> - <p> - [% loc( - "The user's <strong>name</strong> is displayed publicly on reports that have not been marked <em>anonymous</em>. - Names are not necessarily unique.") - %] - </p> - </div> - <label for="name">[% loc('Name:') %]</label> - <input type='text' class="form-control" name='name' id='name' value='[% user.name | html %]'> - </li> - <li><label for="email">[% loc('Email:') %]</label> - <input type='text' class="form-control" id='email' name='email' value='[% user.email | html %]'> - [% IF user %] - <input class="btn" type="submit" name="send_login_email" value="[% loc('Send login email') %]"> - [% END %] - </li> - <li><label class="inline-text" for="email_verified">[% loc('Email verified:') %]</label> - <input type="checkbox" id="email_verified" name="email_verified" value="1" [% user.email_verified ? ' checked' : '' %]> - <li><label for="phone">[% loc('Phone:') %]</label> - <input type='text' class="form-control" id='phone' name='phone' value='[% user.phone | html %]'></li> - <li><label class="inline-text" for="phone_verified">[% loc('Phone verified:') %]</label> - <input type="checkbox" id="phone_verified" name="phone_verified" value="1" [% user.phone_verified ? ' checked' : '' %]> + [% PROCESS 'admin/users/_form_details.html' %] - [% IF username_in_abuse %] - <li> - <p class="error">[% loc('User in abuse table') %] <input name="unban" type="submit" value="[% loc('Unban') %]"></p> - </li> - [% END %] - - [% IF c.user.is_superuser || c.cobrand.moniker == 'zurich' %] + [% IF c.user.is_superuser %] <li> <div class="admin-hint"> <p> @@ -72,7 +43,7 @@ </li> [% END %] - [% IF areas AND c.cobrand.moniker != 'zurich' %] + [% IF areas %] <li> <div class="admin-hint"> <p> @@ -94,14 +65,28 @@ </li> [% END %] - [% IF contacts AND c.cobrand.moniker != 'zurich'%] + [% IF contacts %] <li class="js-user-categories"> [% INCLUDE 'admin/category-checkboxes.html' hint=loc("Authorised staff users can be associated with the categories in which they operate.") %] </li> [% END %] - [% IF c.cobrand.moniker != 'zurich' %] + [% IF user.from_body %] + <li> + <div class="admin-hint"> + <p> + [% loc("This means the user will only see front end staff features (such as the inspector form) in their assigned categories.") %] + </p> + </div> + + <label> + [% loc('Assigned categories only') %]: + <input type="checkbox" id="assigned_categories_only" name="assigned_categories_only"[% user.extra.assigned_categories_only ? ' checked' : '' %]> + </label> + </li> + [% END %] + <li> <div class="admin-hint"> <p> @@ -182,7 +167,7 @@ </fieldset> </li> [% END %] - [% END %] + [% TRY %][% INCLUDE 'admin/users/form-extra-fields.html' %][% CATCH file %][% END %] </ul> <p> diff --git a/templates/web/base/admin/users/index.html b/templates/web/base/admin/users/index.html index e573c10fe..dbd32f3a1 100644 --- a/templates/web/base/admin/users/index.html +++ b/templates/web/base/admin/users/index.html @@ -80,6 +80,12 @@ [% END %] </select> [% END %] +<p> + <label for="remove-staff"> + [% loc("Remove staff permissions") %] + <input type="checkbox" id="remove-staff" name="remove-staff" value="remove-staff"> + </label> +</p> <p><input class="btn" type="submit" value="[% loc('Save changes') %]"> </form> diff --git a/templates/web/base/admin/users/log.html b/templates/web/base/admin/users/log.html index 4b426e0ba..5c3f36321 100644 --- a/templates/web/base/admin/users/log.html +++ b/templates/web/base/admin/users/log.html @@ -49,7 +49,7 @@ action_map = { [%- tprintf(loc('Problem %s created on behalf of %s'), mark_safe(report_link), item.obj.name) %], ‘[% item.obj.title | html %]’ [%~ CASE 'update' %] [% tprintf(loc("Update %s created for problem %d"), mark_safe(report_link), item.obj.problem_id) %] - [% item.obj.text | add_links | markup(item.obj.user) | html_para %] + [% item.obj.text | staff_html_markup(item.obj.extra) %] [%~ CASE 'shortlistAdded' %] [%- tprintf(loc('Problem %s added to shortlist'), mark_safe(report_link)) %] [%~ CASE 'shortlistRemoved' %] diff --git a/templates/web/base/alert/_list.html b/templates/web/base/alert/_list.html index 782989a5c..e6c5183e4 100644 --- a/templates/web/base/alert/_list.html +++ b/templates/web/base/alert/_list.html @@ -62,6 +62,7 @@ </div> [% END %] + [% PROCESS 'auth/form_extra.html' %] <div class="alerts__cta-box"> <h3>[% loc('Subscribe by email') %]</h3> diff --git a/templates/web/base/alert/updates.html b/templates/web/base/alert/updates.html index 0fbed2254..40380849f 100644 --- a/templates/web/base/alert/updates.html +++ b/templates/web/base/alert/updates.html @@ -15,6 +15,8 @@ </p> <form action="/alert/subscribe" method="post"> + [% PROCESS 'auth/form_extra.html' %] + <fieldset> [% IF c.user_exists %] [% IF c.user.has_permission_to("contribute_as_another_user", problem.bodies_str_ids) %] diff --git a/templates/web/base/around/postcode_form.html b/templates/web/base/around/postcode_form.html index 60fa1a703..d682bbdca 100644 --- a/templates/web/base/around/postcode_form.html +++ b/templates/web/base/around/postcode_form.html @@ -35,7 +35,7 @@ %] <a href="[% c.uri_for('/around', link_params) | html %]" id="geolocate_link">… [% loc('or use my location') %]</a> - [% UNLESS possible_location_matches %] + [% UNLESS possible_location_matches OR location_error_pc_lookup %] [% INCLUDE 'around/_postcode_form_post.html' %] [% END %] </div> diff --git a/templates/web/base/auth/form_extra.html b/templates/web/base/auth/form_extra.html new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/templates/web/base/auth/form_extra.html diff --git a/templates/web/base/auth/generate_token.html b/templates/web/base/auth/generate_token.html index 9152d0cb3..7654e11eb 100644 --- a/templates/web/base/auth/generate_token.html +++ b/templates/web/base/auth/generate_token.html @@ -9,7 +9,11 @@ INCLUDE 'header.html', title = loc('Security'), bodyclass = 'fullwidthpage' <p> <strong>[% loc('Token') %]:</strong> - <span>[% existing_token | html %]</span> + <span>[% token_generated %]</span> + </p> + + <p> + [% loc('This will be the only time this token is visible, so please make a note of it now.') %] </p> <p><a href="/my">[% loc('Your account') %]</a></p> @@ -67,13 +71,6 @@ INCLUDE 'header.html', title = loc('Security'), bodyclass = 'fullwidthpage' <input type="hidden" name="token" value="[% csrf_token %]"> - [% IF existing_token %] - <p> - <strong>[% loc('Current token:') %]</strong> - <span>[% existing_token | html %]</span> - </p> - [% END %] - <p> <input name="generate_token" type="submit" class="btn" value="[% existing_token ? loc('Replace token') : loc('Generate token') %]"> </p> diff --git a/templates/web/base/common_scripts.html b/templates/web/base/common_scripts.html index b8c4db343..32ec9b00f 100644 --- a/templates/web/base/common_scripts.html +++ b/templates/web/base/common_scripts.html @@ -13,6 +13,7 @@ IF bodyclass.match('frontpage'); scripts.push( version('/js/front.js'), version('/js/geolocation.js'), + version('/js/loading-attribute-polyfill.js'), ); ELSIF bodyclass.match('alertpage'); scripts.push( @@ -64,6 +65,7 @@ IF bodyclass.match('mappage'); version('/cobrands/fixmystreet/map.js'), version('/vendor/dropzone.min.js'), version('/vendor/fancybox/jquery.fancybox-1.3.4.pack.js'), + version('/js/loading-attribute-polyfill.js'), ); ELSE; scripts.push( diff --git a/templates/web/base/contact/enquiry/index.html b/templates/web/base/contact/enquiry/index.html index c88ca221e..b19c5181b 100644 --- a/templates/web/base/contact/enquiry/index.html +++ b/templates/web/base/contact/enquiry/index.html @@ -16,10 +16,10 @@ <input type="text" class="form-control required" name="name" id="form_name" value="[% ( form_name OR c.user.name ) | html %]" size="30"> <label for="form_email">[% loc('Your email') %]</label> - [% IF field_errors.username %] - <div class="form-error">[% field_errors.username %]</div> + [% IF field_errors.username_register %] + <div class="form-error">[% field_errors.username_register %]</div> [% END %] - <input type="text" class="form-control required email" name="username" id="form_email" [% "disabled" IF c.user.email %] value="[% ( email OR c.user.email ) | html %]" size="30"> + <input type="text" class="form-control required email" name="username_register" id="form_email" [% "disabled" IF c.user.email %] value="[% ( email OR c.user.email ) | html %]" size="30"> <div class="form-group"> <label for="form_phone">[% loc('Your phone number') %]</label> @@ -34,6 +34,7 @@ <select class="form-control required" name="category" id="category"> <option value="">[% loc('-- Please select --') %]</option> [% FOREACH contact IN contacts %] + [% NEXT IF contact.get_extra_field(, 'code', '_fms_disable_').disable_form == 'true' %] <option value="[% contact.category | html %]" [% "selected" IF report.category == contact.category %]>[% contact.category | html %]</option> [% END %] </select> diff --git a/templates/web/base/contact/index.html b/templates/web/base/contact/index.html index 05a24160f..4e65ce674 100644 --- a/templates/web/base/contact/index.html +++ b/templates/web/base/contact/index.html @@ -63,7 +63,7 @@ [% IF problem.anonymous %] [% tprintf( loc('Reported anonymously at %s'), prettify_dt( problem.confirmed ) ) %] [% ELSE %] - [% tprintf( loc('Reported by %s at %s'), problem.user.name, prettify_dt( problem.confirmed ) ) | html %] + [% tprintf( loc('Reported by %s at %s'), problem.name, prettify_dt( problem.confirmed ) ) | html %] [% END %] </cite> diff --git a/templates/web/base/dashboard/heatmap-list.html b/templates/web/base/dashboard/heatmap-list.html index d736a11f4..53720af35 100644 --- a/templates/web/base/dashboard/heatmap-list.html +++ b/templates/web/base/dashboard/heatmap-list.html @@ -1,12 +1,12 @@ -<h3>Five newest reports</h3> +<h3>[% loc('Five newest reports') %]</h3> [% INCLUDE column problems = five_newest %] -<h3>Five most recent commented reports<br> -<small>Not from yourself/backend</small> +<h3>[% loc('Five most recent commented reports') %]<br> +<small>[% loc('Not from yourself/backend') %]</small> </h3> [% INCLUDE column problems = five_commented %] -<h3>Ten least recently updated open reports</h3> +<h3>[% loc('Ten least recently updated open reports') %]</h3> [% INCLUDE column problems = ten_oldest %] [% BLOCK column %] diff --git a/templates/web/base/dashboard/heatmap.html b/templates/web/base/dashboard/heatmap.html index ca4d02926..42c601a4c 100755 --- a/templates/web/base/dashboard/heatmap.html +++ b/templates/web/base/dashboard/heatmap.html @@ -26,11 +26,11 @@ <input type="hidden" id="body" name="body" value="[% body.id | html %]"> <p class="report-list-filters" style='padding-top:0.25em'> - From <input type="date" id="start_date" name="start_date" class="form-control" value="[% start_date | html %]"> - To <input type="date" id="end_date" name="end_date" class="form-control" value="[% end_date | html %]"> + [% loc('From') %] <input type="date" id="start_date" name="start_date" class="form-control" value="[% start_date | html %]"> + [% loc('To') %] <input type="date" id="end_date" name="end_date" class="form-control" value="[% end_date | html %]"> <p class="report-list-filters"> -In wards <select class="form-control js-multiple" multiple id="wards" name="wards"> +[% loc('In wards') %] <select class="form-control js-multiple" multiple id="wards" name="wards"> [% FOR child IN children.values.sort('name') %] [% SET aid = child.id %] <option value="[% child.name | html %]"[% ' selected' IF ward_hash.$aid %]>[% child.name %]</option> @@ -41,9 +41,9 @@ In wards <select class="form-control js-multiple" multiple id="wards" name="ward <p class="segmented-control segmented-control--radio"> <input type="radio" name="heatmap" id="heatmap_yes" value="Yes" checked> - <label class="btn" for="heatmap_yes">Heatmap</label> + <label class="btn" for="heatmap_yes">[% loc('Heatmap') %]</label> <input type="radio" name="heatmap" id="heatmap_no" value="No"> - <label class="btn" for="heatmap_no">Pin map</label> + <label class="btn" for="heatmap_no">[% loc('Pin map') %]</label> </p> <div id="js-reports-list"> diff --git a/templates/web/base/dashboard/index.html b/templates/web/base/dashboard/index.html index 5ac414bde..6a3075c61 100644 --- a/templates/web/base/dashboard/index.html +++ b/templates/web/base/dashboard/index.html @@ -105,8 +105,8 @@ <li>[% INCLUDE gb new_gb='device+site' text=loc('Device and Site') %]</li> <li class="pull-right"> <span>[% loc('Export as CSV') %]:</span> - <a href="[% c.uri_with({ export => 1 }) %]">[% loc('Reports') %]</a> - <a href="[% c.uri_with({ export => 1, updates => 1 }) %]">[% loc('Updates') %]</a> + <a href="[% c.uri_with({ export => 2 }) %]">[% loc('Reports') %]</a> + <a href="[% c.uri_with({ export => 2, updates => 1 }) %]">[% loc('Updates') %]</a> </li> </ul> diff --git a/templates/web/base/dashboard/status.html b/templates/web/base/dashboard/status.html new file mode 100644 index 000000000..734bb9ad3 --- /dev/null +++ b/templates/web/base/dashboard/status.html @@ -0,0 +1,68 @@ +[% USE date %] +[% IF NOT c.get_param('ajax') %] +[% INCLUDE 'header.html' + title = loc('Dashboard') + robots = 'noindex, nofollow' + bodyclass = 'fullwidthpage'; +%] + +[% IF body %] +<hgroup> + [% tprintf(loc('<h2>Reports, Statistics and Actions for</h2> <h1>%s</h1>'), body_name) %] +</hgroup> +[% ELSE %] +<h1>[% loc('Summary statistics') %]</h1> +[% END %] + +<p><a href="[% c.uri_for_action('dashboard/index') %]">[% loc('Back') %]</a></p> + +[% END %] + +<table id="overview" cellpadding=8 cellspacing=0> + <tr> + <th scope="col">[% loc('Created') %]</th> + <th scope="col">[% loc('CSV File') %]</th> + </tr> + [% in_progress = 0 %] + [% FOR file IN rows %] + <tr> + <td>[% date.format(file.ctime, format = '%Y-%m-%d %H:%M') %]</td> + <td> + [% IF file.finished %] + <a href="/dashboard/csv/[% file.name %]">[% file.name %]</a> + <br>[% file.size div 1024 %]KB + [% ELSE %] + [% file.name %] + <br>[% file.size div 1024 %]KB + <i>[% loc('In progress') %]</i> + [% in_progress = 1 %] + [% END %] + </td> + </tr> + [% END %] +</table> + +[% IF NOT c.get_param('ajax') %] + +[% IF in_progress %] +<script nonce="[% csp_nonce %]"> +(function() { + var wait = 1; + setTimeout(function refresh() { + $('#overview').load('[% c.uri_for_action('dashboard/status') %]?ajax=1', function() { + if ($(this).html().indexOf('<i>[% loc('In progress', "JS") %]</i>') === -1) { + return; + } + wait += 1; + if (wait > 10) { + wait = 10; + } + setTimeout(refresh, wait * 1000); + }); + }, wait * 1000); +})(); +</script> +[% END %] + +[% INCLUDE 'footer.html' %] +[% END %] diff --git a/templates/web/base/js/translation_strings.html b/templates/web/base/js/translation_strings.html index 2eb652c1f..4c4902fc5 100644 --- a/templates/web/base/js/translation_strings.html +++ b/templates/web/base/js/translation_strings.html @@ -64,6 +64,8 @@ fixmystreet.password_minimum_length = [% c.cobrand.password_minimum_length %]; map_map: '[% loc('Map', "JS") %]', map_satellite: '[% loc('Satellite', "JS") %]', + map_aerial: '[% loc('Aerial', "JS") %]', + map_roads: '[% loc('Roads', "JS") %]', expand_map: '[% loc('Expand map', "JS") %]', collapse_map: '[% loc('Collapse map', "JS") %]', diff --git a/templates/web/base/maps/fms.html b/templates/web/base/maps/fms.html index 286ecc8ff..2df3bd11b 100644 --- a/templates/web/base/maps/fms.html +++ b/templates/web/base/maps/fms.html @@ -1,3 +1,9 @@ -[% -map_html = INCLUDE maps/openlayers.html include_key = 1 -%] +[% map_sub_links = BLOCK %] + [% IF c.req.params.aerial %] + <a id="map_layer_toggle" href="[% c.uri_with( { aerial => 0 } ) %]">[% loc('Roads') %]</a> + [% ELSE %] + <a id="map_layer_toggle" href="[% c.uri_with( { aerial => 1 } ) %]">[% loc('Aerial') %]</a> + [% END %] +[% END %] + +[% map_html = INCLUDE maps/openlayers.html include_key = 1 %] diff --git a/templates/web/base/maps/google-ol.html b/templates/web/base/maps/google-ol.html index 47c940129..9103ba42b 100644 --- a/templates/web/base/maps/google-ol.html +++ b/templates/web/base/maps/google-ol.html @@ -2,11 +2,4 @@ <a class="hidden-nojs" id="map_layer_toggle" href="">[% loc('Satellite') %]</a> [% END %] -[% map_html = BLOCK %] -[% INCLUDE maps/openlayers.html %] -[% UNLESS around_page %] -<p class="sub-map-links" id="sub_map_links"> - [% map_sub_links | safe %] -</p> -[% END %] -[% END %] +[% map_html = INCLUDE maps/openlayers.html %] diff --git a/templates/web/base/maps/openlayers.html b/templates/web/base/maps/openlayers.html index f4c78767c..60d7acfde 100644 --- a/templates/web/base/maps/openlayers.html +++ b/templates/web/base/maps/openlayers.html @@ -46,3 +46,9 @@ <div class="olControlAttribution" style="position: absolute;">[% map.copyright | safe %]</div> [% END %] <img id="loading-indicator" class="hidden" aria-hidden="true" src="/i/loading.svg" alt="Loading..."> + +[% IF NOT around_page AND map_sub_links %] +<p class="sub-map-links" id="sub_map_links"> + [% map_sub_links | safe %] +</p> +[% END %] diff --git a/templates/web/base/maps/osm.html b/templates/web/base/maps/osm.html index 70d05929f..560055f3b 100644 --- a/templates/web/base/maps/osm.html +++ b/templates/web/base/maps/osm.html @@ -1,3 +1,11 @@ +[% map_sub_links = BLOCK %][% IF c.config.BING_MAPS_API_KEY %] + [% IF c.req.params.aerial %] + <a id="map_layer_toggle" href="[% c.uri_with( { aerial => 0 } ) %]">[% loc('Roads') %]</a> + [% ELSE %] + <a id="map_layer_toggle" href="[% c.uri_with( { aerial => 1 } ) %]">[% loc('Aerial') %]</a> + [% END %] +[% END %][% END %] + [% map.copyright = ''; # This is handled with OpenLayers.Control.Attribution map_html = INCLUDE maps/openlayers.html diff --git a/templates/web/base/my/anonymize.html b/templates/web/base/my/anonymize.html index e82a03ce0..1159d4ebc 100644 --- a/templates/web/base/my/anonymize.html +++ b/templates/web/base/my/anonymize.html @@ -10,7 +10,7 @@ <input class="btn-primary" type="submit" name="hide" value="[% loc('Hide my name in this update') %]"> [% ELSIF problem %] [% IF problem.bodies_str %] - <p>[% tprintf(loc('Your name has already been sent to %s, but we can hide it on this page:'), problem.body(c)) %]</p> + <p>[% tprintf(loc('Your name has already been sent to %s, but we can hide it on this page:'), problem.body) %]</p> [% END %] <input type="hidden" name="problem" value="[% problem.id %]"> <input class="btn-primary" type="submit" name="hide" value="[% loc('Hide my name on this report') %]"> diff --git a/templates/web/base/my/my.html b/templates/web/base/my/my.html index 04c5b6941..d78461cb5 100644 --- a/templates/web/base/my/my.html +++ b/templates/web/base/my/my.html @@ -113,7 +113,7 @@ li .my-account-buttons a { <div class="item-list__update-wrap"> [% INCLUDE 'report/photo.html' object=u %] <div class="item-list__update-text"> - [% u.text | add_links | html_para %] + [% u.text | staff_html_markup(u.extra) %] <p class="meta-2"> [% tprintf( loc("Added %s"), prettify_dt( u.confirmed, 'date' ) ) %] diff --git a/templates/web/base/offline/service_worker.html b/templates/web/base/offline/service_worker.html index 3c480f9b1..71e5c282a 100644 --- a/templates/web/base/offline/service_worker.html +++ b/templates/web/base/offline/service_worker.html @@ -52,15 +52,30 @@ addEventListener('fetch', fetchEvent => { } catch { fetchEvent.waitUntil(async function() { - var text = await request.text(); - let formData = new URLSearchParams(text); - formData.set('save', 2); - formData.set('saved_at', Math.floor(+new Date() / 1000)); - formData = formData.toString(); + var request_buffer = await request.arrayBuffer(); + var headers = request.headers; + let formData = {}; + formData.contentType = headers.get('Content-Type'); + let boundary_re = /.*boundary=(.*)/; + let bound = formData.contentType.match(boundary_re); + + let saved = '--' + bound[1] + "\r\nContent-Disposition: form-data; name=\"saved_at\"\r\n\r\n" + Math.floor(+new Date() / 1000) + "\r\n"; + var savedBuffer = new ArrayBuffer(saved.length); + var bufView = new Uint8Array(savedBuffer); + for (var i=0; i<saved.length; i++) { + bufView[i] = saved.charCodeAt(i); + } + + var tmp = new Uint8Array(request_buffer.byteLength + savedBuffer.byteLength); + tmp.set(new Uint8Array(request_buffer), 0); + tmp.set(bufView, 0); + tmp.set(new Uint8Array(request_buffer), savedBuffer.byteLength); + + formData.text = tmp.buffer; var data = await idbKeyval.get('offlineData') || { cachedReports: {}, forms: [] }; var forms = data.forms; - if (!forms.length || formData != forms[forms.length - 1][1]) { + if (!forms.length || tmp.toString() != new Uint8Array(forms[forms.length - 1][1].text).toString()) { forms.push([request.url, formData]); } return idbKeyval.set('offlineData', data); diff --git a/templates/web/base/questionnaire/index.html b/templates/web/base/questionnaire/index.html index 36123013f..416200d25 100644 --- a/templates/web/base/questionnaire/index.html +++ b/templates/web/base/questionnaire/index.html @@ -49,13 +49,13 @@ <h3 class="questionnaire-report-reminder__report-title"> <a href="/report/[% problem.id %]">[% problem.title | html %]</a> </h3> - <p class="questionnaire-report-reminder__report-meta">[% problem.meta_line(c) | html %]</p> + <p class="questionnaire-report-reminder__report-meta">[% problem.meta_line(c.user) | html %]</p> [% IF updates.size %] <p class="questionnaire-report-reminder__last-update-header"> <strong>[% loc('Last update') %]</strong> <a href="/report/[% problem.id %]">[% loc('Show all updates') %]</a> </p> - <p class="questionnaire-report-reminder__last-update">“[% updates.last.text | add_links %]”</p> + <p class="questionnaire-report-reminder__last-update">“[% updates.last.text | staff_html_markup(updates.last.extra) %]”</p> [% END %] </div> @@ -74,30 +74,7 @@ <p><textarea class="form-control" name="update" rows="7" cols="30">[% update | html %]</textarea></p> -[% 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 update. Note that you can attach a maximum of 3 to this update (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 %] +[% INCLUDE report/form/photo_upload.html %] <div class="js-another-questionnaire"> <p>4. [% loc('Would you like to receive another questionnaire in 4 weeks, reminding you to check the status?') %]</p> diff --git a/templates/web/base/report/_council_sent_info.html b/templates/web/base/report/_council_sent_info.html index dca74f994..ae0f80a2e 100644 --- a/templates/web/base/report/_council_sent_info.html +++ b/templates/web/base/report/_council_sent_info.html @@ -1,4 +1,4 @@ -[% SET duration_clause = problem.duration_string(c) %] +[% SET duration_clause = problem.duration_string %] [% IF duration_clause || problem.can_display_external_id %] <p class="council_sent_info"> [%- IF problem.can_display_external_id %] diff --git a/templates/web/base/report/_inspect.html b/templates/web/base/report/_inspect.html index 771942b16..1877640b4 100644 --- a/templates/web/base/report/_inspect.html +++ b/templates/web/base/report/_inspect.html @@ -1,4 +1,3 @@ -[% permissions = c.user.permissions(problem) %] [% second_column = BLOCK -%] <div id="side-inspect"> @@ -6,7 +5,7 @@ [% INCLUDE 'errors.html' %] - <form name="report_inspect_form" id="report_inspect_form" method="post" action="[% c.uri_for( '/report', problem.id ) %]" class="validate"> + <form name="report_inspect_form" id="report_inspect_form" method="post" action="[% c.uri_for( '/report', problem.id ) %]" class="validate"[% IF c.cobrand.allow_photo_upload %] enctype="multipart/form-data"[% END %]> [% INCLUDE 'report/inspect/information.html' %] @@ -19,13 +18,14 @@ [% FOREACH category IN category_options %] [% cat_name = category.category; + cat_safe = mark_safe(cat_name); cat_prefix = cat_name | lower | replace('[^a-z]', ''); cat_prefix = "category_" _ cat_prefix _ "_" %] <p data-category="[% cat_name | html %]" [%~ IF cat_name != problem.category %] class="hidden"[% END %] - data-priorities='[% priorities_by_category.$cat_name | html %]' - data-templates='[% templates_by_category.$cat_name | html %]'> - [% INCLUDE 'report/new/category_extras_fields.html' metas=category_extras.$cat_name hide_notices=1 show_hidden=1 %] + data-priorities='[% priorities_by_category.$cat_safe | html %]' + data-templates='[% templates_by_category.$cat_safe | html %]'> + [% INCLUDE 'report/new/category_extras_fields.html' metas=category_extras.$cat_safe hide_notices=1 show_hidden=1 %] </p> [% END %] @@ -34,6 +34,7 @@ <label for="state">[% loc('State') %]</label> [% INCLUDE 'report/inspect/state_groups_select.html' %] </p> + [% TRY %][% INCLUDE 'report/inspect/_raise_defect.html' %][% CATCH file %][% END %] <div id="js-duplicate-reports" class="[% "hidden" UNLESS problem.duplicate_of %]"> <input type="hidden" name="duplicate_of" value="[% problem.duplicate_of.id %]"> <p class="[% "hidden" UNLESS problem.duplicate_of %]"><strong>[% loc('Duplicate of') %]</strong></p> diff --git a/templates/web/base/report/_item.html b/templates/web/base/report/_item.html index 4d74b3be9..f25d5d2a1 100644 --- a/templates/web/base/report/_item.html +++ b/templates/web/base/report/_item.html @@ -2,7 +2,18 @@ [% PROCESS 'admin/report_blocks.html' ~%] [% END ~%] -[% IF c.user.has_permission_to('planned_reports', problem.bodies_str_ids) OR c.user.is_planned_report(problem) ~%] +[% + +SET relevant_staff = 1; +SET category_safe = mark_safe(problem.category); +SET is_user_category = user_categories.$category_safe; +IF (assigned_users_only.$category_safe OR assigned_categories_only) AND NOT is_user_category; + SET relevant_staff = 0; +END; + +~%] + +[% IF relevant_staff AND (c.user.has_permission_to('planned_reports', problem.bodies_str_ids) OR c.user.is_planned_report(problem)) ~%] [% item_extra_class = "item-list__item--indented" ~%] [% item_action = BLOCK ~%] <input type="submit" value="1" @@ -40,7 +51,9 @@ [% PROCESS 'report/_item_photo_title.html' ~%] [% CATCH file ~%] [% IF problem.photo %] - <img class="img" height="60" width="90" src="[% problem.photos.first.url_fp %]" alt=""> + <noscript class="loading-lazy"> + <img loading="lazy" class="img" height="60" width="90" src="[% problem.photos.first.url_fp %]" alt=""> + </noscript> [% END %] [% TRY %] [% PROCESS 'report/_item_heading.html' %] @@ -49,12 +62,12 @@ [% END %] [% END ~%] - [% IF c.user.has_permission_to('report_inspect', problem.bodies_str_ids) %] + [% IF relevant_staff AND c.user.has_permission_to('report_inspect', problem.bodies_str_ids) %] <div class="item-list__description">[% problem.detail | html %]</div> [% END %] <small>[% PROCESS 'report/_item_small.html' %]</small> - [% IF c.user.has_permission_to('report_inspect', problem.bodies_str_ids) %] + [% IF relevant_staff AND c.user.has_permission_to('report_inspect', problem.bodies_str_ids) %] <div class="item-list__item__metadata"> <div> <h4>[% loc('Report ID:') %]</h4> @@ -83,10 +96,6 @@ <p>[% problem.response_priority.name OR '-' %]</p> </div> <div> - <h4>[% loc('Traffic management required?') %]</h4> - <p>[% problem.get_extra_metadata('traffic_information') %]</p> - </div> - <div> <h4>[% loc('Extra details') %]</h4> <p>[% problem.get_extra_metadata('detailed_information') | html %]</p> </div> diff --git a/templates/web/base/report/_item_expandable.html b/templates/web/base/report/_item_expandable.html index fad935407..ab363482a 100644 --- a/templates/web/base/report/_item_expandable.html +++ b/templates/web/base/report/_item_expandable.html @@ -18,7 +18,9 @@ [% IF problem.photo %] <a href="[% c.cobrand.relative_url_for_report( problem ) %][% problem.url %]" class="item-list__item--expandable__hide-when-expanded"> - <img class="img" height="60" width="90" src="[% problem.photos.first.url_fp %]" alt=""> + <noscript class="loading-lazy"> + <img loading="lazy" class="img" height="60" width="90" src="[% problem.photos.first.url_fp %]" alt=""> + </noscript> </a> [% END %] diff --git a/templates/web/base/report/_report_meta_info.html b/templates/web/base/report/_report_meta_info.html index e2a6412a3..73e897e34 100644 --- a/templates/web/base/report/_report_meta_info.html +++ b/templates/web/base/report/_report_meta_info.html @@ -1,4 +1,4 @@ -[% problem.meta_line(c) | html %] +[% problem.meta_line(c.user) | html %] [% IF c.user_exists AND c.user.id == problem.user_id AND !problem.anonymous %] <small>(<a href="/my/anonymize?problem=[% problem.id | uri %]" class="js-hide-name">[% loc('Hide your name?') %]</a>)</small> [% END %] diff --git a/templates/web/base/report/_update_state.html b/templates/web/base/report/_update_state.html index 0274d7695..d484dcb05 100644 --- a/templates/web/base/report/_update_state.html +++ b/templates/web/base/report/_update_state.html @@ -1,10 +1,10 @@ [% # Small chance of duplicates in the case of fixed - user followed by fixed - council %] -[% SET update_state = update.problem_state %] -[% IF ( update_state AND update_state != global.last_state AND NOT (global.last_state == "" AND update.problem_state == 'confirmed') ) +[% SET update_state = update.problem_state_processed %] +[% IF ( update_state AND update_state != global.last_state AND NOT (global.last_state == "" AND update.problem_state_processed == 'confirmed') ) OR update.mark_fixed OR update.mark_open %] - <p class="meta-2">[% loc('State changed to:') %] [% update.problem_state_display(c) %]</p> + <p class="meta-2">[% loc('State changed to:') %] [% update.problem_state_display %]</p> [%- global.last_state = update_state %] [%- IF update_state == "" AND update.mark_fixed %][% global.last_state = 'fixed - user' %][% END %] [%- IF update_state == "" AND update.mark_open %][% global.last_state = 'confirmed' %][% END %] @@ -12,7 +12,7 @@ <p class="meta-2"> [% INCLUDE meta_line %] - [% IF c.user_exists AND c.user.id == update.user_id AND !update.anonymous %] + [% IF c.user_exists AND c.user.id == update.user_id AND !update.anonymous AND NOT (c.user.from_body OR c.user.is_superuser) %] <small>(<a href="/my/anonymize?update=[% update.id | uri %]" class="js-hide-name">[% loc('Hide your name?') %]</a>)</small> [% END %] [% mlog = update.latest_moderation_log_entry(); IF mlog %] diff --git a/templates/web/base/report/display.html b/templates/web/base/report/display.html index f08df931d..af2282f66 100644 --- a/templates/web/base/report/display.html +++ b/templates/web/base/report/display.html @@ -38,9 +38,6 @@ [% SET shown_form = 1 %] [% END %] -[% IF c.user_exists %] - [% DEFAULT permissions = c.user.permissions(problem) %] -[%- END %] [% INCLUDE 'report/_main.html' %] [% IF problem.duplicate_of %] diff --git a/templates/web/base/report/display_tools.html b/templates/web/base/report/display_tools.html index e16ffcb2c..532c78ec8 100644 --- a/templates/web/base/report/display_tools.html +++ b/templates/web/base/report/display_tools.html @@ -1,7 +1,7 @@ <div class="shadow-wrap"> <ul id="key-tools"> [% IF c.user_exists OR NOT problem.non_public %] - [% IF c.user_exists AND c.cobrand.users_can_hide AND c.user.belongs_to_body( problem.bodies_str ) %] + [% IF c.cobrand.users_can_hide AND relevant_staff_user %] <li><form method="post" action="/report/[% problem.id %]/delete" id="remove-from-site-form"> <input type="hidden" name="token" value="[% csrf_token %]"> <button type="submit" id="key-tool-report-abuse" class="abuse" data-confirm="[% loc('Are you sure?') %]" name="remove_from_site">[% loc('Remove from site') %]</button> @@ -44,9 +44,10 @@ <img src="/i/feed.png" width="16" height="16" title="[% loc('RSS feed') %]" alt="[% loc('RSS feed of updates to this problem' ) %]" border="0"> </a> [% loc('Receive email when updates are left on this problem.' ) %]</p> + [% PROCESS 'auth/form_extra.html' %] <fieldset> [% IF c.user_exists %] - [% IF c.user.has_permission_to("contribute_as_another_user", problem.bodies_str_ids) %] + [% IF permissions.contribute_as_another_user %] <label for="alert_rznvy">[% loc('Email') %]</label> <div class="form-txt-submit-box"> <input type="email" class="form-control" name="rznvy" id="alert_rznvy" value="[% email | html %]" size="30"> diff --git a/templates/web/base/report/form/photo_upload.html b/templates/web/base/report/form/photo_upload.html new file mode 100644 index 000000000..960141210 --- /dev/null +++ b/templates/web/base/report/form/photo_upload.html @@ -0,0 +1,24 @@ +[% 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 update. Note that you can attach a maximum of 3 to this update (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 %] diff --git a/templates/web/base/report/form/submit.html b/templates/web/base/report/form/submit.html new file mode 100644 index 000000000..950bed965 --- /dev/null +++ b/templates/web/base/report/form/submit.html @@ -0,0 +1,2 @@ +<input class="desk-only btn btn--primary btn--block btn--final js-submit_register" type="submit" name="submit_register" value="[% loc('Submit') %]"> +<input class="mob-only btn btn--primary btn--block btn--final js-submit_register" type="submit" name="submit_register_mobile" value="[% loc('Submit') %]"> diff --git a/templates/web/base/report/form/user_loggedout_by_email.html b/templates/web/base/report/form/user_loggedout_by_email.html index 33526cc46..3446fd767 100644 --- a/templates/web/base/report/form/user_loggedout_by_email.html +++ b/templates/web/base/report/form/user_loggedout_by_email.html @@ -7,15 +7,13 @@ [% INCLUDE 'report/form/user_name.html' %] [% INCLUDE 'report/_show_name_label.html' %] - [% IF type != 'update' %] - [% IF NOT c.cobrand.call_hook('disable_phone_number_entry') AND NOT c.config.SMS_AUTHENTICATION %] - <div id="js-hide-if-username-phone"> - <label for="form_phone">[% loc('Phone number (optional)') %]</label> - [% IF field_errors.phone %] - <p class='form-error'>[% field_errors.phone %]</p> - [% END %] - <input class="form-control" type="text" value="[% phone | html %]" name="phone" id="form_phone"> - </div> + [% IF type != 'update' AND NOT c.config.SMS_AUTHENTICATION %] + [% UNLESS c.cobrand.call_hook('disable_phone_number_entry') %] + <label for="form_phone">[% loc('Phone number (optional)') %]</label> + [% IF field_errors.phone %] + <p class='form-error'>[% field_errors.phone %]</p> + [% END %] + <input class="form-control" type="text" value="[% phone | html %]" name="phone" id="form_phone"> [% END %] [% END %] @@ -25,19 +23,44 @@ </div> [% END %] - [% PROCESS 'report/form/user_loggedout_email.html' name='username_register' %] + [% IF type != 'update' AND c.config.SMS_AUTHENTICATION AND NOT c.cobrand.call_hook('disable_phone_number_entry') %] - [% IF type != 'update' AND c.config.SMS_AUTHENTICATION %] - [% UNLESS c.cobrand.call_hook('disable_phone_number_entry') %] - <div id="js-hide-if-username-phone" class="hidden-js"> - <label for="form_phone">[% loc('Phone number (optional)') %]</label> - <input class="form-control" type="text" value="[% phone | html %]" name="phone" id="form_phone"> - </div> + <fieldset> + <legend>How would you like to receive updates?</legend> + + [% IF field_errors.update_method %] + <p class='form-error'>[% field_errors.update_method %]</p> [% END %] - <div id="js-hide-if-username-email" class="hidden-js"> - <label for="form_email">[% loc('Email address (optional)') %]</label> - <input class="form-control" type="text" value="[% email | html %]" name="email" id="form_email"> - </div> + <p class="segmented-control segmented-control--radio"> + <input required type="radio" name="update_method" id="update_method_email" + data-show="#js-optional-phone" data-hide="#js-optional-email" + value="email"[% ' checked' IF update_method == 'email' %]> + <label class="btn" for="update_method_email">[% loc('Email') %]</label> + <input type="radio" name="update_method" id="update_method_phone" + data-show="#js-optional-email" data-hide="#js-optional-phone" + value="phone"[% ' checked' IF update_method == 'phone' %]> + <label class="btn" for="update_method_phone">[% loc('Phone') %]</label> + </p> + </fieldset> + + [% IF field_errors.username_register %] + <p class='form-error'>[% field_errors.username_register %]</p> + [% END %] + + <label for="form_email">[% loc('Your email') %]<span class="hidden-js" id="js-optional-email"> [% loc('(optional)') %]</span></label> + [% IF field_errors.email %] + <p class='form-error'>[% field_errors.email %]</p> + [% END %] + <input type="email" name="email" id="form_email" value="[% email %]" class="form-control"> + + <label for="form_phone">[% loc('Phone number') %]<span class="hidden-js" id="js-optional-phone"> [% loc('(optional)') %]</span></label> + [% IF field_errors.phone %] + <p class='form-error'>[% field_errors.phone %]</p> + [% END %] + <input class="form-control" type="text" value="[% phone %]" name="phone" id="form_phone"> + + [% ELSE %] + [% PROCESS 'report/form/user_loggedout_email.html' name='username_register' %] [% END %] [% IF type == 'update' %] @@ -62,7 +85,9 @@ <input class="form-control js-password-validate" type="password" name="password_register" id="password_register" aria-describedby="password_register_hint" value=""> - <input class="btn btn--primary btn--block btn--final js-submit_register" type="submit" name="submit_register" value="[% loc('Submit') %]"> + [% PROCESS 'auth/form_extra.html' %] + + [% PROCESS 'report/form/submit.html' %] </div> <!-- /user_loggedout_by_email.html --> diff --git a/templates/web/base/report/form/user_loggedout_email.html b/templates/web/base/report/form/user_loggedout_email.html index 9f631987b..db3604d54 100644 --- a/templates/web/base/report/form/user_loggedout_email.html +++ b/templates/web/base/report/form/user_loggedout_email.html @@ -2,18 +2,17 @@ [% IF c.config.SMS_AUTHENTICATION %] [% SET username_label = loc('Your email or mobile') %] [% SET username_type = 'text' %] - [% SET username_value = object.user.username %] [% ELSE %] [% SET username_label = loc('Your email') %] [% SET username_type = 'email' %] - [% SET username_value = object.user.email %] [% END %] +[% SET username_field = (name == 'username_sign_in') ? 'username' : name ~%] <label for="form_[% name %]">[% username_label %]</label> -[% IF field_errors.username %] - <p class='form-error'>[% field_errors.username %]</p> +[% IF field_errors.$name %] + <p class='form-error'>[% field_errors.$name %]</p> [% END %] -<input type="[% username_type %]" name="username" id="form_[% name %]" - value="[% username_value | html %]" +<input type="[% username_type %]" name="[% username_field %]" id="form_[% name %]" + value="[% c.get_param(username_field) %]" class="form-control required"> <!-- /user_loggedout_email.html --> diff --git a/templates/web/base/report/inspect/extra_details.html b/templates/web/base/report/inspect/extra_details.html index 7777e9a78..621ae3688 100644 --- a/templates/web/base/report/inspect/extra_details.html +++ b/templates/web/base/report/inspect/extra_details.html @@ -3,21 +3,11 @@ <select name="priority" id="problem_priority" class="form-control"> <option value="" [% 'selected' UNLESS problem.response_priority_id OR has_default_priority %]>-</option> [% FOREACH priority IN problem.response_priorities %] - <option value="[% priority.id %]" [% 'selected' IF ( problem.response_priority_id == priority.id ) OR priority.is_default %][% 'disabled' IF priority.deleted %]>[% priority.name | html %]</option> + <option value="[% priority.id %]" [% 'selected' IF problem.response_priority_id == priority.id OR (NOT problem.response_priority_id AND priority.is_default) %]>[% priority.name | html %]</option> [% END %] </select> </p> [% IF permissions.report_inspect %] - <p> - <label for="traffic_information">[% loc('Traffic management required?') %]</label> - [% traffic_info = problem.get_extra_metadata('traffic_information') %] - <select id="traffic_information" name="traffic_information" class="form-control"> - <option value=""[% ' selected' IF NOT traffic_info %]>-</option> - [% FOREACH option IN problem.traffic_management_options %] - <option value='[% option %]'[% ' selected' IF traffic_info == option %]>[% option %]</option> - [% END %] - </select> - </p> [% INCLUDE 'report/inspect/_extra_details_field.html' %] [% END %] diff --git a/templates/web/base/report/inspect/information.html b/templates/web/base/report/inspect/information.html index b81b37543..edebc4a0c 100644 --- a/templates/web/base/report/inspect/information.html +++ b/templates/web/base/report/inspect/information.html @@ -6,7 +6,7 @@ <p> <strong>[% loc('Report ID:') %]</strong> <span class="js-report-id">[% problem.id %]</span> - [% IF c.user_exists AND c.cobrand.admin_allow_user(c.user) AND c.user.has_permission_to('report_edit', problem.bodies_str_ids) %] + [% IF c.user_exists AND c.cobrand.admin_allow_user(c.user) AND permissions.report_edit %] (<a href="[% c.uri_for_action( 'admin/reports/edit', [ problem.id ] ) %]">[% loc('admin') %]</a>) [% END %] </p> @@ -53,4 +53,13 @@ </p> [% END %] [% END %] + + [% IF permissions.report_edit_category OR permissions.report_inspect %] + <!-- These fields are for the asset display code to use --> + <input type="hidden" name="inspect_category_group" id="inspect_category_group" value=""> + <input type="hidden" name="inspect_form_category" id="inspect_form_category" value=""> + <p> + <a href="#" class="btn btn--block btn--change-asset">[% loc('Change asset') %]</a> + </p> + [% END %] </div> diff --git a/templates/web/base/report/inspect/public_update.html b/templates/web/base/report/inspect/public_update.html index be07d7b89..31940b6ee 100644 --- a/templates/web/base/report/inspect/public_update.html +++ b/templates/web/base/report/inspect/public_update.html @@ -7,8 +7,11 @@ [% loc('Save with a public update') %] </label> </p> + <div id="public_update_form_fields"> + [% INCLUDE report/form/photo_upload.html %] <p> <label for="public_update">[% loc('Public update:') %]</label> [% INCLUDE 'admin/response_templates_select.html' for='public_update' %] <textarea rows="2" name="public_update" id="public_update" class="form-control">[% public_update | html %]</textarea> </p> + </div> diff --git a/templates/web/base/report/new/_category_select.html b/templates/web/base/report/new/_category_select.html index d5aa9842b..61353647d 100644 --- a/templates/web/base/report/new/_category_select.html +++ b/templates/web/base/report/new/_category_select.html @@ -1,3 +1,4 @@ +[% SET filter_group = c.get_param('filter_group') %] [%~ IF category_groups.size ~%] [%~ FOREACH group IN category_groups ~%] [% IF group.name %]<optgroup label="[% group.name %]">[% END %] diff --git a/templates/web/base/report/new/category.html b/templates/web/base/report/new/category.html index b5bfd0251..37479e4a5 100644 --- a/templates/web/base/report/new/category.html +++ b/templates/web/base/report/new/category.html @@ -10,7 +10,7 @@ END [% IF category_options.size OR category_groups.size ~%] [%~ BLOCK category_option ~%] [% cat_lc = cat.category | lower =%] - <option value='[% cat.category | html %]'[% ' selected' IF report.category == cat.category || category_lc == cat_lc ~%] + <option value='[% cat.category | html %]'[% ' selected' IF ( report.category == cat.category || category_lc == cat_lc ) AND ( NOT filter_group OR filter_group == group.name ) ~%] >[% IF loop.first %][% cat.category_display %][% ELSE %][% cat.category_display | html %][% END %] [%~ IF cat.get_extra_metadata('help_text') %] ([% cat.get_extra_metadata('help_text') %])[% END ~%] </option> diff --git a/templates/web/base/report/new/category_extras_fields.html b/templates/web/base/report/new/category_extras_fields.html index 2c728481c..85373a0cf 100644 --- a/templates/web/base/report/new/category_extras_fields.html +++ b/templates/web/base/report/new/category_extras_fields.html @@ -21,6 +21,8 @@ <option value="[% option.key %]"[% IF option.key == report_meta.$x_meta_name.value %] selected[% END %]>[% option.name %]</option> [% END %] </select> + [% ELSIF meta.datatype == 'text' %] + <textarea class="form-control" name="[% cat_prefix %][% meta_name %]" id="[% cat_prefix %]form_[% meta_name %]"[% meta.required == 'true' ? ' required' : '' %]>[% report_meta.$x_meta_name.value %]</textarea> [% ELSE %] <input class="form-control" type="[% meta.fieldtype OR 'text' %]" value="[% report_meta.$x_meta_name.value | html %]" name="[% cat_prefix %][% meta_name %]" id="[% cat_prefix %]form_[% meta_name %]"[% meta.required == 'true' ? ' required' : '' %]> [% END %] diff --git a/templates/web/base/report/new/form_report.html b/templates/web/base/report/new/form_report.html index 3b28d4aa7..33dd5769e 100644 --- a/templates/web/base/report/new/form_report.html +++ b/templates/web/base/report/new/form_report.html @@ -89,5 +89,6 @@ <input type="hidden" id="single_body_only" name="single_body_only" value=""> <input type="hidden" id="do_not_send" name="do_not_send" value=""> <input type="hidden" name="submit_problem" value="1"> + <input type="hidden" id="form_service" name="service" value=""> </div> <!-- /report/new/form_report.html --> diff --git a/templates/web/base/report/new/form_user_loggedin.html b/templates/web/base/report/new/form_user_loggedin.html index 0d259e695..9215e7d59 100644 --- a/templates/web/base/report/new/form_user_loggedin.html +++ b/templates/web/base/report/new/form_user_loggedin.html @@ -37,6 +37,9 @@ [% IF c.user.email_verified %] <label for="form_username">[% loc('Email address') %]<span class="hidden"> [% loc('(optional)') %]</span></label> + [% IF field_errors.username_register %] + <p class='form-error'>[% field_errors.username_register %]</p> + [% END %] <input class="form-control" id="form_username" name="username" [%- IF NOT can_contribute_as_another_user -%] disabled @@ -64,11 +67,12 @@ [% IF c.user.has_permission_to("report_inspect", bodies_ids) OR c.user.has_permission_to("report_mark_private", bodies_ids) %] <div class="checkbox-group"> <input type="checkbox" name="non_public" id="form_non_public" value="1" - [%~ ' checked' IF report.non_public OR non_public_categories.$category %] - [%~ ' disabled' IF non_public_categories.$category %]> + [%~ SET category_safe = mark_safe(category) %] + [%~ ' checked' IF report.non_public OR non_public_categories.$category_safe %] + [%~ ' disabled' IF non_public_categories.$category_safe %]> <label class="inline" for="form_non_public">[% loc('Private') %] </label> </div> [% END %] -<input class="btn btn--primary btn--block btn--final js-submit_register" type="submit" name="submit_register" value="[% loc('Submit') %]"> +[% PROCESS 'report/form/submit.html' %] <!-- /report/new/form_user_loggedin.html --> diff --git a/templates/web/base/report/new/login_success_form.html b/templates/web/base/report/new/login_success_form.html index 32c414bda..7ef896910 100644 --- a/templates/web/base/report/new/login_success_form.html +++ b/templates/web/base/report/new/login_success_form.html @@ -14,6 +14,6 @@ [% PROCESS "report/form/user_loggedout.html" type='report' object=report %] [% END %] [% PROCESS 'report/new/form_report.html' %] - <input class="btn btn--primary btn--block btn--final js-submit_register" type="submit" name="submit_register" value="[% loc('Submit') %]"> + [% PROCESS 'report/form/submit.html' %] </div> </fieldset> diff --git a/templates/web/base/report/new/oauth_email_form.html b/templates/web/base/report/new/oauth_email_form.html index a0adbe563..126f93409 100644 --- a/templates/web/base/report/new/oauth_email_form.html +++ b/templates/web/base/report/new/oauth_email_form.html @@ -17,6 +17,6 @@ <input type="hidden" name="oauth_need_email" value="1"> [% PROCESS 'report/new/form_report.html' %] - <input class="btn btn--primary btn--block btn--final js-submit_register" type="submit" name="submit_register" value="[% loc('Submit') %]"> + [% PROCESS 'report/form/submit.html' %] </div> </fieldset> diff --git a/templates/web/base/report/update.html b/templates/web/base/report/update.html index ca9397bd4..3b1f092ef 100644 --- a/templates/web/base/report/update.html +++ b/templates/web/base/report/update.html @@ -35,7 +35,7 @@ [% INCLUDE 'report/photo.html' object=update %] <div class="item-list__update-text"> <div class="moderate-display"> - [% update.text | add_links | markup(update.user) | html_para %] + [% update.text | staff_html_markup(update.extra) %] </div> [% IF can_moderate %] <div class="moderate-edit"> @@ -43,7 +43,7 @@ <label><input type="checkbox" name="update_revert_text" class="revert-textarea"> [% loc('Revert to original') %]</label> [% END %] - <textarea class="form-control" name="update_text">[% update.text | add_links %]</textarea> + <textarea class="form-control" name="update_text">[% update.text %]</textarea> </div> [% END %] diff --git a/templates/web/base/report/update/form_state_checkbox.html b/templates/web/base/report/update/form_state_checkbox.html index 5316affb9..b65df72b7 100644 --- a/templates/web/base/report/update/form_state_checkbox.html +++ b/templates/web/base/report/update/form_state_checkbox.html @@ -1,5 +1,7 @@ [% IF (problem.is_fixed OR problem.is_closed) AND ((c.user_exists AND c.user.id == problem.user_id) OR alert_to_reporter) %] + [% RETURN IF c.cobrand.reopening_disallowed(problem) ~%] + <input type="checkbox" name="reopen" id="form_reopen" value="1"[% ' checked' IF (update.mark_open || c.req.params.reopen) %]> [% IF problem.is_closed %] <label class="inline" for="form_reopen">[% loc('This problem is still ongoing') %]</label> diff --git a/templates/web/base/report/update/form_update.html b/templates/web/base/report/update/form_update.html index ff4612840..7132331bc 100644 --- a/templates/web/base/report/update/form_update.html +++ b/templates/web/base/report/update/form_update.html @@ -1,35 +1,12 @@ <input type="hidden" name="submit_update" value="1"> <input type="hidden" name="id" value="[% problem.id | html %]"> -[% 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 update. Note that you can attach a maximum of 3 to this update (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 %] +[% INCLUDE report/form/photo_upload.html %] [% TRY %][% PROCESS 'report/update/before_update.html' %][% CATCH file %][% END %] <label for="form_update">[% loc( 'Update' ) %]</label> -[% IF c.user AND (c.user.is_superuser OR c.user.belongs_to_body(problem.bodies_str)) %] +[% IF relevant_staff_user %] [% INCLUDE 'admin/response_templates_select.html' for='form_update' %] [% END %] [% IF field_errors.update %] @@ -37,7 +14,7 @@ [% END %] <textarea rows="7" cols="30" name="update" class="form-control" id="form_update" required>[% update.text | html %]</textarea> -[% IF c.user AND (c.user.is_superuser OR c.user.belongs_to_body(problem.bodies_str)) %] +[% IF relevant_staff_user %] <label for="state">[% loc( 'State' ) %]</label> [% INCLUDE 'report/inspect/state_groups_select.html' %] [% ELSE %] diff --git a/templates/web/base/report/update/form_user_loggedin.html b/templates/web/base/report/update/form_user_loggedin.html index bec783bb4..02e7de51f 100644 --- a/templates/web/base/report/update/form_user_loggedin.html +++ b/templates/web/base/report/update/form_user_loggedin.html @@ -4,9 +4,9 @@ [% PROCESS 'user/_anonymity.html' anonymous = update.anonymous %] - [% can_contribute_as_another_user = c.user.has_permission_to("contribute_as_another_user", problem.bodies_str_ids) %] - [% can_contribute_as_anonymous_user = c.user.has_permission_to("contribute_as_anonymous_user", problem.bodies_str_ids) %] - [% can_contribute_as_body = c.user.from_body AND c.user.has_permission_to("contribute_as_body", problem.bodies_str_ids) %] + [% can_contribute_as_another_user = permissions.contribute_as_another_user %] + [% can_contribute_as_anonymous_user = permissions.contribute_as_anonymous_user %] + [% can_contribute_as_body = c.user.from_body AND permissions.contribute_as_body %] [% IF can_contribute_as_another_user OR can_contribute_as_body OR can_contribute_as_anonymous_user %] <label for="form_as">[% loc('Provide update as') %]</label> @@ -23,6 +23,9 @@ [% END %] </select> <label for="form_username">[% loc('Email address') %]</label> + [% IF field_errors.username_register %] + <p class='form-error'>[% field_errors.username_register %]</p> + [% END %] <input class="form-control" name="username" id="form_username" type="text" value="[% c.user.email | html %]"> [% END %] @@ -35,5 +38,7 @@ <label class="inline" for="form_add_alert">[% loc( 'Alert me to future updates' ) %]</label> </div> -<div class="clearfix"><input class="btn btn--primary btn--block btn--final js-submit_register" type="submit" name="submit_register" value="[% loc('Post') %]"></div> +<div class="clearfix"> + [% PROCESS 'report/form/submit.html' %] +</div> <!-- /report/update/form_user_loggedin.html --> diff --git a/templates/web/base/report/updates.html b/templates/web/base/report/updates.html index 93bae4d64..d65f1a287 100644 --- a/templates/web/base/report/updates.html +++ b/templates/web/base/report/updates.html @@ -27,6 +27,6 @@ [% RETURN %] [% END %] - [% update.meta_line(c) %] + [% update.meta_line(c.user) %] [% END %] diff --git a/templates/web/base/reports/_body_name.html b/templates/web/base/reports/_body_name.html new file mode 100644 index 000000000..42392e4cd --- /dev/null +++ b/templates/web/base/reports/_body_name.html @@ -0,0 +1 @@ +[% body.name %] diff --git a/templates/web/base/reports/_list-filters.html b/templates/web/base/reports/_list-filters.html index f5d1faa65..9973a0c1f 100644 --- a/templates/web/base/reports/_list-filters.html +++ b/templates/web/base/reports/_list-filters.html @@ -1,8 +1,10 @@ [% select_status = PROCESS 'reports/_list-filter-status.html' %] +[%# We want to only select things that match all filters, if filters are provided ~%] [% BLOCK category_options %] [% FOR cat IN categories %] - <option value="[% cat.category %]"[% ' selected' IF filter_category.${cat.category} OR ( filter_group AND ( cat.get_extra_metadata('group').grep(filter_group).size OR cat.category == filter_group ) ) %]> + [% SET cat_safe = mark_safe(cat.category) %] + <option value="[% cat.category %]"[% ' selected' IF ( filter_category.size OR filter_group ) AND ( NOT filter_category.size OR filter_category.$cat_safe ) AND ( NOT filter_group OR filter_group == group.name ) %]> [% cat.category_display %] [%~ IF cat.get_extra_metadata('help_text') %] ([% cat.get_extra_metadata('help_text') %])[% END ~%] </option> diff --git a/templates/web/base/reports/body.html b/templates/web/base/reports/body.html index d723a7992..d6f9558a3 100755 --- a/templates/web/base/reports/body.html +++ b/templates/web/base/reports/body.html @@ -1,9 +1,4 @@ -[% SET body_name = body.name %] -[% IF c.cobrand.moniker == 'hounslow' %] - [% SET body_name = 'Hounslow Highways' %] -[% ELSIF c.cobrand.moniker == 'isleofwight' %] - [% SET body_name = 'Island Roads' %] -[% END %] +[% body_name = PROCESS 'reports/_body_name.html' | trim %] [% IF ward %] [% name = "$ward.name, $body_name" diff --git a/templates/web/base/waste/bin_days.html b/templates/web/base/waste/bin_days.html new file mode 100644 index 000000000..54c21ae0c --- /dev/null +++ b/templates/web/base/waste/bin_days.html @@ -0,0 +1,105 @@ +[% SET bodyclass = 'waste' %] +[% USE date(format = '%A, %-d~~~ %B') %] + +[% INCLUDE header.html %] + +<h1 class="govuk-heading-xl">Your bin days</h1> + +<dl class="waste__address"> + <dt class="waste__address__title">Address</dt> + <dd class="waste__address__property">[% property.address %]</dd> +</dl> +<div class="waste__collections"> + <h2 class="govuk-heading-l govuk-!-margin-bottom-2">Your collections</h2> + <div class="govuk-grid-row"> + <div class="govuk-grid-column-two-thirds"> + +[% SET any_report_allowed = 0 ~%] +[% SET any_request_allowed = 0 ~%] +[% FOR unit IN service_data %] + +<h3 class="govuk-heading-m waste-service-name">[% unit.service_name %]</h3> +<div class="govuk-grid-row"> + [% SET image = c.cobrand.image_for_service(unit.service_id) ~%] + [% IF image %] + <div class="govuk-grid-column-one-quarter text-centered"> + <img src="[% image %].png" srcset="[% image %].png 1x, [% image %]@2x.png 2x" alt="" class="waste-service-image"> + </div> + <div class="govuk-grid-column-three-quarters"> + [% ELSE %] + <div class="govuk-grid-column-full"> + [% END %] + <dl class="govuk-summary-list"> + <div class="govuk-summary-list__row"> + <dt class="govuk-summary-list__key">Frequency</dt> + <dd class="govuk-summary-list__value">[% unit.schedule %]</dd> + </div> + <div class="govuk-summary-list__row"> + <dt class="govuk-summary-list__key">Next collection</dt> + <dd class="govuk-summary-list__value"> + [% IF unit.next %] + [% date.format(unit.next.date) | replace('~~~', unit.next.ordinal) %] + [% IF unit.next.changed %](this collection has been adjusted from its usual time)[% END %] + [% IF unit.next.state == 'In progress' %](in progress)[% END %] + [% ELSE %] + <i>None</i> + [% END %] + </dd> + </div> + [% IF unit.last %] + <div class="govuk-summary-list__row"> + <dt class="govuk-summary-list__key">Last collection</dt> + <dd class="govuk-summary-list__value"> + [% date.format(unit.last.date) | replace('~~~', unit.last.ordinal) %] + [% IF unit.last.changed %](this collection has been adjusted from its usual time)[% END %] + [% IF unit.last.state == 'In progress' %](in progress)[% END %] + [% IF unit.last.completed %](completed at [% date.format(unit.last.completed, '%l:%M%p') | lower ~%])[% END ~%] + [% IF unit.last.resolution %][% unit.last.resolution | staff_html_markup({ is_body_user => 1 }) %][% END ~%] + </dd> + </div> + [% END %] + </dl> + + <div class="waste-services-launch-panel" id="panel-[% unit.service_id %]"> + [% PROCESS waste/services.html %] + </div> + </div> +</div> +[% END %] +[% IF NOT service_data.size %] + <p>This property has no collections.</p> +[% END %] + + [% TRY %][% PROCESS waste/services_extra.html %][% CATCH file %][% END %] + + </div> + + [% IF service_data.size %] + <div class="govuk-grid-column-one-third"> + <div class="aside"> + <div class="aside-download"> + <h3>Download your collection schedule</h3> + <ul> + <li><a href="[% c.uri_for_action('waste/calendar', [ property.id ]) %]">Add to your calendar (.ics file)</a></li> + </ul> + </div> + [% IF any_report_allowed OR any_request_allowed %] + <div class="aside-services"> + <h3>More services</h3> + <ul> + [% IF any_report_allowed %] + <li><a href="[% c.uri_for_action('waste/report', [ property.id ]) %]">Report a missed collection</a></li> + [% END %] + [% IF any_request_allowed %] + <li><a href="[% c.uri_for_action('waste/request', [ property.id ]) %]">Request a new container</a></li> + [% END %] + </ul> + </div> + [% END %] + </div> + </div> + [% END %] + </div> +</div> +[% INCLUDE footer.html %] + diff --git a/templates/web/base/waste/confirmation.html b/templates/web/base/waste/confirmation.html new file mode 100644 index 000000000..9bacd9a2b --- /dev/null +++ b/templates/web/base/waste/confirmation.html @@ -0,0 +1,34 @@ +[% +IF first_page == 'request'; + title = 'Container request sent'; +ELSIF first_page == 'report'; + title = 'Missed collection reported'; +ELSE; + title = 'Enquiry submitted'; +END ~%] +[% INCLUDE header.html %] + +<div class="govuk-panel govuk-panel--confirmation"> + <h1 class="govuk-panel__title"> + [% title %] + </h1> + <div class="govuk-panel__body"> + <p>Your [% first_page %] has been sent; + [% IF data.email %] + a copy has been sent to your email address, [% data.email %]. + [% END %] + </p> + <p> + [% IF first_page == 'request' %] + Containers arrive typically within two weeks, but this may vary due to demand. + [% END %] + [% IF report_ids.size > 1 %] + Your reference numbers are: <strong>[% report_ids.join(', ') %]</strong>. + [% ELSE %] + Your reference number is <strong>[% report_ids.join(', ') %]</strong>. + [% END %] + </p> + </div> +</div> + +[% INCLUDE footer.html %] diff --git a/templates/web/base/waste/enquiry.html b/templates/web/base/waste/enquiry.html new file mode 100644 index 000000000..06c8f7f76 --- /dev/null +++ b/templates/web/base/waste/enquiry.html @@ -0,0 +1,33 @@ +[% SET bodyclass = 'waste' %] +[% INCLUDE header.html %] + +[% PROCESS 'waste/govuk/fields.html' %] +[% PROCESS title %] +[% SET service_id = c.req.params.service_id %] + +<dl class="waste__address"> + <dt class="waste__address__title">Address</dt> + <dd class="waste__address__property">[% property.address %]</dd> +</dl> + +<dl class="waste__address"> + <dt class="waste__address__title">Service</dt> + <dd class="waste__address__property">[% services.$service_id.service_name %]</dd> +</dl> + +<form method="get" action="[% c.uri_for_action('waste/enquiry', [ property.id ]) %]"> + <div class="govuk-form-group"> + [% PROCESS radio field = { + id = 'category', + html_name = 'category', + label = 'Category', + options = field_options + } + %] + </div> + <div class="govuk-form-group"><input type="submit" value="Continue" class="govuk-button"></div> + + <input type="hidden" name="service_id" value="[% service_id %]"> +</form> + +[% INCLUDE footer.html %] diff --git a/templates/web/base/waste/govuk/fields.html b/templates/web/base/waste/govuk/fields.html new file mode 100644 index 000000000..3be0194b0 --- /dev/null +++ b/templates/web/base/waste/govuk/fields.html @@ -0,0 +1,250 @@ +[% BLOCK form %] + [% FOR field IN form.sorted_fields %] + [% NEXT IF field.name == 'back' %] + [% SET error = field.errors.join(' ') ~%] + <div class="govuk-form-group[% IF error %] govuk-form-group--error[% END %][% ' hidden-js' IF field.get_tag('initial_hidden') %]" id="form-[% field.id %]-row"> + [% IF field.widget == 'Submit' %] + [% field.render_element | safe %] + [% ELSIF field.widget == 'Hidden' %] + [% PROCESS hidden %] + [% ELSIF field.widget == 'Text' %] + [% PROCESS text %] + [% ELSIF field.widget == 'Textarea' %] + [% PROCESS textarea %] + [% ELSIF field.widget == 'RadioGroup' %] + [% PROCESS radio %] + [% ELSIF field.widget == 'Select' %] + [% PROCESS select %] + [% ELSIF field.widget == 'CheckboxGroup' %] + [% PROCESS checkboxes options=field.options %] + [% ELSIF field.widget == 'Checkbox' %] + [% PROCESS checkboxes options=[{ value = 1, label = field.option_label }] %] + [% ELSIF field.type == 'DateTime' # Date %] + [% PROCESS date %] + [% ELSE %] + [% field.html_name %] [% field.widget %] NOT HANDLED + [% END %] + </div> + [% END %] +[% END %] + +[% BLOCK back %] + [% IF form.field('back').is_active %] + [% form.field('back').render_element | safe %] + [% END %] +[% END %] + +[% BLOCK errors %] + [% IF form.errors %] + <div class="govuk-error-summary" aria-labelledby="error-summary-title" role="alert" tabindex="-1" data-module="govuk-error-summary"> + <h2 class="govuk-error-summary__title" id="error-summary-title"> + There is a problem + </h2> + <div class="govuk-error-summary__body"> + <ul class="govuk-list govuk-error-summary__list"> + [% FOR error IN form.errors %] + <li> + <a href="#">[% error %]</a> + </li> + [% END %] + </ul> + </div> + </div> + [% END %] +[% END %] + +[% BLOCK title %] + <h1 class="govuk-heading-xl">[% title %]</h1> +[% END %] + +[% BLOCK checkboxes %] + <fieldset class="govuk-fieldset" aria-describedby="[% IF field.get_tag('hint') %][% field.id %]-hint [% END %][% IF error %][% field.id %]-error[% END %]"> +[% IF field.label %] + <legend class="govuk-fieldset__legend govuk-fieldset__legend--l"> + <h2 class="govuk-fieldset__heading"> + [% field.label %] + </h2> + </legend> +[% END %] +[% IF field.get_tag('hint') %] + <span id="[% field.id %]-hint" class="govuk-hint">[% field.get_tag('hint') %]</span> +[% END %] +[% IF error %] + <span id="[% field.id %]-error" class="govuk-error-message"> + <span class="govuk-visually-hidden">Error:</span> [% error %] + </span> +[% END %] + <div class="govuk-checkboxes"> + [% FOR item IN options %] + [% hint = item.hint OR item.get_tag('hint') %] + <div class="govuk-checkboxes__item"> + <input type="checkbox" class="govuk-checkboxes__input" id="[% field.id %]-[% loop.index %]" + name="[% field.html_name %]" value="[% item.value %]"[% ' aria-describedby="' _ field.id _ '-item-hint"' IF hint %] + [% 'data-toggle-visibility="#' _ field.get_tag('toggle') _ '"' IF field.get_tag('toggle') ~%] + [% 'checked' IF field.fif.grep(item.value).size %]> + <label class="govuk-label govuk-checkboxes__label" for="[% field.id %]-[% loop.index %]"> + [% item.label %] + </label> +[% IF hint %] + <span id="[% field.id %]-item-hint" class="govuk-hint govuk-checkboxes__hint"> + [% hint %] + </span> +[% END %] + </div> + [% END %] + </div> + </fieldset> +[% END %] + +[% BLOCK date %] + <fieldset class="govuk-fieldset" role="group" + [%~ IF field.get_tag('hint') OR error %] + aria-describedby="[% IF field.get_tag('hint') %][% field.id %]-hint [% END %][% IF error %][% id %]-error[% END %]" + [%~ END %]> + <legend class="govuk-fieldset__legend govuk-fieldset__legend--xl"> + <h2 class="govuk-fieldset__heading"> + [% field.label %] + </h2> + </legend> +[% IF field.get_tag('hint') %] + <span id="[% field.id %]-hint" class="govuk-hint"> + [% field.get_tag('hint') %] + </span> +[% END %] +[% IF error %] + <span id="[% field.id %]-error" class="govuk-error-message"> + <span class="govuk-visually-hidden">Error:</span> [% error %] + </span> +[% END %] + <div class="govuk-date-input" id="[% field.id %]"> + <div class="govuk-date-input__item"> + <div class="govuk-form-group"> + <label class="govuk-label govuk-date-input__label" for="[% field.id %].day"> + Day + </label> + <input class="govuk-input govuk-date-input__input govuk-input--width-2[% IF error %] govuk-input--error[% END %]" + id="[% field.id %].day" name="[% field.html_name %].day" type="text" value="[% field.fif.day %]" pattern="[0-9]*" inputmode="numeric"> + </div> + </div> + <div class="govuk-date-input__item"> + <div class="govuk-form-group"> + <label class="govuk-label govuk-date-input__label" for="[% field.id %].month"> + Month + </label> + <input class="govuk-input govuk-date-input__input govuk-input--width-2[% IF error %] govuk-input--error[% END %]" + id="[% field.id %].month" name="[% field.html_name %].month" type="text" value="[% field.fif.month %]" pattern="[0-9]*" inputmode="numeric"> + </div> + </div> + <div class="govuk-date-input__item"> + <div class="govuk-form-group"> + <label class="govuk-label govuk-date-input__label" for="[% field.id %].year"> + Year + </label> + <input class="govuk-input govuk-date-input__input govuk-input--width-4[% IF error %] govuk-input--error[% END %]" + id="[% field.id %].year" name="[% field.html_name %].year" type="text" value="[% field.fif.year %]" pattern="[0-9]*" inputmode="numeric"> + </div> + </div> + </div> + </fieldset> +[% END %] + +[% BLOCK radio %] + <fieldset class="govuk-fieldset" aria-describedby="[% IF field.get_tag('hint') %][% field.id %]-hint [% END %][% IF error %][% field.id %]-error[% END %]"> + <legend class="govuk-fieldset__legend govuk-fieldset__legend--l"> + <h2 class="govuk-fieldset__heading"> + [% field.label %] + </h2> + </legend> +[% IF field.get_tag('hint') %] + <span id="[% field.id %]-hint" class="govuk-hint">[% field.get_tag('hint') %]</span> +[% END %] +[% IF error %] + <span id="[% field.id %]-error" class="govuk-error-message"> + <span class="govuk-visually-hidden">Error:</span> [% error %] + </span> +[% END %] + <div class="govuk-radios[% IF field.get_tag('inline') %] govuk-radios--inline[% END %][% IF field.get_tag('small') %] govuk-radios--small[% END %]"> + [% FOR item IN field.options %] + [% IF loop.last AND field.get_tag('last_differs') %] + <div class="govuk-radios__divider">or</div> + [% END %] + <div class="govuk-radios__item"> + <input type="radio" class="govuk-radios__input" id="[% field.id %]-[% loop.index %]" + name="[% field.html_name %]" value="[% item.value %]" + [% 'checked' IF field.fif == item.value %]> + <label class="govuk-label govuk-radios__label" for="[% field.id %]-[% loop.index %]"> + [% item.label %] + </label> + </div> + [% END %] + </div> + </fieldset> +[% END %] + +[% BLOCK hidden %] + <input type="hidden" name="[% field.html_name %]" id="[% field.id %]" value="[% field.fif %]"> +[% END %] + +[% BLOCK text %] + <label class="govuk-label" for="[% field.id %]"> + [% field.label %] + </label> + [% IF field.get_tag('hint') %] + <span id="[% field.id %]-hint" class="govuk-hint"> + [% field.get_tag('hint') %] + </span> + [% END %] + [% IF error %] + <span id="[% field.id %]-error" class="govuk-error-message"> + <span class="govuk-visually-hidden">Error:</span> [% error %] + </span> + [% END %] + <input class="govuk-input[% IF error %] govuk-input--error[% END %]" id="[% field.id %]" name="[% field.html_name %]" type="text" + value="[% field.fif %]" + [%~ IF field.get_tag('autofocus') %] autofocus[% END ~%] + [%~ IF field.get_tag('hint') OR error %] + aria-describedby="[% IF field.get_tag('hint') %][% field.id %]-hint [% END %][% IF error %][% id %]-error[% END %]" + [%~ END %]> +[% END %] + +[% BLOCK textarea %] + <label class="govuk-label" for="[% field.id %]"> + [% field.label %] + </label> + [% IF field.get_tag('hint') %] + <span id="[% field.id %]-hint" class="govuk-hint"> + [% field.get_tag('hint') %] + </span> + [% END %] + [% IF error %] + <span id="[% field.id %]-error" class="govuk-error-message"> + <span class="govuk-visually-hidden">Error:</span> [% error %] + </span> + [% END %] + <textarea class="govuk-textarea[% IF error %] govuk-textarea--error[% END %]" id="[% field.id %]" + name="[% field.html_name %]" rows="5" + [%~ IF field.get_tag('hint') OR error %] + aria-describedby="[% IF field.get_tag('hint') %][% field.id %]-hint [% END %][% IF error %][% id %]-error[% END %]" + [%~ END %]>[% field.fif %]</textarea> +[% END %] + +[% BLOCK select %] + <label class="govuk-label" for="[% field.id %]"> + [% field.label %] + </label> + [% IF field.get_tag('hint') %] + <span id="[% field.id %]-hint" class="govuk-hint"> + [% field.get_tag('hint') %] + </span> + [% END %] + [% IF error %] + <span id="[% field.id %]-error" class="govuk-error-message"> + <span class="govuk-visually-hidden">Error:</span> [% error %] + </span> + [% END %] + <select class="govuk-select" id="[% field.id %]" name="[% field.html_name %]"> + [% FOR item IN field.options %] + <option value="[% item.value %]"[% ' selected' IF field.fif == item.value %]>[% item.label %]</option> + [% END %] + </select> +[% END %] diff --git a/templates/web/base/waste/index.html b/templates/web/base/waste/index.html new file mode 100644 index 000000000..0750ac82a --- /dev/null +++ b/templates/web/base/waste/index.html @@ -0,0 +1,19 @@ +[% SET bodyclass = 'waste' %] + +[% INCLUDE header.html %] + + [% PROCESS 'waste/govuk/fields.html' %] + [% PROCESS back %] + [% PROCESS errors %] + [% PROCESS title %] + [% IF property %] + <dl class="waste__address"> + <dt class="waste__address__title">Address</dt> + <dd class="waste__address__property">[% property.address %]</dd> + </dl> + [% END %] +<form method="post"> + [% PROCESS form %] +</form> + +[% INCLUDE footer.html %] diff --git a/templates/web/base/waste/missing.html b/templates/web/base/waste/missing.html new file mode 100644 index 000000000..e80ce87a2 --- /dev/null +++ b/templates/web/base/waste/missing.html @@ -0,0 +1,22 @@ +[% INCLUDE header.html %] + +<h1 class="govuk-heading-xl">No address on record</h1> + +<p class="govuk-body-l">We can’t find your address in our records</p> + +<p class="govuk-body">We can’t find your address. This may be because:</p> + +<ul class="govuk-list govuk-list--bullet"> + <li>It’s a commercial or non-residential property and isn’t eligible for kerbside collections + <li>It’s a brand new address and hasn’t had collections arranged yet + <li>It’s outside of our area, you can find your council who is responsible for your bins on <a href="https://gov.uk/">GOV.UK</a> +</ul> + +<h2 class="govuk-heading-m">What you can do now</h2> + +<ul class="govuk-list govuk-list--bullet"> + <li>Check your address details and <a href="[% c.uri_for_action('waste/index') %]">search again</a> + <li>Call our customer service team on 0800 647 7836 who will be pleased to assist you +</ul> + +[% INCLUDE footer.html %] diff --git a/templates/web/base/waste/summary.html b/templates/web/base/waste/summary.html new file mode 100644 index 000000000..7fa79b05b --- /dev/null +++ b/templates/web/base/waste/summary.html @@ -0,0 +1,70 @@ +[% SET bodyclass = 'waste' %] + +[% USE date(format = '%A, %-d~~~ %B') ~%] +[% PROCESS 'waste/govuk/fields.html' ~%] +[% INCLUDE header.html %] + +[% PROCESS errors %] +[% SET data = form.saved_data ~%] + +<h1 class="govuk-heading-xl">[% title %]</h1> +<p>Please review the information you’ve provided before you submit your [% thing %].</p> + +<div class="waste__summary"> +<dl class="govuk-summary-list"> + <div class="govuk-summary-list__row"> + <dt class="govuk-summary-list__key"> + [% summary_title %] + </dt> + <dd class="govuk-summary-list__value"> + </dd> + <dd class="govuk-summary-list__actions"> + <form method="post"> + <input type="hidden" name="saved_data" value="[% form.fif.saved_data %]"> + <input type="hidden" name="goto" value="[% step1 %]"> + <input type="submit" class="govuk-button govuk-button--secondary govuk-!-margin-bottom-0" value="Change answers"> + </form> + </dd> + </div> + <div class="govuk-summary-list__row"> + <dt class="govuk-summary-list__key govuk-summary-list__key--sub">Address</dt> + <dd class="govuk-summary-list__value">[% property.address %]</dd> + </div> + [% INCLUDE answers %] + + <div class="govuk-summary-list__row"> + <dt class="govuk-summary-list__key"> + About you + </dt> + <dd class="govuk-summary-list__value"> + </dd> + <dd class="govuk-summary-list__actions"> + <form method="post"> + <input type="hidden" name="saved_data" value="[% form.fif.saved_data %]"> + <input type="hidden" name="goto" value="about_you"> + <input type="submit" class="govuk-button govuk-button--secondary govuk-!-margin-bottom-0" value="Change answers"> + </form> + </dd> + </div> + + <div class="govuk-summary-list__row"> + <dt class="govuk-summary-list__key govuk-summary-list__key--sub">Your name</dt> + <dd class="govuk-summary-list__value">[% data.name %]</dd> + </div> + <div class="govuk-summary-list__row"> + <dt class="govuk-summary-list__key govuk-summary-list__key--sub">Telephone number</dt> + <dd class="govuk-summary-list__value">[% data.phone %]</dd> + </div> + <div class="govuk-summary-list__row"> + <dt class="govuk-summary-list__key govuk-summary-list__key--sub">Email</dt> + <dd class="govuk-summary-list__value">[% data.email %]</dd> + </div> + +</dl> + +<form method="post"> + [% PROCESS form %] +</form> +</div> + +[% INCLUDE footer.html %] diff --git a/templates/web/base/waste/summary_enquiry.html b/templates/web/base/waste/summary_enquiry.html new file mode 100644 index 000000000..8e5967a3b --- /dev/null +++ b/templates/web/base/waste/summary_enquiry.html @@ -0,0 +1,19 @@ +[% +title = 'Submit enquiry'; +thing = 'enquiry'; +summary_title = data.category; +step1 = 'enquiry'; +%] + +[% BLOCK answers %] + [% FOR extra IN data.keys.grep('^extra_') %] + [% NEXT UNLESS data.$extra %] + [% SET extra_name = extra.replace('extra_', '') %] + <div class="govuk-summary-list__row"> + <dt class="govuk-summary-list__key govuk-summary-list__key--sub">[% extra_name | title %]</dt> + <dd class="govuk-summary-list__value">[% data.$extra %]</dd> + </div> + [% END %] +[% END %] + +[% PROCESS waste/summary.html %] diff --git a/templates/web/base/waste/summary_report.html b/templates/web/base/waste/summary_report.html new file mode 100644 index 000000000..a67090e6e --- /dev/null +++ b/templates/web/base/waste/summary_report.html @@ -0,0 +1,19 @@ +[% +title = 'Submit missed bin report'; +thing = 'missed bin report'; +summary_title = 'Missed collection'; +step1 = 'report'; +%] + +[% BLOCK answers %] + [% FOR service IN data.keys.grep('^service-') %] + [% NEXT UNLESS data.$service %] + [% SET service_id = service.replace('service-', '') %] + <div class="govuk-summary-list__row"> + <dt class="govuk-summary-list__key govuk-summary-list__key--sub">[% services.$service_id.service_name %]</dt> + <dd class="govuk-summary-list__value">[% date.format(services.$service_id.last.date) | replace('~~~', services.$service_id.last.ordinal) %]</dd> + </div> + [% END %] +[% END %] + +[% PROCESS waste/summary.html %] diff --git a/templates/web/base/waste/summary_request.html b/templates/web/base/waste/summary_request.html new file mode 100644 index 000000000..83c4091aa --- /dev/null +++ b/templates/web/base/waste/summary_request.html @@ -0,0 +1,20 @@ +[% +title = 'Submit container request'; +thing = 'container request'; +summary_title = 'Container requests'; +step1 = 'request'; +%] + +[% BLOCK answers %] + [% FOR container IN data.keys.grep('^container-') %] + [% NEXT UNLESS data.$container %] + [% SET container_id = container.replace('container-', '') %] + [% SET quantity_key = container.replace('container-', 'quantity-') %] + <div class="govuk-summary-list__row"> + <dt class="govuk-summary-list__key govuk-summary-list__key--sub">[% containers.$container_id %]</dt> + <dd class="govuk-summary-list__value">[% data.$quantity_key %]</dd> + </div> + [% END %] +[% END %] + +[% PROCESS waste/summary.html %] |