diff options
author | Marius Halden <marius.h@lden.org> | 2017-05-28 21:31:42 +0200 |
---|---|---|
committer | Marius Halden <marius.h@lden.org> | 2017-05-28 21:31:42 +0200 |
commit | 987124b09a32248414faf4d0d6615d43b29ac6f6 (patch) | |
tree | a549db8af723c981d3b346e855f25d6fd5ff8aa7 /templates/web/base | |
parent | dbf56159e44c1560a413022451bf1a1c4cb22a52 (diff) | |
parent | a085b63ce09f87e83b75cda9b9cd08aadfe75d61 (diff) |
Merge tag 'v2.0.4' into fiksgatami-dev
Diffstat (limited to 'templates/web/base')
61 files changed, 768 insertions, 352 deletions
diff --git a/templates/web/base/admin/bodies.html b/templates/web/base/admin/bodies.html index e98e2d350..9bd85940b 100644 --- a/templates/web/base/admin/bodies.html +++ b/templates/web/base/admin/bodies.html @@ -14,9 +14,9 @@ </p> [% ELSE %] - [% IF c.config.STAGING_SITE and !c.config.SEND_REPORTS_ON_STAGING %] + [% IF c.config.STAGING_SITE and !c.config.STAGING_FLAGS.send_reports %] <p class="fms-admin-warning"> - [% tprintf(loc("As this is a staging site and %s is false, reports made on this site will be sent to the problem reporter, not the contact given for the report’s category."), "<a class='admin-offsite-link' href='http://fixmystreet.org/customising/config/#send_reports_on_staging'><code>SEND_REPORTS_ON_STAGING</code></a>") %] + [% tprintf(loc("As this is a staging site and %s is false, reports made on this site will be sent to the problem reporter, not the contact given for the report’s category."), "<a class='admin-offsite-link' href='http://fixmystreet.org/customising/config/#send_reports_on_staging'><code>STAGING_FLAGS send_reports</code></a>") %] </p> [% END %] diff --git a/templates/web/base/admin/body.html b/templates/web/base/admin/body.html index 5c9f4f9b9..5e8c6a164 100644 --- a/templates/web/base/admin/body.html +++ b/templates/web/base/admin/body.html @@ -59,9 +59,9 @@ <br> [% loc("Add a contact using the form below.") %] </p> -[% ELSIF c.config.STAGING_SITE and !c.config.SEND_REPORTS_ON_STAGING %] +[% ELSIF c.config.STAGING_SITE and !c.config.STAGING_FLAGS.send_reports %] <p class="fms-admin-warning"> - [% tprintf(loc("As this is a staging site and %s is false, reports made on this site will be sent to the problem reporter, not the contact given for the report’s category."), "<a class='admin-offsite-link' href='http://fixmystreet.org/customising/config/#send_reports_on_staging'><code>SEND_REPORTS_ON_STAGING</code></a>") %] + [% tprintf(loc("As this is a staging site and %s is false, reports made on this site will be sent to the problem reporter, not the contact given for the report’s category."), "<a class='admin-offsite-link' href='http://fixmystreet.org/customising/config/#send_reports_on_staging'><code>STAGING_FLAGS send_reports</code></a>") %] </p> [% END %] diff --git a/templates/web/base/admin/category-multiselect.html b/templates/web/base/admin/category-multiselect.html new file mode 100644 index 000000000..98416204f --- /dev/null +++ b/templates/web/base/admin/category-multiselect.html @@ -0,0 +1,10 @@ +<p> + <strong>[% loc('Categories:') %]</strong> +</p> +<p> + <select class="form-control js-multiple" name="categories" id="categories" multiple data-all="[% loc('All categories') %]"> + [% FOR contact IN contacts %] + <option value="[% contact.id %]" [% 'selected' IF contact.active %]>[% contact.category | html %]</option> + [% END %] + </select> +</p> diff --git a/templates/web/base/admin/config_page.html b/templates/web/base/admin/config_page.html index 67661c597..f35cd6adb 100644 --- a/templates/web/base/admin/config_page.html +++ b/templates/web/base/admin/config_page.html @@ -118,7 +118,11 @@ running version <strong>[% git_version || 'unknown' %]</strong>. [% INCLUDE subsection heading="Development" %] [% INCLUDE just_value value="STAGING_SITE" %] -[% INCLUDE just_value value="SEND_REPORTS_ON_STAGING" %] +[% staging_conf = FOR k IN c.config.STAGING_FLAGS %] + [% k.key %]:[% k.value %] + [%- ',' IF NOT loop.last %] +[% END %] +[% INCLUDE just_value value="STAGING_FLAGS" conf = staging_conf %] [% INCLUDE just_value value="UPLOAD_DIR" %] [% INCLUDE just_value value="GEO_CACHE" %] [% INCLUDE just_value value="TESTING_COUNCILS" %] diff --git a/templates/web/base/admin/defecttypes/edit.html b/templates/web/base/admin/defecttypes/edit.html new file mode 100644 index 000000000..a3b324d11 --- /dev/null +++ b/templates/web/base/admin/defecttypes/edit.html @@ -0,0 +1,37 @@ +[% INCLUDE 'admin/header.html' title=tprintf(('Defect Type for %s'), body.name) -%] +[% dt = defect_type %] + +[% UNLESS dt.id %]<h3>[% ('New defect type') %]</h3>[% END %] + +<form method="post" + action="[% c.uri_for('', body.id, dt.id || 'new' ) %]" + enctype="application/x-www-form-urlencoded" + accept-charset="utf-8" + class="validate"> + + <p> + <strong>[% ('Name:') %] </strong> + <input type="text" name="name" class="required form-control" size="30" value="[% dt.name | html %]"> + </p> + <p> + <strong>[% ('Description:') %] </strong> + <input type="text" name="description" class="form-control" size="30" value="[% dt.description | html %]"> + </p> + + <div class="admin-hint"> + <p> + [% ('If you only want this defect type to be an option for specific categories, pick them here. By default they will show for all categories.') %] + </p> + </div> + + [% INCLUDE 'admin/category-multiselect.html' %] + + [% TRY %][% INCLUDE 'admin/defecttypes/extra_fields.html' %][% CATCH file %][% END %] + + <p> + <input type="hidden" name="token" value="[% csrf_token %]" > + <input type="submit" class="btn" name="save" value="[% dt.id ? ('Save changes') : ('Create defect type') %]" > + </p> +</form> + +[% INCLUDE 'admin/footer.html' %] diff --git a/templates/web/base/admin/defecttypes/index.html b/templates/web/base/admin/defecttypes/index.html new file mode 100644 index 000000000..c45a09e6e --- /dev/null +++ b/templates/web/base/admin/defecttypes/index.html @@ -0,0 +1,13 @@ +[% INCLUDE 'admin/header.html' title=('Defect Types') -%] + +<ul> + [% FOR body IN bodies %] + <li> + <a href="[% c.uri_for('', body.id) %]">[% body.name %]</a> + [% defect_types_count = body.defect_types.count %] + [% IF defect_types_count %]([% defect_types_count %])[% END %] + </li> + [% END %] +</ul> + +[% INCLUDE 'admin/footer.html' %] diff --git a/templates/web/base/admin/defecttypes/list.html b/templates/web/base/admin/defecttypes/list.html new file mode 100644 index 000000000..783bd085c --- /dev/null +++ b/templates/web/base/admin/defecttypes/list.html @@ -0,0 +1,35 @@ +[% INCLUDE 'admin/header.html' title=tprintf(('Defect Types for %s'), body.name) -%] + +<table> + <thead> + <tr> + <th> [% ('Name') %] </th> + <th> [% ('Description') %] </th> + <th> [% ('Categories') %] </th> + <th> </th> + </tr> + </thead> + <tbody> + [% PROCESS 'defect_type/format.html' %] + [% FOR d IN defect_types %] + <tr> + <td> [% defect_type_format(defect_type=d) %] </td> + <td> [% d.description | html %] </td> + <td> + [% UNLESS d.contacts.size %] + <em>[% ('All categories') %]</em> + [% ELSE %] + [% FOR contact IN d.contacts %] + [% contact.category %][% ',' UNLESS loop.last %] + [% END %] + [% END %] + </td> + <td> <a href="[% c.uri_for('', body.id, d.id) %]" class="btn">[% ('Edit') %]</a> </td> + </tr> + [% END %] + </tbody> +</table> + +<a href="[% c.uri_for('', body.id, 'new') %]" class="btn">[% ('New defect type') %]</a> + +[% INCLUDE 'admin/footer.html' %] diff --git a/templates/web/base/admin/exordefects/index.html b/templates/web/base/admin/exordefects/index.html new file mode 100644 index 000000000..dba58198d --- /dev/null +++ b/templates/web/base/admin/exordefects/index.html @@ -0,0 +1,36 @@ +[% INCLUDE 'admin/header.html' title=('Download Exor RDI') -%] + +[% IF error_message %] + <h2>Error</h2> + <p>[% error_message %]</p> +[% END %] + +<form method="get" action="[% c.uri_for('download') %]" enctype="application/x-www-form-urlencoded" accept-charset="utf-8"> + <p> + <label for="start_date">[% ('Start Date:') %]</label><input type="text" class="form-control" + placeholder="[% ('Click here or enter as dd/mm/yyyy') %]" name="start_date" id="start_date" + value="[% start_date ? start_date.strftime( '%d/%m/%Y') : '' | html %]" /> + </p> + + <p> + <label for="end_date">[% ('End Date:') %]</label><input type="text" class="form-control" + placeholder="[% ('Click here or enter as dd/mm/yyyy') %]" name="end_date" id="end_date" size="5" + value="[% end_date ? end_date.strftime( '%d/%m/%Y') : '' | html %]" /> + </p> + + <p> + [% ('Inspector:') %] <select class="form-control" id='user_id' name='user_id'> + <option value=''>[% ('All inspectors') %]</option> + [% FOR inspector IN inspectors %] + <option value="[% inspector.id %]" [% 'selected' IF user_id == inspector.id %]>[% inspector.name %] ([% inspector.get_extra_metadata('initials') %])</option> + [% END %] + </select> + </p> + + <p> + <input type="submit" class="btn" size="30" value="Download RDI file" /> + </p> +</form> + + +[% INCLUDE 'admin/footer.html' %] diff --git a/templates/web/base/admin/index.html b/templates/web/base/admin/index.html index f573f0e7a..8498055b1 100644 --- a/templates/web/base/admin/index.html +++ b/templates/web/base/admin/index.html @@ -20,14 +20,18 @@ and to receive notices of updates. </p> [% END %] +<div class="admin-index-search form-txt-submit-box clearfix"> + <form method="get" action="[% c.uri_for('reports') %]" accept-charset="utf-8"> <p><label for="search_reports">[% loc('Search Reports') %]</label> <input type="text" class="form-control" name="search" size="30" id="search_reports" value="[% searched | html %]"> + <input type="submit" class="btn" value="[% loc('Go') %]"> </form> <form method="get" action="[% c.uri_for('users') %]" accept-charset="utf-8"> <p><label for="search_users">[% loc('Search Users') %]</label> <input type="text" class="form-control" name="search" size="30" id="search_users" value="[% searched | html %]"> + <input type="submit" class="btn" value="[% loc('Go') %]"> </form> [% IF c.user.is_superuser %] @@ -46,6 +50,8 @@ and to receive notices of updates. </form> [% END %] +</div> + [% IF unsent_reports.size %] <h2>[% loc('Reports waiting to be sent') %]</h2> diff --git a/templates/web/base/admin/report-category.html b/templates/web/base/admin/report-category.html new file mode 100644 index 000000000..1e39236d7 --- /dev/null +++ b/templates/web/base/admin/report-category.html @@ -0,0 +1,14 @@ +<select class="form-control" name="category" id="category"> + [% IF NOT problem.category OR NOT categories_hash.${problem.category} %] + <optgroup label="[% loc('Existing category') %]"> + <option selected value="[% problem.category | html %]">[% (problem.category OR '-') | html %]</option> + </optgroup> + [% END %] + [% IF categories.size %] + <optgroup label="[% loc('Available categories') %]"> + [% FOREACH cat IN categories %] + <option[% ' selected' IF problem.category == cat %]>[% cat | html %]</option> + [% END %] + </optgroup> + [% END %] +</select> diff --git a/templates/web/base/admin/report_blocks.html b/templates/web/base/admin/report_blocks.html index 3561d865d..9231dd1c2 100644 --- a/templates/web/base/admin/report_blocks.html +++ b/templates/web/base/admin/report_blocks.html @@ -1,5 +1,7 @@ [% +SET report_blocks_included = 1; + SET state_pretty = { 'confirmed' = loc('Open') 'investigating' = loc('Investigating') @@ -9,7 +11,7 @@ SET state_pretty = { 'fixed' = loc('Fixed') 'fixed - user' = loc('Fixed - User') 'fixed - council' = loc('Fixed - Council') - 'unable to fix' = loc('Unable to fix') + 'unable to fix' = loc('No further action') 'not responsible' = loc('Not Responsible') 'duplicate' = loc('Duplicate') 'closed' = loc('Closed') diff --git a/templates/web/base/admin/report_edit.html b/templates/web/base/admin/report_edit.html index 02e75563c..3c8134b80 100644 --- a/templates/web/base/admin/report_edit.html +++ b/templates/web/base/admin/report_edit.html @@ -112,31 +112,13 @@ class="admin-offsite-link">[% problem.latitude %], [% problem.longitude %]</a> <li><label for='detail'>[% loc('Details:') %]</label> <textarea class="form-control" name='detail' id='detail' cols=60 rows=10>[% problem.detail | html %]</textarea></li> -<li><label class="inline-text" for="state">[% loc('State:') %]</label> -<select class="form-control" name="state" id="state"> -[% FOREACH group IN state_groups %] - <optgroup label="[% group.0 %]"> - [% FOREACH state IN group.1 %] - <option [% 'selected ' IF state == problem.state %] value="[% state %]">[% state_pretty.$state %]</option> - [% END %] - </optgroup> -[% END %] -</select></li> +<li> + <label class="inline-text" for="state">[% loc('State:') %]</label> + [% INCLUDE 'admin/state_groups_select.html' %] +</li> <li><label class="inline-text" for="category">[% loc('Category:') %]</label> -<select class="form-control" name="category" id="category"> - [% IF NOT problem.category OR NOT categories.grep(problem.category).size %] - <optgroup label="[% loc('Existing category') %]"> - <option selected value="[% problem.category | html %]">[% (problem.category OR '-') | html %]</option> - </optgroup> - [% END %] - [% IF categories.size %] - <optgroup label="[% loc('Available categories') %]"> - [% FOREACH cat IN categories %] - <option[% ' selected' IF problem.category == cat %]>[% cat | html %]</option> - [% END %] - </optgroup> - [% END %] -</select></li> + [% INCLUDE 'admin/report-category.html' %] +</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/response_templates_select.html b/templates/web/base/admin/response_templates_select.html index 417be9add..ec50b2401 100644 --- a/templates/web/base/admin/response_templates_select.html +++ b/templates/web/base/admin/response_templates_select.html @@ -1,10 +1,8 @@ [% IF problem.response_templates %] -<div class="response_templates_select"> <select id="templates_for_[% for %]" class="form-control js-template-name" data-for="[% for %]" name="response_template"> <option value="">[% loc('--Choose a template--') %]</option> [% FOR t IN problem.response_templates %] - <option value="[% t.text | html %]"> [% t.title | html %] </option> + <option value="[% t.text | html %]" data-problem-state="[% t.state | html %]"> [% t.title | html %] </option> [% END %] </select> -</div> [% END %] diff --git a/templates/web/base/admin/responsepriorities/edit.html b/templates/web/base/admin/responsepriorities/edit.html index 4d838eed2..07d6906ba 100644 --- a/templates/web/base/admin/responsepriorities/edit.html +++ b/templates/web/base/admin/responsepriorities/edit.html @@ -20,6 +20,16 @@ <div class="admin-hint"> <p> + [% loc('If this priority is passed to an external service (e.g. Exor/Confirm) enter the priority code to use with that service here.') %] + </p> + </div> + <p> + <strong>[% loc('External ID') %]:</strong> + <input type="text" name="external_id" class="form-control" size="30" value="[% rp.external_id | html %]"> + </p> + + <div class="admin-hint"> + <p> [% loc('If you only want this priority to be an option for specific categories, pick them here. By default they will show for all categories.') %] </p> </div> diff --git a/templates/web/base/admin/state_groups_select.html b/templates/web/base/admin/state_groups_select.html new file mode 100644 index 000000000..9a70cd2c9 --- /dev/null +++ b/templates/web/base/admin/state_groups_select.html @@ -0,0 +1,3 @@ +[% PROCESS 'admin/report_blocks.html'; # For state_groups %] +[% DEFAULT current_state = problem.state %] +[% INCLUDE 'report/_state_select_field.html' %] diff --git a/templates/web/base/admin/template_edit.html b/templates/web/base/admin/template_edit.html index b2e734756..76de70dcc 100644 --- a/templates/web/base/admin/template_edit.html +++ b/templates/web/base/admin/template_edit.html @@ -31,6 +31,16 @@ </div> [% INCLUDE 'admin/category-checkboxes.html' %] + <div class="admin-hint"> + <p> + [% loc('If you want to use this template to prefill the update field when changing a report’s state, select the state here.') %] + </p> + </div> + <p> + <label for="state">[% loc('State') %]</label> + [% INCLUDE 'admin/state_groups_select.html' current_state=rt.state include_empty=1 %] + </p> + <p> <input type="hidden" name="token" value="[% csrf_token %]" > <input type="submit" class="btn" name="Edit templates" value="[% rt.id ? loc('Save changes') : loc('Create template') %]" > diff --git a/templates/web/base/admin/user-form.html b/templates/web/base/admin/user-form.html index 17230e940..dbd554b1e 100644 --- a/templates/web/base/admin/user-form.html +++ b/templates/web/base/admin/user-form.html @@ -47,7 +47,7 @@ [% loc("Staff users have permission to log in to the admin.") %] </p> </div> - [% loc('Staff:') %] <input type="checkbox" id="body" name="body" value="[% c.user.from_body.id %]" [% user.from_body.id == c.user.from_body.id ? ' checked' : '' %] [% 'disabled' UNLESS c.user.is_superuser OR c.user.has_body_permission_to('user_assign_body') %]> + [% loc('Staff:') %] <input type="checkbox" id="body" name="body" value="[% c.user.from_body.id %]" [% user.from_body.id == c.user.from_body.id ? ' checked' : '' %] [% 'disabled' UNLESS c.user.has_body_permission_to('user_assign_body') %]> </li> [% END %] @@ -121,14 +121,6 @@ </label> [% END %] </li> - <li> - <div class="admin-hint"> - <p> - [% loc("Reports from users with high enough reputation will be sent immediately without requiring inspection. Each category's threshold can be managed on its edit page. Users earn reputation when a report they have made is marked as inspected by inspectors.") %] - </p> - </div> - [% loc('Reputation:') %] [% user.get_extra_metadata('reputation') %] - </li> [% END %] [% IF c.user.is_superuser %] @@ -162,7 +154,7 @@ [% FOREACH permission IN group.value %] <li> <label class="inline"> - <input type="checkbox" id="perms_[% permission.key %]" name="permissions[[% permission.key %]]" [% "checked" IF user.has_body_permission_to(permission.key) %]> + <input type="checkbox" id="perms_[% permission.key %]" name="permissions[[% permission.key %]]" [% "checked" IF NOT user.is_superuser AND user.has_body_permission_to(permission.key) %]> [% permission.value %] </label> </li> @@ -173,6 +165,7 @@ </ul> [% END %] [% END %] + [% TRY %][% INCLUDE 'admin/user-form-extra-fields.html' %][% CATCH file %][% END %] </ul> <input type="submit" class="btn" name="Submit changes" value="[% loc('Submit changes') %]" > </form> diff --git a/templates/web/base/admin/users.html b/templates/web/base/admin/users.html index 757046bcf..8e35e1c31 100644 --- a/templates/web/base/admin/users.html +++ b/templates/web/base/admin/users.html @@ -26,7 +26,7 @@ <td>[% PROCESS value_or_nbsp value=user.name %]</td> <td><a href="[% c.uri_for( 'reports', search => user.email ) %]">[% PROCESS value_or_nbsp value=user.email %]</a></td> <td>[% PROCESS value_or_nbsp value=user.from_body.name %] - [% IF user.has_body_permission_to('moderate') %] * [% END %] + [% IF user.is_superuser %] * [% END %] </td> [% IF c.cobrand.moniker != 'zurich' %] <td>[% user.flagged == 2 ? loc('(Email in abuse table)') : user.flagged ? loc('Yes') : ' ' %]</td> @@ -47,6 +47,8 @@ [% IF NOT searched %] <h2>[% loc('Add user') %]</h2> [% INCLUDE 'admin/user-form.html', user = '' %] +[% ELSE %] +<a href="[% c.uri_for( c.controller('Admin').action_for('user_add') ) %]">[% loc('Add user') %]</a> [% END %] [% INCLUDE 'admin/footer.html' %] diff --git a/templates/web/base/auth/general.html b/templates/web/base/auth/general.html index cf539ff4f..41ff3a2e1 100644 --- a/templates/web/base/auth/general.html +++ b/templates/web/base/auth/general.html @@ -19,7 +19,7 @@ <div class="form-box"> <button name="facebook_sign_in" id="facebook_sign_in" value="facebook_sign_in" class="btn btn--block btn--social btn--facebook"> <img alt="" src="/i/facebook-icon-32.png" width="17" height="32"> - Log in with Facebook + [% loc('Log in with Facebook') %] </button> </div> [% END %] @@ -27,7 +27,7 @@ <div class="form-box"> <button name="twitter_sign_in" id="twitter_sign_in" value="twitter_sign_in" class="btn btn--block btn--social btn--twitter"> <img alt="" src="/i/twitter-icon-32.png" width="17" height="32"> - Log in with Twitter + [% loc('Log in with Twitter') %] </button> </div> [% END %] diff --git a/templates/web/base/common_footer_tags.html b/templates/web/base/common_footer_tags.html index 45872895b..01420c37d 100644 --- a/templates/web/base/common_footer_tags.html +++ b/templates/web/base/common_footer_tags.html @@ -1,28 +1,13 @@ -[% USE date %][% USE Math %] - [% TRY %][% PROCESS 'footer_extra.html' %][% CATCH file %][% END %] -<script type="text/javascript" src="[% start %]/js/translation_strings.[% lang_code %].js?[% Math.int( date.now / 3600 ) %]"></script> -<script type="text/javascript" src="[% version('/jslib/jquery-1.7.2.min.js') %]"></script> +[% PROCESS 'common_scripts.html' %] + <!--[if lte IE 9]> - <script type="text/javascript" src="[% version('/js/history.polyfill.min.js') %]"></script> + <script src="[% version('/js/history.polyfill.min.js') %]"></script> <![endif]--> -<script type="text/javascript" src="[% version('/js/validation_rules.js') %]"></script> -<script src="[% version('/js/jquery.validate.min.js') %]" type="text/javascript" charset="utf-8"></script> -<script type="text/javascript" src="[% version('/js/dropzone.min.js') %]"></script> -<script type="text/javascript" src="[% version('/js/jquery.multi-select.js') %]"></script> - -<script type="text/javascript" src="[% version('/js/geo.min.js') %]"></script> -<script type="text/javascript" src="[% version('/cobrands/fixmystreet/fixmystreet.js') %]"></script> - -[% map_js %] -<script src="[% version('/cobrands/fixmystreet/map.js') %]"></script> - -[% IF admin %] - <script src="[% version('/js/jquery-ui/js/jquery-ui-1.10.3.custom.min.js') %]"></script> - <script type="text/javascript" src="[% version('/js/fixmystreet-admin.js') %]"></script> +[% FOR script IN scripts ~%] + [% script = script.0 ? script : [ script ] ~%] + <script src="[% script.0 %]" + [%~ FOR attr IN script.1 %] [% attr.key %]="[% attr.value %]"[% END ~%] + ></script> [% END %] - -[% extra_js %] - -[% TRY %][% PROCESS 'footer_extra_js.html' %][% CATCH file %][% END %] diff --git a/templates/web/base/common_header_tags.html b/templates/web/base/common_header_tags.html index 7c0ac4973..e64722f01 100644 --- a/templates/web/base/common_header_tags.html +++ b/templates/web/base/common_header_tags.html @@ -12,7 +12,7 @@ <script nonce="[% csp_nonce %]"> window.Modernizr=function(e,t,n){function r(e){p.cssText=e}function o(e,t){return typeof e===t}var a,i,c,l="2.8.3",s={},u=t.documentElement,d="modernizr",f=t.createElement(d),p=f.style,m=({}.toString,{}),h=[],y=h.slice,v=function(e,n,r,o){var a,i,c,l,s=t.createElement("div"),f=t.body,p=f||t.createElement("body");if(parseInt(r,10))for(;r--;)c=t.createElement("div"),c.id=o?o[r]:d+(r+1),s.appendChild(c);return a=["­",'<style id="s',d,'">',e,"</style>"].join(""),s.id=d,(f?s:p).innerHTML+=a,p.appendChild(s),f||(p.style.background="",p.style.overflow="hidden",l=u.style.overflow,u.style.overflow="hidden",u.appendChild(p)),i=n(s,e),f?s.parentNode.removeChild(s):(p.parentNode.removeChild(p),u.style.overflow=l),!!i},g=function(t){var n=e.matchMedia||e.msMatchMedia;if(n)return n(t)&&n(t).matches||!1;var r;return v("@media "+t+" { #"+d+" { position: absolute; } }",function(t){r="absolute"==(e.getComputedStyle?getComputedStyle(t,null):t.currentStyle).position}),r},b={}.hasOwnProperty;c=o(b,"undefined")||o(b.call,"undefined")?function(e,t){return t in e&&o(e.constructor.prototype[t],"undefined")}:function(e,t){return b.call(e,t)};for(var E in m)c(m,E)&&(i=E.toLowerCase(),s[i]=m[E](),h.push((s[i]?"":"no-")+i));return r(""),f=a=null,s._version=l,s.mq=g,s.testStyles=v,s}(this,this.document); var fixmystreet=fixmystreet||{}; - (function(b){var a=b.documentElement;a.className=a.className.replace(/\bno-js\b/,"js");var c=-1<a.className.indexOf("iel8"),c=Modernizr.mq("(min-width: 48em)")||c?"desktop":"mobile";b=b.getElementById("js-meta-data");fixmystreet.page=b.getAttribute("data-page");fixmystreet.cobrand=b.getAttribute("data-cobrand");"mobile"==c&&(a.className+=" mobile","around"==fixmystreet.page&&(a.className+=" mobile-reporting-map only-map"))})(document); + (function(b){var a=b.documentElement;a.className=a.className.replace(/\bno-js\b/,"js");var c=-1<a.className.indexOf("iel8"),c=Modernizr.mq("(min-width: 48em)")||c?"desktop":"mobile";b=b.getElementById("js-meta-data");fixmystreet.page=b.getAttribute("data-page");fixmystreet.cobrand=b.getAttribute("data-cobrand");"mobile"==c&&(a.className+=" mobile","around"==fixmystreet.page&&(a.className+=" map-fullscreen only-map map-reporting"))})(document); </script> [% IF admin %] diff --git a/templates/web/base/common_scripts.html b/templates/web/base/common_scripts.html new file mode 100644 index 000000000..42c04f11f --- /dev/null +++ b/templates/web/base/common_scripts.html @@ -0,0 +1,50 @@ +[% + +USE date; +USE Math; + +scripts = []; + +scripts.push( + start _ "/js/translation_strings." _ lang_code _ ".js?" _ Math.int( date.now / 3600 ), + version('/jslib/jquery-1.7.2.min.js'), + version('/js/validation_rules.js'), + version('/js/jquery.validate.min.js'), + version('/js/dropzone.min.js'), + version('/js/jquery.multi-select.js'), + version('/js/geo.min.js'), + version('/cobrands/fixmystreet/fixmystreet.js'), +); + +IF c.user_exists AND (c.user.from_body OR c.user.is_superuser); + scripts.push( + version('/cobrands/fixmystreet/staff.js') + ); +END; + +FOR script IN map_js; + scripts.push(script); +END; + +scripts.push( + version('/cobrands/fixmystreet/map.js'), + version('/cobrands/fixmystreet/offline.js'), +); + +IF admin; + scripts.push( + version('/js/jquery-ui/js/jquery-ui-1.10.3.custom.min.js'), + version('/cobrands/fixmystreet/admin.js'), + ); +END; + +FOR script IN extra_js; + scripts.push(script); +END; + +TRY; + PROCESS 'footer_extra_js.html'; +CATCH file; +END; + +~%] diff --git a/templates/web/base/dashboard/index.html b/templates/web/base/dashboard/index.html index 1af507569..2a9a2ef42 100644 --- a/templates/web/base/dashboard/index.html +++ b/templates/web/base/dashboard/index.html @@ -12,14 +12,13 @@ <form> <hgroup> - <h2>Reports, Statistics and Actions for</h2> - <h1>[% council.name %]</h1> + [% tprintf(loc('<h2>Reports, Statistics and Actions for</h2> <h1>%s</h1>'), council.name) %] </hgroup> <div class="filters"> <p> - <label for="ward">Ward:</label> - <select class="form-control" name="ward"><option value=''>All</option> + <label for="ward">[% loc('Ward:') %]</label> + <select class="form-control" name="ward"><option value=''>[% loc('All') %]</option> [% FOR w IN children.values.sort('name') %] <option value="[% w.id %]"[% ' selected' IF w.id == ward %]>[% w.name %]</option> [% END %] @@ -27,8 +26,8 @@ </p> <p> - <label for="category">Report category:</label> - <select class="form-control" name="category"><option value=''>All</option> + <label for="category">[% loc('Category:') %]</label> + <select class="form-control" name="category"><option value=''>[% loc('All') %]</option> [% FOR cat_op IN category_options %] <option value='[% cat_op | html %]'[% ' selected' IF category == cat_op %]>[% cat_op | html %]</option> [% END %] @@ -36,7 +35,7 @@ </p> <p> - <input type="submit" class="btn" value="Look up"> + <input type="submit" class="btn" value="[% loc('Look up') %]"> </p> <br clear="all" /> @@ -46,17 +45,17 @@ <table width="100%" id="overview"> <tr> <th> </th> - <th scope="col"><abbr title="Week To Date">WTD</abbr></th> - <th scope="col">Last 7 days</th> - <th scope="col">Last 4 weeks</th> - <th scope="col">YTD</th> + <th scope="col"><abbr title="[% loc('Week To Date') %]">[% loc('WTD', "Week to date") %]</abbr></th> + <th scope="col">[% loc('Last 7 days') %]</th> + <th scope="col">[% loc('Last 4 weeks') %]</th> + <th scope="col">[% loc('YTD', "Year to date") %]</th> </tr> [% rows = { - '0' => [ "total", "Total reports received" ] - '1' => [ "fixed - council", "Council has marked as fixed" ] - '2' => [ "fixed_user", "User has marked as fixed" ] + '0' => [ "total", loc("Total reports received") ] + '1' => [ "fixed - council", loc("Council has marked as fixed") ] + '2' => [ "fixed_user", loc("User has marked as fixed") ] }; FOR row IN rows %] <tr id="[% row.value.0.replace('[^\w]+', '_' ) %]"> @@ -69,7 +68,7 @@ [% END %] <tr class='subtotal' id="total_fixed"> - <th scope="row">Total marked as fixed</th> + <th scope="row">[% loc('Total marked as fixed') %]</th> <td>[% problems.wtd.${"fixed - council"} + problems.wtd.fixed_user %]</td> <td>[% problems.week.${"fixed - council"} + problems.week.fixed_user %]</td> <td>[% problems.weeks.${"fixed - council"} + problems.weeks.fixed_user %]</td> @@ -78,10 +77,10 @@ [% rows = { - '0' => [ "in progress", "Council has marked as in progress" ] - '1' => [ "action scheduled", "Council has marked as planned" ] - '2' => [ "investigating", "Council has marked as investigating" ] - '3' => [ "closed", "Council has marked as closed" ] + '0' => [ "in progress", loc("Council has marked as in progress") ] + '1' => [ "action scheduled", loc("Council has marked as planned") ] + '2' => [ "investigating", loc("Council has marked as investigating") ] + '3' => [ "closed", loc("Council has marked as closed") ] }; wtd = 0, week = 0, weeks = 0, ytd = 0; FOR row IN rows %] @@ -95,7 +94,7 @@ [% END %] <tr class='subtotal' id="marked"> - <th scope="row">Total marked</th> + <th scope="row">[% loc('Total marked') %]</th> <td>[% problems.wtd.${"in progress"} + problems.wtd.${"action scheduled"} + problems.wtd.investigating + problems.wtd.closed %]</td> <td>[% problems.week.${"in progress"} + problems.week.${"action scheduled"} + @@ -107,7 +106,7 @@ </tr> <tr id="avg_fixed"> - <th scope="row">Average time to council marking fixed (days)</th> + <th scope="row">[% loc('Average time to council marking fixed (days)') %]</th> <td>[% problems.wtd.time_to_fix %]</td> <td>[% problems.week.time_to_fix %]</td> <td>[% problems.weeks.time_to_fix %]</td> @@ -115,7 +114,7 @@ </tr> <tr id="avg_marked"> - <th scope="row">Average time to first council state change (days)</th> + <th scope="row">[% loc('Average time to first council state change (days)') %]</th> <td>[% problems.wtd.time_to_mark %]</td> <td>[% problems.week.time_to_mark %]</td> <td>[% problems.weeks.time_to_mark %]</td> @@ -123,7 +122,7 @@ </tr> <tr class='subtotal' id="not_marked"> - <th scope="row">Total not marked</th> + <th scope="row">[% loc('Total not marked') %]</th> <td>[% problems.wtd.not_marked %]</td> <td>[% problems.week.not_marked %]</td> <td>[% problems.weeks.not_marked %]</td> @@ -132,25 +131,25 @@ </table> -<h2>Reports</h2> +<h2>[% loc('Reports') %]</h2> </select> -<p>Report state: <select class="form-control" name="state"> -<option value=''>All</option> +<p>[% loc('Report state:') %] <select class="form-control" name="state"> +<option value=''>[% loc('All') %]</option> [% FOREACH state IN [ ['confirmed', loc('Open')], ['investigating', loc('Investigating')], ['action scheduled', loc('Planned')], ['in progress', loc('In Progress')], ['closed', loc('Closed')], ['fixed', loc('Fixed')] ] %] <option [% 'selected ' IF state.0 == q_state %] value="[% state.0 %]">[% state.1 %]</option> [% END %] </select> -<input type="submit" class="btn" value="Look up"> -<a class="export_as_csv" href="[% c.req.uri_with({ export => 1 }) %]">Export as CSV</a> +<input type="submit" class="btn" value="[% loc('Look up') %]"> +<a class="export_as_csv" href="[% c.req.uri_with({ export => 1 }) %]">[% loc('Export as CSV') %]</a> <table width="100%" id="reports"> <tr> - <th scope="col">Less than 7 days old</th> - <th scope="col">7-14 days old</th> - <th scope="col">14-30 days old</th> + <th scope="col">[% loc('Less than 7 days old') %]</th> + <th scope="col">[% loc('7-14 days old') %]</th> + <th scope="col">[% loc('14-30 days old') %]</th> </tr> <tr> <td width="34%"><ul>[% INCLUDE list, list = lists.1 %]</ul></td> diff --git a/templates/web/base/defect_type/format.html b/templates/web/base/defect_type/format.html new file mode 100644 index 000000000..3c0781501 --- /dev/null +++ b/templates/web/base/defect_type/format.html @@ -0,0 +1,9 @@ +[% +# This template can be overridden by cobrands if they've added extra fields +# to the DefectType model (e.g Cobrand::Oxfordshire->defect_type_extra_fields) +# which should be used to represent this DefectType +# to the user in the inspect form. +~%] +[% MACRO defect_type_format BLOCK ~%] +[%~ defect_type.name | html ~%] +[%~ END %]
\ No newline at end of file diff --git a/templates/web/base/errors/generic.html b/templates/web/base/errors/generic.html index d0d1e2e00..241b310de 100755 --- a/templates/web/base/errors/generic.html +++ b/templates/web/base/errors/generic.html @@ -1,5 +1,9 @@ [% INCLUDE 'header.html', bodyclass = 'fullwidthpage', title = loc('Error') %] +[% IF csrf_token ~%] +<input type="hidden" name="token" value="[% csrf_token %]"> +[% END ~%] + <div class="confirmation-header confirmation-header--failure"> <h1>[% loc('Error') %]</h1> <p>[% message %]</p> diff --git a/templates/web/base/footer.html b/templates/web/base/footer.html index 5fd74b3a1..9f86f7519 100644 --- a/templates/web/base/footer.html +++ b/templates/web/base/footer.html @@ -9,35 +9,7 @@ <div class="nav-wrapper"> <div class="nav-wrapper-2"> - <div id="main-nav" role="navigation"> - <ul class="nav-menu nav-menu--mysoc"> - <li><a id="mysoc-logo" href="https://www.mysociety.org/">mySociety</a></li> - </ul> -[% - SET base = ""; - SET base = c.cobrand.base_url IF admin; -%] - <ul class="nav-menu nav-menu--main"> - <li><[% IF c.req.uri.path == '/' - %]span[% ELSE %]a href="[% base %]/"[% END %] class="report-a-problem-btn" - >[% loc("Report a problem") %]</[% c.req.uri.path == '/' ? 'span' : 'a' %]></li>[% - %]<li><[% IF c.req.uri.path == '/my' - %]span[% ELSE %]a href="[% base %]/my"[% END - %]>[% c.user_exists ? loc("Your account") : loc("Sign in") %]</[% c.req.uri.path == '/my' ? 'span' : 'a' %]></li>[% - %]<li><[% IF c.req.uri.path == '/reports' - %]span[% ELSE %]a href="[% base %]/reports[% IF c.user_exists AND c.user.categories.size %]?filter_category=[% c.user.categories.join(",") | uri | html %][% END %]"[% END - %]>[% loc("All reports") %]</[% c.req.uri.path == '/reports' ? 'span' : 'a' %]></li>[% - %]<li><[% IF c.req.uri.path == '/alert' - %]span[% ELSE %]a href="[% base %]/alert[% pc ? '/list?pc=' : '' %][% pc | uri %]"[% END - %]>[% loc("Local alerts") %]</[% c.req.uri.path == '/alert' ? 'span' : 'a' %]></li>[% - %]<li><[% IF c.req.uri.path == '/faq' - %]span[% ELSE %]a href="[% base %]/faq"[% END - %]>[% loc("Help") %]</[% c.req.uri.path == '/faq' ? 'span' : 'a' %]></li>[% - %]<li class="nav-menu__item--privacy"><[% IF c.req.uri.path == '/privacy' - %]span[% ELSE %]a href="[% base %]/privacy"[% END - %]>[% loc("Privacy") %]</[% c.req.uri.path == '/privacy' ? 'span' : 'a' %]></li> - </ul> - </div> + [% INCLUDE "main_nav.html" %] </div> </div> </div> <!-- .wrapper --> diff --git a/templates/web/base/front/javascript.html b/templates/web/base/front/javascript.html index 2795829a5..6b8e2a292 100644 --- a/templates/web/base/front/javascript.html +++ b/templates/web/base/front/javascript.html @@ -1,7 +1,12 @@ -[%# Assume using OpenStreetMap maps %] -<script src="[% version('/js/yepnope.js') %]"></script> -<script id="script_front" src="[% version('/cobrands/fixmystreet/front.js') %]" - data-scripts=" - [%~ version('/js/OpenLayers/OpenLayers.fixmystreet.js') %], - [%~ version('/js/map-OpenLayers.js') %], - [%~ version('/js/map-OpenStreetMap.js') %]"></script> +[% +# Assume using OpenStreetMap maps +map_js = [ + version('/js/yepnope.js'), + [ version('/cobrands/fixmystreet/front.js'), { + id = 'script_front', + 'data-scripts' = version('/js/OpenLayers/OpenLayers.fixmystreet.js') _ ',' _ + version('/js/map-OpenLayers.js') _ ',' _ + version('/js/map-OpenStreetMap.js') + } ], +] +%] diff --git a/templates/web/base/header.html b/templates/web/base/header.html index c11e78b47..4e537a7ec 100644 --- a/templates/web/base/header.html +++ b/templates/web/base/header.html @@ -7,7 +7,10 @@ <!--[if IE 7]> <html class="no-js ie7 iel8"[% html_att %]><![endif]--> <!--[if IE 8]> <html class="no-js ie8 iel8"[% html_att %]><![endif]--> <!--[if IE 9]> <html class="no-js ie9"[% html_att %]><![endif]--> -<!--[if gt IE 9]><!--><html class="no-js"[% html_att %]><!--<![endif]--> +<!--[if gt IE 9]><!--><html class="no-js"[% html_att %] +[% IF appcache ~%] + manifest="/offline/appcache.manifest" +[%~ END %]><!--<![endif]--> <head> <meta name="viewport" content="initial-scale=1.0"> @@ -16,19 +19,11 @@ <meta name="mobileoptimized" content="0"> [% INCLUDE 'header_opengraph.html' %] - [% - # For clarity, the 'fixmystreet' moniker (for fixmystreet.com) puts - # it stylesheets under fixmystreet.com - IF c.cobrand.moniker == 'fixmystreet'; - SET css_dir = 'fixmystreet.com'; - ELSE; - SET css_dir = c.cobrand.moniker; - END %] - <link rel="stylesheet" href="[% version('/cobrands/' _ css_dir _ '/base.css') %]"> - <link rel="stylesheet" href="[% version('/cobrands/' _ css_dir _ '/layout.css') %]" media="(min-width:48em)"> + <link rel="stylesheet" href="[% version('/cobrands/' _ c.cobrand.asset_moniker _ '/base.css') %]"> + <link rel="stylesheet" href="[% version('/cobrands/' _ c.cobrand.asset_moniker _ '/layout.css') %]" media="(min-width:48em)"> [% extra_css %] <!--[if (lt IE 9) & (!IEMobile)]> - <link rel="stylesheet" href="[% version('/cobrands/' _ css_dir _ '/layout.css') %]"> + <link rel="stylesheet" href="[% version('/cobrands/' _ c.cobrand.asset_moniker _ '/layout.css') %]"> <![endif]--> [% INCLUDE 'common_header_tags.html' %] diff --git a/templates/web/base/index.html b/templates/web/base/index.html index 0441b3efb..8cb127e6a 100644 --- a/templates/web/base/index.html +++ b/templates/web/base/index.html @@ -1,4 +1,4 @@ -[% map_js = PROCESS 'front/javascript.html' %] +[% PROCESS 'front/javascript.html' %] [% pre_container_extra = PROCESS 'around/postcode_form.html' %] [% INCLUDE 'header.html', title = '', bodyclass = 'frontpage fullwidthpage' %] diff --git a/templates/web/base/js/translation_strings.html b/templates/web/base/js/translation_strings.html index d6aca9ccb..b90a4d576 100644 --- a/templates/web/base/js/translation_strings.html +++ b/templates/web/base/js/translation_strings.html @@ -46,10 +46,31 @@ map_map: '[% loc('Map') | replace("'", "\\'") %]', map_satellite: '[% loc('Satellite') | replace("'", "\\'") %]', + expand_map: '[% loc('Expand map') | replace("'", "\\'") %]', + collapse_map: '[% loc('Collapse map') | replace("'", "\\'") %]', + permalink: '[% loc('Permalink') | replace("'", "\\'") %]', upload_max_files_exceeded: '[% loc ('Whoa there Testino! Three photos are enough.') | replace("'", "\\'") %]', upload_default_message: '[% loc ('Drag and drop photos here or <u>click to upload</u>') | replace("'", "\\'") %]', upload_cancel_confirmation: '[% loc ('Are you sure you want to cancel this upload?') | replace("'", "\\'") %]', - upload_invalid_file_type: '[% loc ('Please upload an image only') | replace("'", "\\'") %]' + upload_invalid_file_type: '[% loc ('Please upload an image only') | replace("'", "\\'") %]', + + login_with_email: '[% loc('Log in with email') | replace("'", "\\'") %]', + + offline: { + your_reports: '[% loc('Your offline reports') | replace("'", "\\'") %]', + update_saved: '[% loc('Your update has been saved offline for submission when back online.') | replace("'", "\\'") %]', + update_data_saved: '[% loc('Offline update data saved') | replace("'", "\\'") %]', + clear_data: '[% loc('Clear offline data') | replace("'", "\\'") %]', + are_you_sure: '[% loc('Are you sure?') | replace("'", "\\'") %]', + data_cleared: '[% loc('Offline data cleared') | replace("'", "\\'") %]', + reports_saved: '[% loc('Reports saved offline.') | replace("'", "\\'") %]', + saving_reports: '[% loc('Saving reports offline', 'This is followed by a progress count, e.g. 3/5') | replace("'", "\\'") %]', + you_are_offline: '[% loc('You are offline') | replace("'", "\\'") %]', + N_saved: '[% loc('<span>%s</span> saved.') | replace("'", "\\'") %]', + saved_to_submit: '[% loc('You have <a id="oFN" href=""><span>%s</span> saved to submit</a>.') | replace("'", "\\'") %]', + update_single: '[% loc('update') | replace("'", "\\'") %]', + update_plural: '[% loc('updates') | replace("'", "\\'") %]' + } }; diff --git a/templates/web/base/main_nav.html b/templates/web/base/main_nav.html new file mode 100644 index 000000000..31bd61af5 --- /dev/null +++ b/templates/web/base/main_nav.html @@ -0,0 +1,35 @@ +[% + SET base = ""; + SET base = c.cobrand.base_url IF admin; + + # DEFAULT would make sense here, except it treats the empty string as falsy + # and some cobrands want to set ul_class to an empty string. + SET ul_class="nav-menu nav-menu--main" UNLESS ul_class.defined; +%] +[% BLOCK navitem ~%] + <li [% liattrs %]> + [%~ IF c.req.uri.path == uri ~%] + <span [% attrs %]>[% label %]</span> + [%~ ELSE ~%] + <a href="[% base %][% uri %][% suffix IF suffix %]" [% attrs %]>[% label %]</a> + [%~ END ~%] + </li> +[%~ END %] + +[% UNLESS omit_wrapper %] + <div id="main-nav" role="navigation"> +[% END %] + + [% UNLESS hide_mysoc_link %] + <ul class="nav-menu nav-menu--mysoc"> + <li><a id="mysoc-logo" href="https://www.mysociety.org/">mySociety</a></li> + </ul> + [% END %] + + <ul class="[% ul_class %]"[% " id='" _ ul_id _ "'" IF ul_id %]> + [% INCLUDE 'main_nav_items.html' %] + </ul> + +[% UNLESS omit_wrapper %] + </div> +[% END %] diff --git a/templates/web/base/main_nav_items.html b/templates/web/base/main_nav_items.html new file mode 100644 index 000000000..6b5e09e56 --- /dev/null +++ b/templates/web/base/main_nav_items.html @@ -0,0 +1,48 @@ +[%~ INCLUDE navitem uri='/' label=loc('Report a problem') attrs='class="report-a-problem-btn"' ~%] + +[%~ IF c.user_exists ~%] + [%~ INCLUDE navitem uri='/my' label=loc('Your account') ~%] +[%~ ELSE ~%] + [%~ INCLUDE navitem uri='/auth' label=loc('Sign in') ~%] +[%~ END ~%] + +[%~ IF c.user_exists AND c.user.has_body_permission_to('planned_reports') ~%] + [%~ INCLUDE navitem uri='/my/planned' label=loc('Shortlist') ~%] +[%~ END ~%] + + +[%~ UNLESS hide_all_reports_link ~%] + [%~ + IF c.user_exists AND c.user.categories.size; + categories = c.user.categories.join(",") | uri; + cat_suffix = "?filter_category=" _ categories; + END; + + reports_uri = '/reports'; + IF body_name; + body_name = body_name | uri; + reports_uri = "${reports_uri}/${body_name}"; + END; + + INCLUDE navitem uri=reports_uri label=loc('All reports') suffix=cat_suffix; + ~%] +[%~ END ~%] + +[%~ + IF pc; + pc_uri = pc | uri; + pc_suffix = "/list?pc=" _ pc_uri; + END; + + INCLUDE navitem uri='/alert' label=loc('Local alerts') suffix=pc_suffix; +~%] + +[%~ INCLUDE navitem uri='/faq' label=loc('Help') ~%] + +[%~ UNLESS hide_privacy_link ~%] + [%~ INCLUDE navitem uri='/privacy' label=loc('Privacy') liattrs='class="nav-menu__item--privacy"' ~%] +[%~ END ~%] + +[%~ IF c.user_exists AND c.cobrand.admin_allow_user(c.user) ~%] + [%~ INCLUDE navitem uri='/admin' label=loc('Admin') ~%] +[%~ END ~%] diff --git a/templates/web/base/maps/bing.html b/templates/web/base/maps/bing.html index 6af4c3562..59d012c4f 100644 --- a/templates/web/base/maps/bing.html +++ b/templates/web/base/maps/bing.html @@ -1,8 +1,8 @@ -[% map_js = BLOCK %] -<!-- <script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0&mkt=en-GB"></script> --> -<script type="text/javascript" src="[% version('/js/OpenLayers/OpenLayers.fixmystreet.js') %]"></script> -<script type="text/javascript" src="[% version('/js/map-OpenLayers.js') %]"></script> -<script type="text/javascript" src="[% version('/js/map-bing-ol.js') %]"></script> -[% END %] - -[% map_html = INCLUDE maps/openlayers.html %] +[% +map_js = [ + version('/js/OpenLayers/OpenLayers.fixmystreet.js'), + version('/js/map-OpenLayers.js'), + version('/js/map-bing-ol.js'), +]; +map_html = INCLUDE maps/openlayers.html +%] diff --git a/templates/web/base/maps/fms.html b/templates/web/base/maps/fms.html index 03eb843da..e155ff778 100644 --- a/templates/web/base/maps/fms.html +++ b/templates/web/base/maps/fms.html @@ -1,9 +1,9 @@ -[% map_js = BLOCK %] -<!-- <script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0&mkt=en-GB"></script> --> -<script type="text/javascript" src="[% version('/js/OpenLayers/OpenLayers.fixmystreet.js') %]"></script> -<script type="text/javascript" src="[% version('/js/map-OpenLayers.js') %]"></script> -<script type="text/javascript" src="[% version('/js/map-bing-ol.js') %]"></script> -<script type="text/javascript" src="[% version('/js/map-fms.js') %]"></script> -[% END %] - -[% map_html = INCLUDE maps/openlayers.html include_key = 1 %] +[% +map_js = [ + version('/js/OpenLayers/OpenLayers.fixmystreet.js'), + version('/js/map-OpenLayers.js'), + version('/js/map-bing-ol.js'), + version('/js/map-fms.js'), +]; +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 cccea5b24..7c7711de9 100644 --- a/templates/web/base/maps/google-ol.html +++ b/templates/web/base/maps/google-ol.html @@ -1,9 +1,16 @@ -[% map_js = BLOCK %] -<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?v=3"></script> -<script type="text/javascript" src="[% version('/js/OpenLayers/OpenLayers.google.js') %]"></script> -<script type="text/javascript" src="[% version('/js/map-OpenLayers.js') %]"></script> -<script type="text/javascript" src="[% version('/js/map-google-ol.js') %]"></script> -[% END %] +[% +google_maps_url = "https://maps.googleapis.com/maps/api/js?v=3"; +IF c.config.GOOGLE_MAPS_API_KEY; + google_maps_url = google_maps_url _ "&key=" _ c.config.GOOGLE_MAPS_API_KEY; +END; + +map_js = [ + google_maps_url, + version('/js/OpenLayers/OpenLayers.google.js'), + version('/js/map-OpenLayers.js'), + version('/js/map-google-ol.js'), +] +%] [% map_sub_links = BLOCK %] <a class="hidden-nojs" id="map_layer_toggle" href="">[% loc('Satellite') %]</a> diff --git a/templates/web/base/maps/google.html b/templates/web/base/maps/google.html index eeb4c9837..c86c757fb 100644 --- a/templates/web/base/maps/google.html +++ b/templates/web/base/maps/google.html @@ -1,4 +1,3 @@ -[% map_js = BLOCK %] <style> #map_box img { max-width: none; @@ -7,9 +6,12 @@ color: #000; } </style> -<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script> -<script type="text/javascript" src="[% version('/js/map-google.js') %]"></script> -[% END %] +[% +map_js = [ + "http://maps.googleapis.com/maps/api/js?sensor=false", + version('/js/map-google.js'), +] +%] [% map_html = BLOCK %] <script nonce="[% csp_nonce %]"> diff --git a/templates/web/base/maps/mapquest-attribution.html b/templates/web/base/maps/mapquest-attribution.html index ab4424cdd..e469901a8 100644 --- a/templates/web/base/maps/mapquest-attribution.html +++ b/templates/web/base/maps/mapquest-attribution.html @@ -1,9 +1,8 @@ -[% map_js = BLOCK %] -<script type="text/javascript" src="[% version('/js/OpenLayers/OpenLayers.fixmystreet.js') %]"></script> -<script type="text/javascript" src="[% version('/js/map-OpenLayers.js') %]"></script> -<script type="text/javascript" src="[% version('/js/map-OpenStreetMap.js') %]"></script> -[% END %] - -[% map_html = BLOCK %] -[% INCLUDE maps/openlayers.html %] -[% END %] +[% +map_js = [ + version('/js/OpenLayers/OpenLayers.fixmystreet.js'), + version('/js/map-OpenLayers.js'), + version('/js/map-OpenStreetMap.js'), +]; +map_html = INCLUDE maps/openlayers.html +%] diff --git a/templates/web/base/maps/openlayers.html b/templates/web/base/maps/openlayers.html index 18829c5c4..215b69d26 100644 --- a/templates/web/base/maps/openlayers.html +++ b/templates/web/base/maps/openlayers.html @@ -33,4 +33,6 @@ [% IF map.copyright %] <div class="olControlAttribution" style="position: absolute;">[% map.copyright %]</div> [% END %] - + <div id="loading-indicator" class="hidden" aria-hidden="true"> + <img src="/i/loading.svg" alt="Loading..." /> + </div> diff --git a/templates/web/base/maps/osm-streetview.html b/templates/web/base/maps/osm-streetview.html index 2ff3b4723..dcf45d3b6 100644 --- a/templates/web/base/maps/osm-streetview.html +++ b/templates/web/base/maps/osm-streetview.html @@ -1,9 +1,8 @@ -[% map_js = BLOCK %] -<script type="text/javascript" src="[% version('/js/OpenLayers/OpenLayers.fixmystreet.js') %]"></script> -<script type="text/javascript" src="[% version('/js/map-OpenLayers.js') %]"></script> -<script type="text/javascript" src="[% version('/js/map-streetview.js') %]"></script> -[% END %] - -[% map_html = BLOCK %] -[% INCLUDE maps/openlayers.html %] -[% END %] +[% +map_js = [ + version('/js/OpenLayers/OpenLayers.fixmystreet.js'), + version('/js/map-OpenLayers.js'), + version('/js/map-streetview.js'), +]; +map_html = INCLUDE maps/openlayers.html +%] diff --git a/templates/web/base/maps/osm-toner-lite.html b/templates/web/base/maps/osm-toner-lite.html index 5e48f7569..6512eaf2c 100644 --- a/templates/web/base/maps/osm-toner-lite.html +++ b/templates/web/base/maps/osm-toner-lite.html @@ -1,10 +1,9 @@ -[% map_js = BLOCK %] -<script type="text/javascript" src="[% version('/js/OpenLayers/OpenLayers.fixmystreet.js') %]"></script> -<script type="text/javascript" src="https://stamen-maps.a.ssl.fastly.net/js/tile.stamen.js?v1.3.0"></script> -<script type="text/javascript" src="[% version('/js/map-OpenLayers.js') %]"></script> -<script type="text/javascript" src="[% version('/js/map-toner-lite.js') %]"></script> -[% END %] - -[% map_html = BLOCK %] -[% INCLUDE maps/openlayers.html %] -[% END %] +[% +map_js = [ + version('/js/OpenLayers/OpenLayers.fixmystreet.js'), + "https://stamen-maps.a.ssl.fastly.net/js/tile.stamen.js?v1.3.0", + version('/js/map-OpenLayers.js'), + version('/js/map-toner-lite.js'), +]; +map_html = INCLUDE maps/openlayers.html +%] diff --git a/templates/web/base/maps/osm.html b/templates/web/base/maps/osm.html index ab4424cdd..e469901a8 100644 --- a/templates/web/base/maps/osm.html +++ b/templates/web/base/maps/osm.html @@ -1,9 +1,8 @@ -[% map_js = BLOCK %] -<script type="text/javascript" src="[% version('/js/OpenLayers/OpenLayers.fixmystreet.js') %]"></script> -<script type="text/javascript" src="[% version('/js/map-OpenLayers.js') %]"></script> -<script type="text/javascript" src="[% version('/js/map-OpenStreetMap.js') %]"></script> -[% END %] - -[% map_html = BLOCK %] -[% INCLUDE maps/openlayers.html %] -[% END %] +[% +map_js = [ + version('/js/OpenLayers/OpenLayers.fixmystreet.js'), + version('/js/map-OpenLayers.js'), + version('/js/map-OpenStreetMap.js'), +]; +map_html = INCLUDE maps/openlayers.html +%] diff --git a/templates/web/base/my/planned.html b/templates/web/base/my/planned.html index eb67247c4..366a554d9 100644 --- a/templates/web/base/my/planned.html +++ b/templates/web/base/my/planned.html @@ -22,11 +22,13 @@ [% END %] <section class="full-width"> -[% INCLUDE "reports/_list-filters.html", use_form_wrapper = 1 %] +[% INCLUDE "reports/_list-filters.html", use_form_wrapper = 1 shortlist = 1 %] <div class="js-pagination"> [% INCLUDE 'pagination.html', pager = problems_pager, param = 'p' %] </div> -[% INCLUDE 'my/_problem-list.html' %] +<div id="js-reports-list"> +[% INCLUDE 'my/_problem-list.html' shortlist = 1 %] +</div> </section> </div> diff --git a/templates/web/base/offline/appcache.html b/templates/web/base/offline/appcache.html new file mode 100644 index 000000000..ba54b229a --- /dev/null +++ b/templates/web/base/offline/appcache.html @@ -0,0 +1,13 @@ +[% INCLUDE 'header.html' appcache = 1 bodyclass = "fullwidthpage" %] + +<h1>[% loc('Internet glitch') %]</h1> + +<p>[% loc('Sorry, we don’t have a good enough connection to fetch that page, or the +page wasn’t found or there was a server error. Please try again later.') %] +</p> + +<ul class="item-list item-list--reports" id="offline_list"></ul> + +<div id="offline_clear"></div> + +[% INCLUDE 'footer.html' %] diff --git a/templates/web/base/offline/manifest.html b/templates/web/base/offline/manifest.html new file mode 100644 index 000000000..93d26cb94 --- /dev/null +++ b/templates/web/base/offline/manifest.html @@ -0,0 +1,16 @@ +CACHE MANIFEST + +[% PROCESS 'common_scripts.html' ~%] + +CACHE: +[% version('/cobrands/' _ c.cobrand.asset_moniker _ '/base.css') %] +[% version('/cobrands/' _ c.cobrand.asset_moniker _ '/layout.css') %] +[% FOR script IN scripts ~%] + [%- script %] +[% END %] + +NETWORK: +* + +FALLBACK: +/ [% version('../templates/web/base/offline/appcache.html', '/offline/appcache') %] diff --git a/templates/web/base/open311/index.html b/templates/web/base/open311/index.html index 558c14ca5..51e7ef364 100644 --- a/templates/web/base/open311/index.html +++ b/templates/web/base/open311/index.html @@ -40,7 +40,7 @@ about future-proofing your communication channels in an easy and economical way [% IF c.cobrand.moniker == 'fixmystreet' %] <p>You may be interested to know about <a -href="https://www.fixmystreet.com/council">FixMyStreet +href="https://www.fixmystreet.com/about/council">FixMyStreet for Councils</a>, our hosted service which sits seamlessly on your council website.</p> diff --git a/templates/web/base/report/_inspect.html b/templates/web/base/report/_inspect.html index 06c3aab6c..b75394abd 100644 --- a/templates/web/base/report/_inspect.html +++ b/templates/web/base/report/_inspect.html @@ -1,4 +1,3 @@ -[% PROCESS 'admin/report_blocks.html'; # For the report state dropdown %] [% permissions = c.user.permissions(c, problem.bodies_str) %] [% second_column = BLOCK -%] <div id="side-inspect"> @@ -13,9 +12,15 @@ </p> <p> [% SET local_coords = problem.local_coords; %] - <strong>[% loc('Easting/Northing:') %]</strong> - <span id="problem_easting">[% local_coords.0 IF local_coords %]</span>, - <span id="problem_northing">[% local_coords.1 IF local_coords %]</span> + [% IF local_coords %] + <strong>[% loc('Easting/Northing:') %]</strong> + <span id="problem_easting">[% local_coords.0 %]</span>, + <span id="problem_northing">[% local_coords.1 %]</span> + [% ELSE %] + <strong>[% loc('Latitude/Longitude:') %]</strong> + <span id="problem_latitude">[% problem.latitude %]</span> + <span id="problem_longitude">[% problem.longitude %]</span>, + [% END %] <input type="hidden" name="longitude" value="[% problem.longitude %]"> <input type="hidden" name="latitude" value="[% problem.latitude %]"> </p> @@ -31,21 +36,7 @@ <div class="inspect-section"> <p> <label for="category">[% loc('Category') %]</label> - [%# XXX this is duplicated from admin/report_edit.html, should be refactored %] - <select name="category" id="category" class="form-control"> - [% IF NOT problem.category OR NOT categories.grep(problem.category).size %] - <optgroup label="[% loc('Existing category') %]"> - <option selected value="[% problem.category | html %]">[% (problem.category OR '-') | html %]</option> - </optgroup> - [% END %] - [% IF categories.size %] - <optgroup label="[% loc('Available categories') %]"> - [% FOREACH cat IN categories %] - <option[% ' selected' IF problem.category == cat %]>[% cat | html %]</option> - [% END %] - </optgroup> - [% END %] - </select> + [% INCLUDE 'admin/report-category.html' %] </p> [% FOREACH category IN categories %] @@ -63,19 +54,21 @@ [% END %] [% IF permissions.report_inspect %] + [% PROCESS 'defect_type/format.html' %] <p> - <label for="state">[% loc('State') %]</label> - [%# XXX this is duplicated from admin/report_edit.html, should be refactored %] - <select name="state" id="state" class="form-control"> - [% FOREACH group IN state_groups %] - <optgroup label="[% group.0 %]"> - [% FOREACH state IN group.1 %] - <option [% 'selected ' IF state == problem.state %] value="[% state %]">[% state_pretty.$state %]</option> - [% END %] - </optgroup> + <label for="defect_type">[% loc('Defect type') %]</label> + <select id="defect_type" name="defect_type" class="form-control"> + <option value=""[% ' selected' IF NOT problem.defect_type %]>-</option> + [% FOREACH defect_type IN problem.defect_types %] + <option[% ' selected' IF problem.defect_type_id == defect_type.id %] value="[% defect_type.id %]">[% defect_type_format() %]</option> [% END %] </select> </p> + + <p> + <label for="state">[% loc('State') %]</label> + [% INCLUDE 'report/inspect/state_groups_select.html' %] + </p> <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> @@ -118,8 +111,9 @@ [% 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> - <option[% ' selected' IF traffic_info == "Yes" %]>Yes</option> - <option[% ' selected' IF traffic_info == "No" %]>No</option> + [% FOREACH option IN problem.traffic_management_options %] + <option value='[% option %]'[% ' selected' IF traffic_info == option %]>[% option %]</option> + [% END %] </select> </p> <p> @@ -136,7 +130,7 @@ [% IF permissions.report_inspect %] <p> <label class="label-containing-checkbox"> - <input type="checkbox" name="save_inspected" value="1" class="js-toggle-public-update" [% 'checked' IF save_inspected %]> + <input type="checkbox" name="include_update" value="1" class="js-toggle-public-update" checked> [% loc('Save with a public update') %] </label> </p> @@ -157,7 +151,6 @@ <p> <input type="hidden" name="token" value="[% csrf_token %]"> - <a class="btn" href="[% c.uri_for( '/report', problem.id ) %]">[% loc('Cancel') %]</a> <input class="btn btn-primary" type="submit" value="[% loc('Save changes') %]" data-value-original="[% loc('Save changes') %]" data-value-duplicate="[% loc('Save + close as duplicate') %]" name="save" /> </p> </div> diff --git a/templates/web/base/report/_item.html b/templates/web/base/report/_item.html index 0f42b00ce..e627227d4 100644 --- a/templates/web/base/report/_item.html +++ b/templates/web/base/report/_item.html @@ -1,18 +1,65 @@ -<li class="item-list__item item-list--reports__item [% item_extra_class %]" data-report-id="[% problem.id | html %]"> +[% IF NOT report_blocks_included ~%] +[% PROCESS 'admin/report_blocks.html' ~%] +[% END ~%] + +[% IF c.user.has_permission_to('planned_reports', problem.bodies_str_ids) ~%] + [% item_extra_class = "item-list__item--indented" ~%] + [% item_action = BLOCK ~%] + <input type="submit" value="1" + data-label-remove="[% loc('Remove from shortlist') %]" + data-label-add="[% loc('Add to shortlist') %]" + [% IF c.user.is_planned_report(problem) ~%] + name="shortlist-remove" title="[% loc('Remove from shortlist') %]" class="item-list__item__shortlist-remove" + [%~ ELSE ~%] + name="shortlist-add" title="[% loc('Add to shortlist') %]" class="item-list__item__shortlist-[% IF problem.shortlisted_user %]take[% ELSE %]add[% END %]" + [%~ END ~%] + > + [%~ END %] +[% END %] + +[% IF shortlist %] + [% item_extra_class = "item-list__item--indented item-list__item--act-and-sort" %] + [% item_action = BLOCK %] + [% item_action %] + <input type="submit" name="shortlist-up" value="[% loc('Up one') %]" title="[% loc('Up one') %]" class="item-list__item__shortlist-up" [% IF loop.first %]disabled[% END %]> + <input type="submit" name="shortlist-down" value="[% loc('Down one') %]" title="[% loc('Down one') %]" class="item-list__item__shortlist-down" [% IF loop.last %]disabled[% END %]> + [% END %] +[% END %] + +<li class="item-list__item item-list--reports__item [% item_extra_class %]" + data-report-id="[% problem.id | html %]" data-lastupdate="[% problem.lastupdate %]"> <a href="[% c.cobrand.base_url_for_report( problem ) %][% problem.url %]"> [% IF problem.photo %] <img class="img" height="60" width="90" src="[% problem.photos.first.url_fp %]" alt=""> [% END %] <h3 class="item-list__heading">[% problem.title | html %]</h3> + [% IF c.user.has_permission_to('report_inspect', problem.bodies_str_ids) %] + <div class="item-list__description">[% problem.detail | html %]</div> + [% END %] <small> + [% IF NOT no_fixed AND problem.is_fixed %] + <span class="item-list__item__state">[% loc('Fixed') %]</span> + [% ELSIF NOT no_fixed AND problem.is_closed %] + <span class="item-list__item__state">[% loc('Closed') %]</span> + [% ELSIF problem.response_priority AND (c.user.has_permission_to('report_edit_priority', problem.bodies_str_ids) OR c.user.has_permission_to('report_inspect', problem.bodies_str_ids)) %] + <span class="item-list__item__state">[% problem.response_priority.name %]</span> + [% END %] [%- IF c.cobrand.moniker != 'fixamingata' %] [%# Default: %] - [%- prettify_dt( problem.confirmed, 1 ) %] + [%- IF problem.days_ago > 0 AND problem.days_ago <= c.cobrand.display_days_ago_threshold %] + [% tprintf( nget('Reported %d day ago', 'Reported %d days ago', problem.days_ago), problem.days_ago ) %] + [%- ELSE %] + [% prettify_dt( problem.confirmed, 1 ) %] + [%- END %] [%- ELSE %] [%# Swedish cobrand fixamingata: %] [%- prettify_dt( problem.confirmed) %] [%- END %] [%- IF dist %], [% dist %]km[% END %] [%- IF problem.confirmed != problem.lastupdate AND problem.whensent != problem.lastupdate %], - [% tprintf(loc('last updated %s'), prettify_dt( problem.lastupdate, 1 ) ) %] + [%- IF problem.days_ago('lastupdate') > 0 AND problem.days_ago('lastupdate') <= c.cobrand.display_days_ago_threshold %] + [% tprintf( nget('last updated %d day ago', 'last updated %d days ago', problem.days_ago('lastupdate') ), problem.days_ago('lastupdate') ) %] + [%- ELSE %] + [% tprintf(loc('last updated %s'), prettify_dt( problem.lastupdate, 1 ) ) %] + [%- END %] [%- END %] [% IF include_sentinfo %] [% IF c.cobrand.is_council && !c.cobrand.owns_problem( problem ) %] @@ -21,11 +68,64 @@ [% ELSIF problem.bodies_str_ids.size == 0 %] [% loc('(not sent to council)') %] [% END %] [% END %] - [% IF NOT no_fixed AND problem.is_fixed %] - [% loc('(fixed)') %] - [% ELSIF NOT no_fixed AND problem.is_closed %] - [% loc('(closed)') %] - [% END %] </small> + + [% IF c.user.has_permission_to('report_inspect', problem.bodies_str_ids) %] + <div class="item-list__item__metadata"> + <div> + <h4>[% loc('Report ID:') %]</h4> + <p>[% problem.id %]</p> + </div> + [% IF problem.local_coords %] + <div> + <h4>[% loc('Easting/Northing:') %]</h4> + <p>[% problem.local_coords.0 %], [% problem.local_coords.1 %]</p> + </div> + [% END %] + <div> + <h4>[% loc('Latitude/Longitude:') %]</h4> + <p>[% problem.latitude %], [% problem.longitude %]</p> + </div> + <div> + <h4>[% loc('Category') %]</h4> + <p>[% (problem.category OR '-') | html %]</p> + </div> + <div> + <h4>[% loc('State') %]</h4> + <p>[% state_pretty.${problem.state} %]</p> + </div> + <div> + <h4>[% loc('Priority') %]</h4> + <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> + [% SET fields = problem.get_extra_fields; IF fields.size %] + [% FOR f IN fields %] + <div> + <h4>[% f.name %]</h4> + <p>[% f.value %]</p> + </div> + [% END %] + [% END %] + </div> + [% END %] + + </a> +[% IF item_action AND page != 'around' %] + <form method="post" action="/my/planned/change"> + <input type="hidden" name="id" value="[% problem.id %]"> + <input type="hidden" name="token" value="[% csrf_token %]"> + [% item_action %] + </form> +[% ELSIF item_action ~%] + [% item_action.replace('("shortlist-[^"]*)', '$1-' _ problem.id) %] +[% END ~%] </li> diff --git a/templates/web/base/report/_main.html b/templates/web/base/report/_main.html index 4de26535c..83a3a1109 100644 --- a/templates/web/base/report/_main.html +++ b/templates/web/base/report/_main.html @@ -5,13 +5,13 @@ <a href="[% c.uri_for( '/around', { lat => latitude, lon => longitude } ) %]" class="problem-back js-back-to-report-list">[% loc('Back to all reports') %]</a> -<div class="problem-header clearfix" problem-id="[% problem.id %]"> +<div class="problem-header clearfix" data-lastupdate="[% problem.lastupdate %]"> [% IF c.user.has_permission_to('planned_reports', problem.bodies_str_ids) %] <form method="post" action="/my/planned/change" id="planned_form" class="hidden-label-target"> <input type="hidden" name="id" value="[% problem.id %]"> <input type="hidden" name="token" value="[% csrf_token %]"> - <input type="hidden" name="change" value="[% IF c.user.is_planned_report(problem) %]remove[% ELSE %]add[% END %]"> + <input type="hidden" name="[% IF c.user.is_planned_report(problem) %]shortlist-remove[% ELSE %]shortlist-add[% END %]" value="1"> <p><input type="submit" id="shortlist-report" @@ -19,12 +19,16 @@ data-label-add="[% loc('Add to shortlist') %]" data-value-remove="[% loc('Shortlisted') %]" data-value-add="[% loc('Shortlist') %]" + data-class-remove="btn--shortlisted" + data-class-add="btn--shortlist" [%~ IF c.user.is_planned_report(problem) ~%] value="[% loc('Shortlisted') %]" aria-label="[% loc('Remove from shortlist') %]" + class="btn--shortlisted" [%~ ELSE ~%] value="[% loc('Shortlist') %]" aria-label="[% loc('Add to shortlist') %]" + class="btn--shortlist" [%~ END ~%] ></p> </form> @@ -43,7 +47,7 @@ [% IF problem.title != original.title %] <label> <input type="checkbox" name="problem_revert_title" class="revert-title"> - Revert to original title + [% loc('Revert to original title') %] </label> [% END %] <h1><input class="form-control" type="text" name="problem_title" value="[% problem.title | html %]" data-original-value="[% original.title | html %]"></h1> @@ -53,7 +57,7 @@ <div class="moderate-edit"> <label> <input type="checkbox" name="problem_show_name" [% 'checked' UNLESS problem.anonymous %]> - Show reporter’s name + [% loc('Show reporter’s name') %] </label> </div> <p class="report_meta_info"> @@ -62,7 +66,7 @@ [% INCLUDE 'report/_main_sent_info.html' %] [% mlog = problem.latest_moderation_log_entry(); IF mlog %] - <p>Moderated by [% mlog.user.from_body.name %] at [% prettify_dt(mlog.whenedited) %]</p> + <p>[% tprintf(loc('Moderated by %s at %s'), mlog.admin_user, prettify_dt(mlog.whenedited)) %]</p> [% END %] [% INCLUDE 'report/_support.html' %] @@ -72,7 +76,7 @@ <p class="moderate-edit"> <label> <input type="checkbox" name="problem_show_photo" [% problem.photo ? 'checked' : '' %]> - Show photo + [% loc('Show photo') %] </label> </p> [% END %] @@ -88,7 +92,7 @@ [% IF problem.detail != original.detail %] <label> <input type="checkbox" name="problem_revert_detail" class="revert-textarea"> - Revert to original text + [% loc('Revert to original text') %] </label> [% END %] <textarea class="form-control" name="problem_detail" data-original-value="[% original.detail | html %]">[% problem.detail | html %]</textarea> @@ -98,16 +102,16 @@ <p> <label> <input type="checkbox" class="hide-document" name="problem_hide" [% problem.hidden ? 'checked' : '' %]> - Hide entire report + [% loc('Hide entire report') %] </label> </p> <p> - <label for="moderation_reason">Moderation reason:</label> - <input type="text" class="form-control" name="moderation_reason" placeholder="Describe why you are moderating this"> + <label for="moderation_reason">[% loc('Moderation reason:') %]</label> + <input type="text" class="form-control" name="moderation_reason" placeholder="[% loc('Describe why you are moderating this') %]"> </p> <p> - <input type="submit" class="green-btn" value="Save changes"> - <input type="button" class="btn cancel" value="Discard changes"> + <input type="submit" class="green-btn" value="[% loc('Save changes') %]"> + <input type="button" class="btn cancel" value="[% loc('Discard changes') %]"> </p> </div> [% END %] @@ -127,9 +131,9 @@ [% END %] [% IF c.user.has_permission_to('planned_reports', problem.bodies_str_ids) %] [%~ IF c.user.is_planned_report(problem) ~%] - <label class="btn" for="shortlist-report" role="menuitem" aria-label="[% loc('Remove from shortlist') %]">[% loc('Shortlisted') %]</label> + <label class="btn btn--shortlisted" for="shortlist-report" role="menuitem" aria-label="[% loc('Remove from shortlist') %]">[% loc('Shortlisted') %]</label> [%~ ELSE ~%] - <label class="btn" for="shortlist-report" role="menuitem" aria-label="[% loc('Add to shortlist') %]">[% loc('Shortlist') %]</label> + <label class="btn btn--shortlist" for="shortlist-report" role="menuitem" aria-label="[% loc('Add to shortlist') %]">[% loc('Shortlist') %]</label> [%~ END ~%] [% END %] </div> diff --git a/templates/web/base/report/_state_select_field.html b/templates/web/base/report/_state_select_field.html new file mode 100644 index 000000000..9b3ed18df --- /dev/null +++ b/templates/web/base/report/_state_select_field.html @@ -0,0 +1,12 @@ +<select class="form-control" name="state" id="state"> +[% IF include_empty %] + <option value="">---</option> +[% END %] +[% FOREACH group IN state_groups %] + <optgroup label="[% group.0 %]"> + [% FOREACH state IN group.1 %] + <option [% 'selected ' IF state == current_state %] value="[% state %]">[% state_pretty.$state %]</option> + [% END %] + </optgroup> +[% END %] +</select> diff --git a/templates/web/base/report/banner.html b/templates/web/base/report/banner.html index 188e96502..c80d129eb 100644 --- a/templates/web/base/report/banner.html +++ b/templates/web/base/report/banner.html @@ -14,7 +14,6 @@ [% IF problem.is_closed %] [% INCLUDE banner, id = 'closed', text = loc('Closed') %] [% END %] -[% states = [ 'investigating', 'in progress', 'planned', 'action scheduled' ]; - IF states.grep(problem.state).size %] +[% IF problem.is_in_progress %] [% INCLUDE banner, id = 'progress', text = loc('In progress') %] [% END %] diff --git a/templates/web/base/report/inspect/state_groups_select.html b/templates/web/base/report/inspect/state_groups_select.html new file mode 100644 index 000000000..c4043751b --- /dev/null +++ b/templates/web/base/report/inspect/state_groups_select.html @@ -0,0 +1,24 @@ +[% +SET state_pretty = { + 'confirmed' = loc('Open') + 'investigating' = loc('Investigating') + 'in progress' = loc('In progress') + 'action scheduled' = loc('Action Scheduled') + 'fixed - council' = loc('Fixed - Council') + 'unable to fix' = loc('No further action') + 'not responsible' = loc('Not Responsible') + 'duplicate' = loc('Duplicate') + 'internal referral' = loc('Internal referral') + 'hidden' = loc('Hidden') +}; + +SET state_groups = [ + [ loc('Open'), [ 'confirmed', 'investigating', 'in progress', 'action scheduled' ] ], + [ loc('Fixed'), [ 'fixed - council' ] ], + [ loc('Closed'), [ 'unable to fix', 'not responsible', 'duplicate', 'internal referral' ] ], + [ loc('Hidden'), [ 'hidden' ] ] +]; + +%] +[% DEFAULT current_state = problem.state %] +[% INCLUDE 'report/_state_select_field.html' %] diff --git a/templates/web/base/report/new/form_report.html b/templates/web/base/report/new/form_report.html index 3c36bd0cc..e85d890c9 100644 --- a/templates/web/base/report/new/form_report.html +++ b/templates/web/base/report/new/form_report.html @@ -7,7 +7,7 @@ [% PROCESS "report/new/category_wrapper.html" %] [% TRY %][% PROCESS 'report/new/after_category.html' %][% CATCH file %][% END %] - <h2 class="form-section-heading">Public details</h2> + <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') ] %] diff --git a/templates/web/base/report/new/form_user.html b/templates/web/base/report/new/form_user.html index 424660aa8..68a226693 100644 --- a/templates/web/base/report/new/form_user.html +++ b/templates/web/base/report/new/form_user.html @@ -1,4 +1,4 @@ -<h2 class="form-section-heading form-section-heading--private">Private details</h2> +<h2 class="form-section-heading form-section-heading--private">[% loc('Private details') %]</h2> <p class="form-section-description" id="js-councils_text_private"> [% IF js %] [% loc('These will be sent to the council, but will never be shown online.') %] diff --git a/templates/web/base/report/new/form_user_loggedout.html b/templates/web/base/report/new/form_user_loggedout.html index c444ebce4..4142f4582 100644 --- a/templates/web/base/report/new/form_user_loggedout.html +++ b/templates/web/base/report/new/form_user_loggedout.html @@ -3,7 +3,7 @@ <div class="form-box"> <button name="facebook_sign_in" id="facebook_sign_in" value="facebook_sign_in" class="btn btn--block btn--social btn--facebook"> <img alt="" src="/i/facebook-icon-32.png" width="17" height="32"> - Log in with Facebook + [% loc('Log in with Facebook') %] </button> </div> [% END %] @@ -11,7 +11,7 @@ <div class="form-box"> <button name="twitter_sign_in" id="twitter_sign_in" value="twitter_sign_in" class="btn btn--block btn--social btn--twitter"> <img alt="" src="/i/twitter-icon-32.png" width="17" height="32"> - Log in with Twitter + [% loc('Log in with Twitter') %] </button> </div> [% END %] diff --git a/templates/web/base/report/photo-js.html b/templates/web/base/report/photo-js.html index 05588d085..91b9930e7 100644 --- a/templates/web/base/report/photo-js.html +++ b/templates/web/base/report/photo-js.html @@ -1,6 +1,6 @@ [% extra_css = BLOCK %] <link rel="stylesheet" href="[% version('/js/fancybox/jquery.fancybox-1.3.4.css') %]"> [% END %] -[% extra_js = BLOCK %] - <script src="[% version('/js/fancybox/jquery.fancybox-1.3.4.pack.js') %]" charset="utf-8"></script> -[% END %] +[% extra_js = [ + version('/js/fancybox/jquery.fancybox-1.3.4.pack.js') +] %] diff --git a/templates/web/base/report/update.html b/templates/web/base/report/update.html index d423a193d..51c1a9e4f 100644 --- a/templates/web/base/report/update.html +++ b/templates/web/base/report/update.html @@ -9,15 +9,15 @@ [% IF moderating; original_update = update.moderation_original_data %] <form method="post" action="/moderate/report/[% problem.id %]/update/[% update.id %]"> <input type="hidden" name="token" value="[% csrf_token %]"> - <input type="button" class="btn js-moderate moderate-display" value="Moderate this update"> + <input type="button" class="btn js-moderate moderate-display" value="[% loc('Moderate this update') %]"> <div class="moderate-edit"> <label><input type="checkbox" class="hide-document" name="update_hide"> - Hide update completely?</label> + [% loc('Hide update completely?') %]</label> <label><input type="checkbox" name="update_show_name" [% update.anonymous ? '' : 'checked' %]> - Show name publicly?</label> + [% loc('Show name publicly?') %]</label> [% IF update.photo or original_update.photo %] <label><input type="checkbox" name="update_show_photo" [% update.photo ? 'checked' : '' %]> - Show Photo?</label> + [% loc('Show Photo?') %]</label> [% END %] </div> [% END %] @@ -37,7 +37,7 @@ <div class="moderate-edit"> [% IF update.text != original.detail %] <label><input type="checkbox" name="update_revert_detail" class="revert-textarea"> - Revert to original</label> + [% loc('Revert to original') %]</label> [% END %] <textarea class="form-control" name="update_detail">[% update.text | add_links %]</textarea> </div> @@ -46,7 +46,7 @@ <p class="meta-2"> [% INCLUDE meta_line %] [% mlog = update.latest_moderation_log_entry(); IF mlog %] - <br /> Moderated by [% mlog.user.from_body.name %] at [% prettify_dt(mlog.whenedited) %] + <br />[% tprintf(loc('Moderated by %s at %s'), mlog.admin_user, prettify_dt(mlog.whenedited)) %] [% END %] </p> </div> @@ -54,11 +54,11 @@ </div> [% IF moderating %] <div class="moderate-edit"> - <label for="moderation_reason">Moderation reason:</label> + <label for="moderation_reason">[% loc('Moderation reason:') %]</label> <input type="text" class="form-control" name="moderation_reason" - placeholder="Describe why you are moderating this"> - <input type="submit" class="red-btn" value="Save changes"> - <input type="button" class="btn cancel" value="Discard changes"> + placeholder="[% loc('Describe why you are moderating this') %]"> + <input type="submit" class="red-btn" value="[% loc('Save changes') %]"> + <input type="button" class="btn cancel" value="[% loc('Discard changes') %]"> </div> </form> [% END %] diff --git a/templates/web/base/report/update/form_update.html b/templates/web/base/report/update/form_update.html index a3d4615e1..f15a1f74b 100644 --- a/templates/web/base/report/update/form_update.html +++ b/templates/web/base/report/update/form_update.html @@ -41,16 +41,20 @@ [% FOREACH state IN [ ['confirmed', loc('Open')], ['investigating', loc('Investigating')], ['action scheduled', loc('Action Scheduled')], ['in progress', loc('In Progress')], ['duplicate', loc('Duplicate')], - ['unable to fix', loc('Unable to fix')], ['not responsible', loc('Not Responsible')], + ['unable to fix', loc('No further action')], ['not responsible', loc('Not Responsible')], ['fixed', loc('Fixed')] ] %] <option [% 'selected ' IF state.0 == problem.state_display %] value="[% state.0 %]">[% state.1 %]</option> [% END %] </select> [% ELSE %] - [% IF problem.is_fixed AND ((c.user_exists AND c.user.id == problem.user_id) OR alert_to_reporter) %] + [% IF (problem.is_fixed OR problem.state == 'closed') AND ((c.user_exists AND c.user.id == problem.user_id) OR alert_to_reporter) %] - <input type="checkbox" name="reopen" id="form_reopen" value="1"[% ' checked' IF update.mark_open %]> - <label class="inline" for="form_reopen">[% loc('This problem has not been fixed') %]</label> + <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> + [% ELSE %] + <label class="inline" for="form_reopen">[% loc('This problem has not been fixed') %]</label> + [% END %] [% ELSIF !problem.is_fixed %] diff --git a/templates/web/base/report/update/form_user_loggedout.html b/templates/web/base/report/update/form_user_loggedout.html index fa26eb8f4..d9f67e06e 100644 --- a/templates/web/base/report/update/form_user_loggedout.html +++ b/templates/web/base/report/update/form_user_loggedout.html @@ -4,7 +4,7 @@ <div class="form-box"> <button name="facebook_sign_in" id="facebook_sign_in" value="facebook_sign_in" class="btn btn--block btn--social btn--facebook"> <img alt="" src="/i/facebook-icon-32.png" width="17" height="32"> - Log in with Facebook + [% loc('Log in with Facebook') %] </button> </div> [% END %] @@ -12,7 +12,7 @@ <div class="form-box"> <button name="twitter_sign_in" id="twitter_sign_in" value="twitter_sign_in" class="btn btn--block btn--social btn--twitter"> <img alt="" src="/i/twitter-icon-32.png" width="17" height="32"> - Log in with Twitter + [% loc('Log in with Twitter') %] </button> </div> [% END %] diff --git a/templates/web/base/report/updates.html b/templates/web/base/report/updates.html index ff48ecbca..75e94b1d5 100644 --- a/templates/web/base/report/updates.html +++ b/templates/web/base/report/updates.html @@ -11,54 +11,6 @@ [% RETURN %] [% END %] - [% IF update.anonymous || update.name == '' %] - [% tprintf( loc( 'Posted anonymously at %s' ), prettify_dt( update.confirmed ) ) -%] - [%- ELSIF update.user.from_body; - user_name = update.user.name | html; - body = update.user.body; - IF body == 'Bromley Council'; - body = "$body <img src='/cobrands/bromley/favicon.png' alt=''>"; - END %] - [% tprintf( loc( 'Posted by %s (<strong>%s</strong>) at %s' ), user_name, body, prettify_dt( update.confirmed ) ) -%] - [%- ELSE %] - [% tprintf( loc( 'Posted by %s at %s' ), update.name, prettify_dt( update.confirmed ) ) | html -%] - [%- END -%] + [% update.meta_line(c) %] - [%- update_state = '' %] - [%- IF update.mark_fixed %][% update_state = loc( 'marked as fixed' ) %][% END %] - [%- IF update.mark_open %][% update_state = loc( 'reopened' ) %][% END %] - [%- IF !update_state && update.problem_state %] - [%- state = update.problem_state_display %] - [%- IF c.cobrand.moniker == 'bromley' OR problem.bodies_str == '2482' %] - [%- SET update_state = 'marked as no further action' IF state == 'unable to fix' %] - [%- SET update_state = 'marked as third party responsibility' IF state == 'not responsible' %] - [%- END %] - [%- END %] - [%- IF !update_state && update.problem_state %] - [%- IF state == 'confirmed' AND global.last_state != '' %] - [%- update_state = loc( 'reopened' ) %] - [%- ELSIF state == 'investigating' %] - [%- update_state = loc( 'marked as investigating' ) %] - [%- ELSIF state == 'planned' %] - [%- update_state = loc( 'marked as planned' ) %] - [%- ELSIF state == 'in progress' %] - [%- update_state = loc( 'marked as in progress' ) %] - [%- ELSIF state == 'action scheduled' %] - [%- update_state = loc( 'marked as action scheduled' ) %] - [%- ELSIF state == 'closed' %] - [%- update_state = loc( 'marked as closed' ) %] - [%- ELSIF state == 'fixed' %] - [%- update_state = loc( 'marked as fixed' ) %] - [%- ELSIF state == 'unable to fix' %] - [%- update_state = loc( 'marked as unable to fix' ) %] - [%- ELSIF state == 'not responsible' %] - [%- update_state = loc( "marked as not the council's responsibility" ) %] - [%- ELSIF state == 'duplicate' %] - [%- update_state = loc( 'closed as a duplicate report' ) %] - [%- ELSIF state == 'internal referral' %] - [%- update_state = loc( 'marked as an internal referral' ) %] - [%- END %] - [%- END %] - [%- ", " _ update_state IF update_state != global.last_state %] - [%- global.last_state = update_state %] [% END %] diff --git a/templates/web/base/reports/_list-filters.html b/templates/web/base/reports/_list-filters.html index 9c2a74e57..e657e0375 100644 --- a/templates/web/base/reports/_list-filters.html +++ b/templates/web/base/reports/_list-filters.html @@ -1,5 +1,14 @@ [% select_status = BLOCK %] - <select class="form-control js-multiple" name="status" id="statuses" multiple data-all="[% loc('All reports') %]"> + <select class="form-control js-multiple" name="status" id="statuses" multiple + data-all="[% loc('All reports') %]" data-all-options='["open","closed","fixed"]' + [%~ IF c.cobrand.on_map_default_status == 'open' %] + data-none="[% loc('Unfixed reports') %]" + [%~ END ~%] + > + [% IF c.user_exists AND c.user.has_body_permission_to('planned_reports') AND !shortlist %] + <option value="shortlisted"[% ' selected' IF filter_status.shortlisted %]>[% loc('Shortlisted') %]</option> + <option value="unshortlisted"[% ' selected' IF filter_status.unshortlisted %]>[% loc('Unshortlisted') %]</option> + [% END %] <option value="open"[% ' selected' IF filter_status.open %]>[% loc('Unfixed reports') %]</option> <option value="closed"[% ' selected' IF filter_status.closed %]>[% loc('Closed reports') %]</option> <option value="fixed"[% ' selected' IF filter_status.fixed %]>[% loc('Fixed reports') %]</option> @@ -10,7 +19,7 @@ [% 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 | html %]"[% ' selected' IF filter_category.grep(cat).size %]> + <option value="[% cat | html %]"[% ' selected' IF filter_category.$cat %]> [% cat | html %] </option> [% END %] @@ -32,6 +41,9 @@ <p class="report-list-filters"> <label for="sort">[% loc('Sort by') %]</label> <select class="form-control" name="sort" id="sort"> + [% IF shortlist %] + <option value="shortlist"[% ' selected' IF sort_key == 'shortlist' %]>[% loc('Manual order') %]</option> + [% END %] <option value="created-desc"[% ' selected' IF sort_key == 'created-desc' %]>[% loc('Newest') %]</option> <option value="created-asc"[% ' selected' IF sort_key == 'created-asc' %]>[% loc('Oldest') %]</option> <option value="updated-desc"[% ' selected' IF sort_key == 'updated-desc' %]>[% loc('Recently updated') %]</option> diff --git a/templates/web/base/reports/index.html b/templates/web/base/reports/index.html index 4a7d5a9c9..b07227144 100755 --- a/templates/web/base/reports/index.html +++ b/templates/web/base/reports/index.html @@ -1,6 +1,6 @@ -[% extra_js = BLOCK %] - <script src="[% version('/js/jquery.fixedthead.js') %]"></script> -[% END -%] +[% extra_js = [ + version('/js/jquery.fixedthead.js') +] -%] [% INCLUDE 'header.html', title = loc('Summary reports'), bodyclass => 'fullwidthpage' %] <h1>[% loc('All Reports') %]</h1> |