diff options
Diffstat (limited to 'templates/web/base')
145 files changed, 2119 insertions, 1044 deletions
diff --git a/templates/web/base/admin/bodies/_category_field.html b/templates/web/base/admin/bodies/_category_field.html new file mode 100644 index 000000000..8c5a1c352 --- /dev/null +++ b/templates/web/base/admin/bodies/_category_field.html @@ -0,0 +1,17 @@ +<div class="admin-hint"> + <p> + [% loc('Choose a <strong>category</strong> name that makes sense to the public (e.g., "Pothole", "Street lighting") but is helpful + to the body too. These will appear in the drop-down menu on the report-a-problem page.') %] + <br> + [% loc("If two or more bodies serve the same location, FixMyStreet combines identical categories into a single entry in + the menu. Make sure you use the same category name in the bodies if you want this to happen.") %] + </p> +</div> + +<p> + <strong>[% loc('Category') %] </strong><input type="text" class="form-control" name="category" size="30" value="[% contact.category | html %]" required> +</p> + +[% IF contact.in_storage %] + <input type="hidden" name="current_category" value="[% current_contact.category | html %]" > +[% END %] diff --git a/templates/web/base/admin/bodies/body.html b/templates/web/base/admin/bodies/body.html index 8f298676e..0db50e97b 100644 --- a/templates/web/base/admin/bodies/body.html +++ b/templates/web/base/admin/bodies/body.html @@ -70,15 +70,16 @@ <table cellspacing="0" cellpadding="2" border="1" id="admin_contacts"> <tr> - <th>[% loc('Category') %]</th> - <th>[% loc('State') %]</th> - <th>[% loc('Last editor') %]</th> - <th>[% loc('Note') %]</th> + <th scope="col">[% loc('Category') %]</th> + <th scope="col">[% loc('State') %]</th> + <th scope="col">[% loc('Last editor') %]</th> + <th scope="col">[% loc('Note') %]</th> [% IF any_not_confirmed %] - <th>[% loc('Confirm') %]</th> + <th scope="col">[% loc('Confirm') %]</th> [% END %] </tr> - [% WHILE ( cat = contacts.next ) %] + + [% BLOCK category_row %] <tr [% IF cat.state == 'deleted' %]class="is-deleted"[% END %]> <td class="contact-category"><a href="[% c.uri_for_action( '/admin/bodies/edit', [ body_id ], cat.category ) %]">[% cat.category_display | html %]</a> <br>[% cat.email | html %]</td> @@ -102,6 +103,24 @@ [% END %] </tr> [% END %] + + [%~ IF category_groups.size ~%] + [%~ FOREACH group IN category_groups ~%] + [% IF group.name %] + <tr> + <th class="group" colspan="[% any_not_confirmed ? 5 : 4 %]" scope="colgroup">[% group.name %]</th> + </tr> + [% END %] + [%~ FOREACH cat IN group.categories ~%] + [% INCLUDE category_row %] + [%~ END ~%] + [%~ END =%] + [%~ ELSE ~%] + [%~ FOREACH cat IN contacts ~%] + [% INCLUDE category_row %] + [%~ END =%] + [%~ END ~%] + </table> [% IF any_not_confirmed %] @@ -129,7 +148,7 @@ [% IF errors %] <div class="fms-admin-warning"> - [% errors.values.join('<br>') %] + [% FOR error IN errors.values %][% error %][% IF NOT loop.last %]<br>[% END %][% END %] </div> [% INCLUDE 'admin/bodies/contact-form.html' translations=contact_translations %] [% ELSE %] diff --git a/templates/web/base/admin/bodies/contact-form.html b/templates/web/base/admin/bodies/contact-form.html index c55c5c036..35fab4541 100644 --- a/templates/web/base/admin/bodies/contact-form.html +++ b/templates/web/base/admin/bodies/contact-form.html @@ -1,102 +1,74 @@ <form method="post" action="[% c.uri_for_action('admin/bodies/edit', [ body_id ] ) %]" enctype="application/x-www-form-urlencoded" accept-charset="utf-8" id="category_edit"> - [% IF contact.in_storage %] - <p> - <h1>[% contact.category_display | html %]</h1> - <input type="hidden" name="category" value="[% contact.category | html %]" > - </p> - [% ELSE %] - <div class="admin-hint"> - <p> - [% loc('Choose a <strong>category</strong> name that makes sense to the public (e.g., "Pothole", "Street lighting") but is helpful - to the body too. These will appear in the drop-down menu on the report-a-problem page.') %] - <br> - [% loc("If two or more bodies serve the same location, FixMyStreet combines identical categories into a single entry in - the menu. Make sure you use the same category name in the bodies if you want this to happen.") %] - </p> - </div> - <p> - <strong>[% loc('Category') %] </strong><input type="text" class="form-control" name="category" size="30" value="[% contact.category | html %]" required> - </p> - [% END %] + [% PROCESS 'admin/bodies/_category_field.html' %] [% INCLUDE 'admin/bodies/_translations.html' %] - <div class="admin-hint"> - <p> - [% loc("The <strong>email address</strong> is the destination to which reports about this category will be sent. - Other categories for this body may have the same email address.") %] + <label for="destination">[% loc('Destination') %]</label> + <p class="form-hint" id="destination-hint"> + [% IF body.can_be_devolved %] + [% loc('An email address or service ID (Open311 or similar).') %] + [% ELSIF body.send_method == 'Open311' %] + [% loc('A service ID (Open311 or similar).') %] + [% ELSIF body.send_method.match('Email') OR NOT body.send_method %] + [% loc('An email address.') %] + [% ELSE %] + [% loc('An email address or service ID (Open311 or similar).') %] + [% END %] </p> - [% IF (body.send_method AND body.send_method.match('Email')) OR body.can_be_devolved %] - <p> - [% loc("If you're using <strong>a send method that is not email</strong>, enter the service ID (Open311) or equivalent identifier here.") %] - </p> - [% END %] - </div> + <input type="text" class="form-control" id="destination" aria-describedby="destination-hint" name="email" size="30" value="[% contact.email | html %]" required> - <p> - <strong>[% loc('Email address') %] </strong><input type="text" class="form-control" name="email" size="30" value="[% contact.email | html %]" required> - </p> + <fieldset> + <legend>[% loc('State') %]</legend> + <div class="form-check form-check--inline"> + <input type="radio" name="state" id="state-unconfirmed" aria-describedby="state-unconfirmed-hint" value="unconfirmed"[% ' checked' IF contact.state == 'unconfirmed' %]> + <label for="state-unconfirmed">[% loc('Unconfirmed') %]</label> + <p class="form-hint" id="state-unconfirmed-hint">[% loc('You are not sure of the origin or validity of the contact.') %]</p> + </div> + <div class="form-check form-check--inline"> + <input type="radio" name="state" id="state-confirmed" aria-describedby="state-confirmed-hint" value="confirmed"[% ' checked' IF contact.state == 'confirmed' || contact.state == "" %]> + <label for="state-confirmed">[% loc('Confirmed') %]</label> + <p class="form-hint" id="state-confirmed-hint">[% loc('The contact has been confirmed as correct.') %]</p> + </div> + <div class="form-check form-check--inline"> + <input type="radio" name="state" id="state-inactive" aria-describedby="state-inactive-hint" value="inactive"[% ' checked' IF contact.state == 'inactive' %]> + <label for="state-inactive">[% loc('Inactive') %]</label> + <p class="form-hint" id="state-inactive-hint">[% loc('Prevent new reports from using this category, but keep it available in map filters.') %]</p> + </div> + <div class="form-check form-check--inline"> + <input type="radio" name="state" id="state-deleted" aria-describedby="state-deleted-hint" value="deleted"[% ' checked' IF contact.state == 'deleted' %]> + <label for="state-deleted">[% loc('Deleted') %]</label> + <p class="form-hint" id="state-deleted-hint">[% loc('Prevent new reports from using this category, <em>and</em> also remove it from map filters.') %]</p> + </div> + <div class="form-check form-check--inline"> + <input type="radio" name="state" id="state-staff" aria-describedby="state-staff-hint" value="staff"[% ' checked' IF contact.state == 'staff' %]> + <label for="state-staff">[% loc('Staff only') %]</label> + <p class="form-hint" id="state-staff-hint">[% loc('Only staff users will be able to add reports in this category.') %]</p> + </div> + </fieldset> - <div class="admin-hint"> - <p> - [% -loc("Use <strong>confirmed</strong> to indicate that this contact has been -confirmed as correct. If you are not sure of the origin or validity of the -contact, use <strong>unconfirmed</strong>. <strong>inactive</strong> will -remove the category from use when reporting problems, but keep it available in -map filters, and <strong>deleted</strong> will remove the category from there -as well.") %] + <p class="form-check"> + <input type="checkbox" name="non_public" value="1" id="non_public" [% ' checked' IF contact.non_public %]> + <label for="non_public">[% loc('Hide reports made in this category') %]</label> + <span class='form-hint'>[% loc('Use this for issues that you want to allow users to report, but for which there is no public interest in displaying the report, like requesting an extra rubbish bin at a specific address.') %]</span> </p> - </div> - <p> - <label for="state">[% loc('State') %]</label> - <select name="state" id="state"> - <option value="unconfirmed"[% ' selected' IF contact.state == 'unconfirmed' %]>[% loc('Unconfirmed') %] - <option value="confirmed"[% ' selected' IF contact.state == 'confirmed' || contact.state == "" %]>[% loc('Confirmed') %] - <option value="inactive"[% ' selected' IF contact.state == 'inactive' %]>[% loc('Inactive') %] - <option value="deleted"[% ' selected' IF contact.state == 'deleted' %]>[% loc('Deleted') %] - </select> - </p> - <div class="admin-hint"> - <p> - [% loc("Check <strong>private</strong> if reports in this category should <strong>never be displayed on the website</strong>. - <br> - Normally, categories are not private. - <br> - This is suitable for issues that you want to allow users to report to the body, but for which there is no public - interest in displaying the report. In the UK, we've used this for services like requesting an extra rubbish bin - at a specific address.") %] + <p class="form-check"> + <input type="checkbox" name="disable" value="1" id="disable" data-toggle-visibility="#js-disable-form-message-box" [% ' checked' IF contact.disable_form_field %]> + <label for="disable">[% loc('Disable form when this category is selected') %]</label> </p> - </div> - <p> - <input type="checkbox" name="non_public" value="1" id="non_public" [% ' checked' IF contact.non_public %]> - <label for="non_public" class="inline">[% loc('Private') %]</label> - </p> - <div class="admin-hint"> - <p> - [% loc("Check <strong>inspection required</strong> if reports in this category <strong>must be inspected</strong> before being sent.") %] + <p class="form-group form-group--indented [% 'hidden-js' IF NOT contact.disable_form_field %]" id="js-disable-form-message-box"> + <label for="disabled-message">[% loc('Message to show when form is disabled (HTML permitted)') %]</label> + <textarea id="disabled-message" name="disable_message" class="form-control">[% contact.disable_form_field.description %]</textarea> </p> - </div> - <p> - <input type="checkbox" name="inspection_required" value="1" id="inspection_required" [% 'checked' IF contact.get_extra_metadata('inspection_required') %]> - <label for="inspection_required" class="inline">[% loc('Inspection required') %]</label> - </p> - <div class="admin-hint [% 'hidden' UNLESS contact.get_extra_metadata('inspection_required') %]"> - <p> - [% loc("Reports will automatically be sent without needing to be inspected if the user's <strong>reputation</strong> is at or above this value. Set to <strong>0</strong> if all reports must be inspected regardless.") %] - </p> - </div> - <p [% 'class=hidden' UNLESS contact.get_extra_metadata('inspection_required') %]> - <label> - [% loc('Reputation threshold') %] - <input type="text" class="form-control" name="reputation_threshold" id="reputation_threshold" - value="[% contact.get_extra_metadata('reputation_threshold') | html %]" size="30"> - </label> - </p> + [% IF body.send_method == '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 body.can_be_devolved %] <div class="admin-hint"> @@ -121,34 +93,37 @@ as well.") %] [% END %] [% IF c.cobrand.enable_category_groups %] - <div class="admin-hint"> - <p> - [% loc( - "The <strong>group</strong> is used for the top-level category field when - subcategory grouping is enabled." - ) %] - </p> - </div> <p> <label> - [% loc('Group') %] - <input class="form-control" type="text" name="group" value="[% contact.extra.group | html %]" size="30"> + [% loc('Parent categories') %] + [% IF contact.extra.group %] + [% FOR group IN contact.extra.group %] + <input class="form-control" type="text" name="group" value="[% group | html %]" size="30"> + [% END %] + [% ELSE %] + <input class="form-control" type="text" name="group" value="" size="30"> + [% END %] + <input class="hidden-js js-group-item-template form-control" type="text" name="group" value="" size="30"> + <p class="hidden-nojs"> + <button type="button" class="btn btn--small js-group-item-add">[% loc('Add another parent category') %]</button> + </p> </label> </p> [% END %] + <h2>[% loc('Extra data:') %] </h2> + <dl> + [% FOR pair IN contact.get_extra_metadata %] + <dt>[% pair.key %]</dt> <dd>[% pair.value OR '<em>-</em>' %]</dd> + [% END %] + </dl> + [% INCLUDE 'admin/extra-metadata-form.html' metas=(contact.get_metadata_for_editing OR []) %] - <div class="admin-hint"> - <p> - [% loc("Use this field to record details that are only displayed in the admin. Input is not shown publicly, and is not sent to the body.") %] + <p class="form-group" style="margin-top: 2em"> + <label for="note">[% loc('Summarise your changes') %]</label> + <span class="form-hint" id="note-hint">[% loc("If you’ve made changes, leave a note explaining what, for other admins to see.") %]</span> + <input class="form-control" type="text" id="note" name="note" size="30" aria-describedby="note-hint"[% ' required' UNLESS c.config.STAGING_SITE %]> </p> - </div> - <p> - <label> - [% loc('Summarise your changes') %] - <input class="form-control" type="text" name="note" size="30" required> - </label> - </p> <p> <input type="hidden" name="posted" value="new" > @@ -156,11 +131,5 @@ as well.") %] <input type="submit" class="btn" name="Create category" value="[% contact.in_storage ? loc('Save changes') : loc('Create category') %]" > </p> - <h2>[% loc('Extra data:') %] </h2> - <dl> - [% FOR pair IN contact.get_extra_metadata %] - <dt>[% pair.key %]</dt> <dd>[% pair.value %]</dd> - [% END %] - </dl> - [% INCLUDE 'admin/extra-metadata-form.html' metas=(contact.get_metadata_for_editing OR []) %] + </form> diff --git a/templates/web/base/admin/bodies/open311-form-fields.html b/templates/web/base/admin/bodies/open311-form-fields.html index bdd4ad935..dbb0f84e2 100644 --- a/templates/web/base/admin/bodies/open311-form-fields.html +++ b/templates/web/base/admin/bodies/open311-form-fields.html @@ -90,7 +90,7 @@ <label for"comment_user_id">[% loc('User ID to attribute fetched comments to') %]</label> <input type="text" class="form-control" name="comment_user_id" value="[% object.comment_user_id %]"> [% IF object.comment_user_id %] - <a href="[% c.uri_for_action('admin/users/edit', object.comment_user_id) %]">[% loc('edit user') %]</a> + <a href="[% c.uri_for_action('admin/users/edit', [ object.comment_user_id ]) %]">[% loc('edit user') %]</a> [% END %] </p> @@ -161,7 +161,7 @@ </p> </div> <p> - <input type="checkbox" id="fetch_all_problems" name="fetch_all_problems"[% ' checked' IF object.get_extra_metadata('fetch_all_problems') %]> + <input type="checkbox" id="fetch_all_problems" name="extra[fetch_all_problems]"[% ' checked' IF object.get_extra_metadata('fetch_all_problems') %]> <label for="fetch_all_problems" class="inline">[% loc('Always fetch all problems') %]</label> </p> </div> diff --git a/templates/web/base/admin/category-checkboxes.html b/templates/web/base/admin/category-checkboxes.html index eacd1a398..cf9530f22 100644 --- a/templates/web/base/admin/category-checkboxes.html +++ b/templates/web/base/admin/category-checkboxes.html @@ -1,12 +1,4 @@ -<fieldset> - <legend> - [% IF hint %] - <div class="admin-hint"> - <p>[% hint %]</p> - </div> - [% END %] - [% loc('Categories:') %] - </legend> +[% BLOCK checkboxes %] <ul class="no-bullets no-margin"> <li> [% loc('Select:') %] @@ -18,8 +10,31 @@ <label class="inline" title="[% contact.email | html %]"> <input type="checkbox" name="contacts[[% contact.id %]]" [% 'checked' IF contact.active %]/> [% contact.category %] + [% IF contact.group.size > 1 %]<small>([% contact.group.join('; ') | html %])</small>[% END %] </label> </li> [% END %] </ul> +[% END %] +<fieldset> + <legend> + [% IF hint %] + <div class="admin-hint"> + <p>[% hint %]</p> + </div> + [% END %] + [% loc('Categories:') %] + </legend> + + [% IF category_groups %] + [% FOR group IN category_groups %] + <h3>[% ( group.name OR loc('No Group') ) | html %]</h3> + [% IF group.name == loc("Multiple Groups") %] + <small>[% loc('These categories appear in more than one group:') %]</small> + [% END %] + [% INCLUDE checkboxes contacts=group.categories %] + [% END %] + [% ELSE %] + [% INCLUDE checkboxes contacts=contacts %] + [% END %] </fieldset> diff --git a/templates/web/base/admin/config_page.html b/templates/web/base/admin/config_page.html index 8e8d562ff..a534292be 100644 --- a/templates/web/base/admin/config_page.html +++ b/templates/web/base/admin/config_page.html @@ -51,7 +51,12 @@ running version <strong>[% git_version || 'unknown' %]</strong>. [% INCLUDE just_value value="ALLOWED_COBRANDS" conf = allowed_conf %] <tr> <td>Web templates</td> -<td colspan=2>[% c.cobrand.path_to_web_templates.join('<br>') %]</td> +<td colspan=2> + [% FOR path IN c.cobrand.path_to_web_templates %] + [% path %] + [% IF NOT loop.last %]<br>[% END %] + [% END %] +</td> </tr> [% INCLUDE with_cobrand value="MAP_TYPE" cob=c.cobrand.map_type %] [% INCLUDE with_cobrand value="EXAMPLE_PLACES" @@ -117,7 +122,7 @@ running version <strong>[% git_version || 'unknown' %]</strong>. [% INCLUDE just_value value="EMAIL_DOMAIN" %] [% INCLUDE with_cobrand value="CONTACT_NAME" cob=c.cobrand.contact_name %] [% INCLUDE with_cobrand value="CONTACT_EMAIL" cob=c.cobrand.contact_email %] -[% INCLUDE just_value value="DO_NOT_REPLY_EMAIL" %] +[% INCLUDE with_cobrand value="DO_NOT_REPLY_EMAIL" cob=c.cobrand.do_not_reply_email %] [% INCLUDE subsection heading="Development" %] [% INCLUDE just_value value="STAGING_SITE" %] diff --git a/templates/web/base/admin/council_contacts.txt b/templates/web/base/admin/council_contacts.txt index f11615789..2622f3fc2 100644 --- a/templates/web/base/admin/council_contacts.txt +++ b/templates/web/base/admin/council_contacts.txt @@ -1,4 +1,4 @@ -[% WHILE ( contact = contacts.next ) -%] +[% FOR contact IN contacts -%] [%- NEXT IF contact.state != 'confirmed' %] [% contact.category_display %] [% contact.email %] [%- END %] diff --git a/templates/web/base/admin/defecttypes/list.html b/templates/web/base/admin/defecttypes/list.html index ffff89eff..5730710d9 100644 --- a/templates/web/base/admin/defecttypes/list.html +++ b/templates/web/base/admin/defecttypes/list.html @@ -10,10 +10,9 @@ </tr> </thead> <tbody> - [% PROCESS 'defect_type/format.html' %] [% FOR d IN defect_types %] <tr> - <td> [% defect_type_format(defect_type=d) %] </td> + <td> [% d.name | html %] </td> <td> [% d.description | html %] </td> <td> [% UNLESS d.contacts.size %] diff --git a/templates/web/base/admin/exordefects/index.html b/templates/web/base/admin/exordefects/index.html deleted file mode 100644 index 65b2aa486..000000000 --- a/templates/web/base/admin/exordefects/index.html +++ /dev/null @@ -1,39 +0,0 @@ -[% 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"> - <div class="filters"> - <p> - <label for="start_date">[% ('Start Date:') %]</label><input type="date" class="form-control" - name="start_date" id="start_date" - value="[% start_date ? start_date.strftime( '%Y-%m-%d') : '' | html %]" /> - </p> - - <p> - <label for="end_date">[% ('End Date:') %]</label><input type="date" class="form-control" - name="end_date" id="end_date" size="5" - value="[% end_date ? end_date.strftime( '%Y-%m-%d') : '' | html %]" /> - </p> - - <p> - <label for="user_id">[% ('Inspector:') %]</label> - <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> - </div> - - <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/extra-metadata-form.html b/templates/web/base/admin/extra-metadata-form.html index 4fc5d8e3f..9b8e4909f 100644 --- a/templates/web/base/admin/extra-metadata-form.html +++ b/templates/web/base/admin/extra-metadata-form.html @@ -1,91 +1,11 @@ -<ul class="js-metadata-items"> - [% FOR meta IN metas.merge([{}]) %] - <li class="js-metadata-item [% IF loop.last %]hidden-js js-metadata-item-template[% END %]" data-index="[% loop.index %]"> - <button class="btn btn--small js-metadata-item-remove hidden-nojs">[% loc('Remove field') %]</button> +<div class="extra-metadata-form js-metadata-items"> + [% FOR meta IN metas %] + [% INCLUDE 'admin/extra-metadata-item.html' i=loop.index collapsed=1 %] + [% END %] +</div> - <div class="admin-hint"><p>[% loc('The ordering of this field on the report page. Fields are shown in ascending order according to this value.') %]</p></div> - <label> - [% loc('Order') %] - <input name="metadata[[% loop.index %]].order" data-field-name="order" type=text value="[% meta.order OR 0 | html %]"> - </label> +<div class="hidden-js" id="js-template-extra-metadata-item"> + [% INCLUDE 'admin/extra-metadata-item.html' meta={} i=9999 collapsed=0 %] +</div> - <div class="admin-hint"><p>[% loc('Whether the field is displayed to the user, included as a hidden field and automatically populated, or set by the server upon Open311 submission. This field is usually set automatically.') %]</p></div> - <label> - [% loc('Automated') %] - <select name="metadata[[% loop.index %]].automated" data-field-name="automated"> - <option value="" [% meta.automated == '' ? 'selected' : '' %]></option> - <option value="server_set" [% meta.automated == 'server_set' ? 'selected' : '' %]>[% loc('Server Set') %]</option> - <option value="hidden_field" [% meta.automated == 'hidden_field' ? 'selected' : '' %]>[% loc('Hidden Field') %]</option> - </select> - </label> - - <div class="admin-hint"><p>[% loc('The code used to store this field value in the database. e.g. <code>address</code> would be available as <code>problem.extra.address</code> in the templates.') %]</p></div> - <label> - [% loc('Code') %] - <input name="metadata[[% loop.index %]].code" data-field-name="code" type=text value="[% meta.code | html %]"> - </label> - - <div class="admin-hint"><p>[% loc('Whether the user is required to provide a value for this field.') %]</p></div> - <label> - [% loc('Required') %] - <input name="metadata[[% loop.index %]].required" data-field-name="required" type=checkbox [% meta.required == 'true' ? 'checked' : '' %]> - </label> - - <div class="admin-hint"><p>[% loc('If ticked the user won’t see an input field, just the ‘Description’ text.') %]</p></div> - <label> - [% loc('Notice') %] - <input name="metadata[[% loop.index %]].notice" data-field-name="notice" type=checkbox [% meta.variable == 'false' ? 'checked' : '' %]> - </label> - - <div class="admin-hint"><p>[% loc('The field name as shown to the user on the report form.') %]</p></div> - <label> - [% loc('Description') %] - <input name="metadata[[% loop.index %]].description" data-field-name="description" type=text value="[% meta.description | html %]"> - </label> - - <div class="admin-hint"><p>[% loc('Can be used to display extra text to the user alongside the field. The default template does not show this (<code>meta.datatype_description</code>), you must add it in <code>category_extras_fields.html</code>') %]</p></div> - <label> - [% loc('Hint') %] - <input name="metadata[[% loop.index %]].datatype_description" data-field-name="datatype_description" type=text value="[% meta.datatype_description | html %]"> - </label> - - <div class="admin-hint"><p>[% loc('The type of input field to show to the user. <strong>Text</strong> is a simple text field, <strong>List</strong> is a drop-down selection.') %]</p></div> - <label> - [% loc('Type') %] - <select name="metadata[[% loop.index %]].datatype" data-field-name="datatype" class="js-metadata-item-type"> - <option value="string" [% meta.datatype == 'string' ? 'selected' : '' %]>[% loc('String') %]</option> - <option value="singlevaluelist" [% meta.datatype == 'singlevaluelist' ? 'selected' : '' %]>[% loc('List') %]</option> - </select> - </label> - - <div class="js-metadata-options"> - <div class="admin-hint"><p>[% loc('For each option, <strong>Key</strong> is the value which is stored in the database for that option and <strong>Name</strong> is the value displayed to the user.') %]</p></div> - [% loc('Options') %]<span class="hidden-js"> [% loc('(ignored if type is "String")') %]</span> - <ul> - [% outer_loop = loop %] - [% values = meta.values OR [] %] - [% FOREACH option IN values.merge([{}]) %] - [%# the .merge() call is so there's an empty one on the end %] - <li class="js-metadata-option [% IF loop.last %]hidden-js js-metadata-option-template[% END %]"> - <label> - [% loc('Key') %] - <input class="js-metadata-option-key" name="metadata[[% outer_loop.index %]].values[[% loop.index %]].key" type="text" value="[% option.key | html %]"> - </label> - <label> - [% loc('Name') %] - <input class="js-metadata-option-name" name="metadata[[% outer_loop.index %]].values[[% loop.index %]].name" type="text" value="[% option.name | html %]"> - </label> - <button class="btn btn--small js-metadata-option-remove hidden-nojs">[% loc('Remove') %]</button> - </li> - [% END %] - <li class="hidden-nojs"> - <button class="btn btn--small js-metadata-option-add">[% loc('Add option') %]</button> - </li> - </ul> - </div> - </li> - [%- END %] - <li class="hidden-nojs"> - <button class="btn btn--small js-metadata-item-add">[% loc('Add field') %]</button> - </li> -</ul> +<button type="button" class="btn btn--small js-metadata-item-add hidden-nojs">[% loc('Add field') %]</button> diff --git a/templates/web/base/admin/extra-metadata-item.html b/templates/web/base/admin/extra-metadata-item.html new file mode 100644 index 000000000..66cb6f79c --- /dev/null +++ b/templates/web/base/admin/extra-metadata-item.html @@ -0,0 +1,110 @@ +[% +SET behaviour = ''; +DEFAULT behaviour = 'server' IF meta.automated == 'server_set'; +DEFAULT behaviour = 'hidden' IF meta.automated == 'hidden_field'; +DEFAULT behaviour = 'notice' IF meta.variable == 'false'; +DEFAULT behaviour = 'question'; +~%] + +<fieldset class="extra-metadata-item js-metadata-item" data-i="[% i %]"> + <legend class="visuallyhidden">Extra data field [% i %]</legend> + + <header class="extra-metadata-item__header hidden-nojs"> + <div class="js-metadata-item-header-grab extra-metadata-item__header__grab" aria-label="Drag to reorder"></div> + <button type="button" class="js-metadata-item-header-title extra-metadata-item__header__title" data-default="[% loc('New field') %]" data-toggle-visibility="#metadata-fieldset-[% i %]"> + [%~ IF meta.code ~%] + <strong>[% meta.code | html %]</strong> + / [% behaviour %] + [% IF meta.description %] / [% meta.description.substr(0, 50) | html %][% END %] + [%~ ELSE ~%] + <strong>[% loc('New field') %]</strong> + [%~ END ~%] + </button> + <button type="button" class="js-metadata-item-remove extra-metadata-item__header__remove">[% loc('Remove field') %]</button> + </header> + + <div class="extra-metadata-item__body [% IF collapsed %]hidden-js[% END %]" id="metadata-fieldset-[% i %]"> + + <div class="form-group"> + <label for="metadata-[% i %]-code">[% loc('Code') %]</label> + <span class="form-hint" id="metadata-[% i %]-code-hint">[% loc('The code used to store this field value in the database.') %]</span> + <input class="form-control" name="metadata[[% i %]].code" id="metadata-[% i %]-code" aria-describedby="metadata-[% i %]-code-hint" type=text value="[% meta.code | html %]"> + </div> + + <fieldset> + <legend>[% loc('Behaviour') %]</legend> + <div class="form-check form-check--inline"> + <input type="radio" name="metadata[[% i %]].behaviour" id="metadata-[% i %]-behaviour-question" value="question" data-show="#metadata-[% i %]-description-group, #metadata-[% i %]-description-label-question, #metadata-[% i %]-datatype-group, #metadata-[% i %]-required-group, #metadata-[% i %]-protected-group" data-hide="#metadata-[% i %]-description-label-notice, #metadata-[% i %]-disabled-group"[% ' checked' IF behaviour == 'question' %]> + <label for="metadata-[% i %]-behaviour-question">[% loc('Extra question shown to user') %]</label> + </div> + <div class="form-check form-check--inline"> + <input type="radio" name="metadata[[% i %]].behaviour" id="metadata-[% i %]-behaviour-notice" value="notice" data-show="#metadata-[% i %]-description-group, #metadata-[% i %]-description-label-notice, #metadata-[% i %]-protected-group, #metadata-[% i %]-disabled-group" data-hide="#metadata-[% i %]-description-label-question, #metadata-[% i %]-datatype-group, #metadata-[% i %]-required-group"[% ' checked' IF behaviour == 'notice' %]> + <label for="metadata-[% i %]-behaviour-notice">[% loc('Notice shown to user') %]</label> + </div> + <div class="form-check form-check--inline"> + <input type="radio" name="metadata[[% i %]].behaviour" id="metadata-[% i %]-behaviour-hidden" value="hidden" data-show="#metadata-[% i %]-protected-group" data-hide="#metadata-[% i %]-description-group, #metadata-[% i %]-datatype-group, #metadata-[% i %]-required-group, #metadata-[% i %]-disabled-group"[% ' checked' IF behaviour == 'hidden' %]> + <label for="metadata-[% i %]-behaviour-hidden">[% loc('Hidden data in reporting form') %]</label> + </div> + <div class="form-check form-check--inline"> + <input type="radio" name="metadata[[% i %]].behaviour" id="metadata-[% i %]-behaviour-server" value="server" data-show="#metadata-[% i %]-protected-group" data-hide="#metadata-[% i %]-description-group, #metadata-[% i %]-datatype-group, #metadata-[% i %]-required-group, #metadata-[% i %]-disabled-group"[% ' checked' IF behaviour == 'server' %]> + <label for="metadata-[% i %]-behaviour-server">[% loc('Internal data set by Open311') %]</label> + </div> + </fieldset> + + <div class="form-group js-sort-order"> + <label for="metadata-[% i %]-order">[% loc('Order') %]</label> + <input class="form-control" name="metadata[[% i %]].order" id="metadata-[% i %]-order" type=text value="[% meta.order OR 0 | html %]"> + </div> + + <div class="form-group hidden-js" id="metadata-[% i %]-description-group"> + <label for="metadata-[% i %]-description" id="metadata-[% i %]-description-label-question" class="[% 'hidden-js' UNLESS behaviour == 'question' %]">[% loc('Question text') %]</label> + <label for="metadata-[% i %]-description" id="metadata-[% i %]-description-label-notice" class="[% 'hidden-js' UNLESS behaviour == 'notice' %]">[% loc('Notice text') %]</label> + <textarea class="form-control" name="metadata[[% i %]].description" id="metadata-[% i %]-description" rows="2">[% meta.description | html %]</textarea> + </div> + + <div class="hidden-js" id="metadata-[% i %]-datatype-group"> + <div class="form-group"> + <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="singlevaluelist" data-show="#metadata-[% i %]-options-group" [% 'selected' IF meta.datatype == 'singlevaluelist' %]>[% loc('Drop-down list') %]</option> + </select> + </div> + + <div class="hidden-js" id="metadata-[% i %]-options-group"> + <p class="label">[% loc('Options') %]</p> + <div class="js-metadata-options"> + [% SET options = meta.item('values') ? meta.values : [] %] + [% FOR option IN options %] + [% INCLUDE 'admin/extra-metadata-option.html' option=option i=i j=loop.index %] + [% END %] + </div> + + <div class="hidden-js"[% IF i==9999 %] id="js-template-extra-metadata-option"[% END %]> + [% INCLUDE 'admin/extra-metadata-option.html' option={} i=i j=8888 %] + </div> + + <button type="button" class="btn btn--small js-metadata-option-add hidden-nojs">[% loc('Add option') %]</button> + </div> + </div> + + <p class="form-check hidden-js" id="metadata-[% i %]-required-group"> + <input type="checkbox" name="metadata[[% i %]].required" value="1" id="metadata-[% i %]-required" aria-describedby="metadata-[% i %]-required-hint" [% ' checked' IF meta.required == 'true' %]> + <label for="metadata-[% i %]-required">[% loc('Required') %]</label> + <span class="form-hint" id="metadata-[% i %]-required-hint">[% loc('Prevent user from submitting the form until this field is filled in.') %]</span> + </p> + + <p class="form-check hidden-js" id="metadata-[% i %]-disabled-group"> + <input type="checkbox" name="metadata[[% i %]].disable_form" value="1" id="metadata-[% i %]-disable_form" aria-describedby="metadata-[% i %]-disable_form-hint" [% ' checked' IF meta.disable_form == 'true' %]> + <label for="metadata-[% i %]-disable_form">[% loc('Disable form when this category is selected') %]</label> + <span class="form-hint" id="metadata[[% i %]]-disable_form-hint">[% loc('If ticked, the form will be disabled and this item’s notice text will be displayed.') %]</span> + </p> + + <p class="form-check hidden-js" id="metadata-[% i %]-protected-group"> + <input type="checkbox" name="metadata[[% i %]].protected" value="1" id="metadata-[% i %]-protected" aria-describedby="metadata-[% i %]-protected-hint" [% ' checked' IF meta.protected == 'true' %]> + <label for="metadata-[% i %]-protected">[% loc('Protect from Open311 changes') %]</label> + <span class="form-hint" id="metadata[[% i %]]-protected-hint">[% loc('If ticked, this extra data will not be edited or deleted by the Open311 population script.') %]</span> + </p> + + </div> +</fieldset> diff --git a/templates/web/base/admin/extra-metadata-option.html b/templates/web/base/admin/extra-metadata-option.html new file mode 100644 index 000000000..360dfb208 --- /dev/null +++ b/templates/web/base/admin/extra-metadata-option.html @@ -0,0 +1,29 @@ +<fieldset class="extra-metadata-option js-metadata-option"> + <legend class="visuallyhidden">Option [% j %]</legend> + + <div class="row"> + <div class="col"> + <label for="metadata-[% i %]-values-[% j %]-key">[% loc('Internal key') %]</label> + <input type="text" class="form-control" name="metadata[[% i %]].values[[% j %]].key" id="metadata-[% i %]-values-[% j %]-key" value="[% option.key | html %]"> + </div> + <div class="col"> + <label for="metadata-[% i %]-values-[% j %]-name">[% loc('Displayed label') %]</label> + <input type="text" class="form-control" name="metadata[[% i %]].values[[% j %]].name" id="metadata-[% i %]-values-[% j %]-name" value="[% option.name | html %]"> + </div> + </div> + <div class="row"> + <div class="col"> + <p class="form-check"> + <input type="checkbox" name="metadata[[% i %]].values[[% j %]].disable" value="1" id="metadata-[% i %]-values-[% j %]-disable" data-toggle-visibility="#js-disable-form-message-box-[% i %]-[% j %]" [% ' checked' IF option.disable %]> + <label for="metadata-[% i %]-values-[% j %]-disable">[% loc('Disable form when this option is selected') %]</label> + </p> + <p class="form-group [% 'hidden-js' IF NOT option.disable %]" id="js-disable-form-message-box-[% i %]-[% j %]"> + <label for="disabled-message-[% i %]-[% j %]">[% loc('Message to show when form is disabled (HTML permitted)') %]</label> + <textarea id="disabled-message-[% i %]-[% j %]" name="metadata[[% i %]].values[[% j %]].disable_message" class="form-control">[% option.disable_message OR meta.datatype_description | html %]</textarea> + </p> + </div> + <div class="col"> + <button type="button" class="js-metadata-option-remove">[% loc('Remove option') %]</button> + </div> + </div> +</fieldset> diff --git a/templates/web/base/admin/index.html b/templates/web/base/admin/index.html index 8691dbcf8..88c7ff959 100644 --- a/templates/web/base/admin/index.html +++ b/templates/web/base/admin/index.html @@ -20,34 +20,40 @@ and to receive notices of updates. </p> [% END %] -<div class="admin-index-search form-txt-submit-box clearfix"> +<div class="admin-index-search clearfix"> <form method="get" action="[% c.uri_for('reports') %]" accept-charset="utf-8"> - <p><label for="search_reports">[% loc('Search Reports') %]</label> + <label for="search_reports">[% loc('Search Reports') %]</label> + <div class="form-txt-submit-box"> <input type="text" class="form-control" name="search" size="30" id="search_reports" value="[% searched | html %]"> <input type="submit" class="btn" value="[% loc('Go') %]"> + </div> </form> <form method="get" action="[% c.uri_for('users') %]" accept-charset="utf-8"> - <p><label for="search_users">[% loc('Search Users') %]</label> + <label for="search_users">[% loc('Search Users') %]</label> + <div class="form-txt-submit-box"> <input type="text" class="form-control" name="search" size="30" id="search_users" value="[% searched | html %]"> <input type="submit" class="btn" value="[% loc('Go') %]"> + </div> </form> [% IF c.user.is_superuser %] - <form method="get" action="[% c.uri_for('bodies') %]"> - <label for="search_body">[% loc('Edit body details') %]</label> - <select class="form-control" id="search_body" name="body"> - [% FOREACH body IN bodies %] - [%- SET id = body.id %] - <option[% IF body.deleted %] class="adminhidden"[% END %] value="[% body.id %]"> - [% body.name | html %] - [%- IF body.parent %], [% body.parent.name | html %][% END -%] - </option> - [% END %] - </select> - <input type="submit" class="btn" value="[% loc('Go') %]"> - </form> +<form method="get" action="[% c.uri_for('bodies') %]"> + <label for="search_body">[% loc('Edit body details') %]</label> + <div class="form-txt-submit-box"> + <select class="form-control" id="search_body" name="body"> + [% FOREACH body IN bodies %] + [%- SET id = body.id %] + <option[% IF body.deleted %] class="adminhidden"[% END %] value="[% body.id %]"> + [% body.name | html %] + [%- IF body.parent %], [% body.parent.name | html %][% END -%] + </option> + [% END %] + </select> + <input type="submit" class="btn" value="[% loc('Go') %]"> + </div> +</form> [% END %] </div> @@ -68,13 +74,4 @@ and to receive notices of updates. </table> [% END %] -<h2>[% loc('Stats') %]</h2> -[% INCLUDE 'status/stats.html' admin_include_users=1 %] - -[% IF c.cobrand.admin_show_creation_graph -%] - <p> - <a href="[% c.config.BASE_URL %]/fms-live-creation.png" class="admin-offsite-link">[% loc('Graph of problem creation by status over time') %]</a> - </p> -[% END -%] - [% INCLUDE 'admin/footer.html' %] diff --git a/templates/web/base/admin/list_updates.html b/templates/web/base/admin/list_updates.html index b23cd7ca3..e8abdddad 100644 --- a/templates/web/base/admin/list_updates.html +++ b/templates/web/base/admin/list_updates.html @@ -41,7 +41,7 @@ </small></td> <td rowspan=2> [% IF c.user.has_permission_to('report_edit', update.problem.bodies_str_ids) %] - <a href="[% c.uri_for( 'update_edit', update.id ) %]">[% loc('Edit') %]</a> + <a href="[% c.uri_for_action( 'admin/update_edit', [ update.id ] ) %]">[% loc('Edit') %]</a> [% END %] </td> </tr> diff --git a/templates/web/base/admin/manifesttheme/form.html b/templates/web/base/admin/manifesttheme/form.html new file mode 100644 index 000000000..6d02487a6 --- /dev/null +++ b/templates/web/base/admin/manifesttheme/form.html @@ -0,0 +1,71 @@ +[% INCLUDE 'admin/header.html' title=loc('Theme') -%] + +<form method="post" enctype="multipart/form-data"> + <div class="admin-hint"> + <p>[% loc("The <strong>name</strong> is a string that represents the name of the web application as it is usually displayed to the user (e.g., amongst a list of other applications, or as a label for an icon).") %]</p> + </div> + [% form.field('name').render | safe %] + + <div class="admin-hint"> + <p>[% loc("The <strong>short name</strong> is a string that represents the name of the web application displayed to the user if there is not enough space to display name (e.g., as a label for an icon on the phone home screen).") %]</p> + </div> + [% form.field('short_name').render | safe %] + + <div class="admin-hint"> + <p>[% loc("The <strong>theme colour</strong> defines the default theme colour for the application. This sometimes affects how the OS displays the site (e.g., on Android's task switcher, the theme colour surrounds the site). Colours should be specified with CSS syntax, e.g. <strong><code>#ff00ff</code></strong> or <strong><code>rgb(255, 0, 255)</code></strong> or a named colour like <strong><code>fuchsia</code></strong>.") %]</p> + </div> + [% form.field('theme_colour').render | safe %] + + <div class="admin-hint"> + <p>[% loc("The <strong>background colour</strong> defines a placeholder background colour for the application splash screen before it has loaded. Colours should be specified with CSS syntax, e.g. <strong><code>#ff00ff</code></strong> or <strong><code>rgb(255, 0, 255)</code></strong> or a named colour like <strong><code>fuchsia</code></strong>.") %]</p> + </div> + [% form.field('background_colour').render | safe %] + + [% IF show_all %] + [% form.field('cobrand').render | safe %] + [% ELSE %] + <input type=hidden name=cobrand value='[% c.cobrand.moniker %]' /> + [% END %] + + <table> + <thead> + <tr> + <th>Icon</th> + <th>Size</th> + <th>Delete?</th> + </tr> + </thead> + <tbody> + [% FOREACH icon IN editing_manifest_theme.icons %] + <tr> + <td><img src="[% icon.src %]" /></td> + <td class="icon-size">[% icon.sizes %]</td> + <td><input type=checkbox name=delete_icon value='[% icon.src %]' /></td> + </tr> + [% END %] + <tr> + <td colspan=3> + <div class="admin-hint"> + <p>[% loc("The <strong>icons</strong> are used when the application is installed to the user's home screen. Icons must be <strong>square</strong>, with <strong>512x512</strong>px and <strong>192x192</strong>px being the most common sizes.") %]</p> + </div> + [% form.field('icon').render | safe %] + </td> + </tr> + </tbody> + </table> + + <p> + <input class="btn" type="submit" name="submit" value="[% loc('Save changes') %]"> + </p> + [% IF form.item.id %] + <p> + <input class="btn-danger" type="submit" name="delete_theme" value="[% loc('Delete theme') %]" data-confirm="[% loc('Are you sure?') %]"> + </p> + [% END %] +</form> + +[% IF show_all %] + <p><a href="[% c.uri_for(c.controller.action_for('list')) %]">Return to themes list</a></p> +[% END %] + +[% INCLUDE 'admin/footer.html' %] diff --git a/templates/web/base/admin/manifesttheme/index.html b/templates/web/base/admin/manifesttheme/index.html new file mode 100644 index 000000000..df94c394f --- /dev/null +++ b/templates/web/base/admin/manifesttheme/index.html @@ -0,0 +1,35 @@ +[% INCLUDE 'admin/header.html' title=loc('Themes') %] + +<table> + <thead> + <tr> + <th> [% loc('Cobrand') %] </th> + <th> [% loc('Name') %] </th> + <th> [% loc('Short Name') %] </th> + <th> [% loc('Background Colour') %] </th> + <th> [% loc('Theme Colour') %] </th> + <th> </th> + </tr> + </thead> + <tbody> + [% FOR theme IN rs.all %] + <tr> + <td>[% theme.cobrand %]</td> + <td>[% theme.name %]</td> + <td>[% theme.short_name %]</td> + <td>[% theme.background_colour %]</td> + <td>[% theme.theme_colour %]</td> + <td> <a href="[% c.uri_for(c.controller.action_for('edit'), [theme.cobrand]) %]" class="btn">[% loc('Edit') %]</a> </td> + </tr> + [% END %] + </tbody> +</table> + + + +<p> + <a href="[% c.uri_for(c.controller.action_for('create')) %]">[% loc('Create') %]</a> + </p> + + +[% INCLUDE 'admin/footer.html' %] diff --git a/templates/web/base/admin/problem_row.html b/templates/web/base/admin/problem_row.html index 99142af4e..8d74fec13 100644 --- a/templates/web/base/admin/problem_row.html +++ b/templates/web/base/admin/problem_row.html @@ -23,7 +23,7 @@ [% PROCESS value_or_nbsp value=problem.category_display %] <br>[%- IF edit_body_contacts -%] [% FOR body IN problem.bodies.values %] - <a href="[% c.uri_for('body', body.id ) %]">[% PROCESS value_or_nbsp value=body.name %]</a> + <a href="[% c.uri_for_action('admin/bodies/edit', [ body.id ] ) %]">[% PROCESS value_or_nbsp value=body.name %]</a> [% END %] [%- ELSE -%] [%- PROCESS value_or_nbsp value=problem.bodies_str -%] @@ -40,7 +40,7 @@ </small></td> <td> [% IF c.user.has_permission_to('report_edit', problem.bodies_str_ids) %] - <a href="[% c.uri_for( 'report_edit', problem.id ) %]">[% loc('Edit') %]</a> + <a href="[% c.uri_for_action( '/admin/reports/edit', [ problem.id ] ) %]">[% loc('Edit') %]</a> [% END %] </td> </tr> diff --git a/templates/web/base/admin/report-category.html b/templates/web/base/admin/report-category.html index 0416d71c0..e76106f7f 100644 --- a/templates/web/base/admin/report-category.html +++ b/templates/web/base/admin/report-category.html @@ -1,14 +1,15 @@ -<select class="form-control" name="category" id="category"> +[%~ 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} %] <optgroup label="[% loc('Existing category') %]"> <option selected value="[% problem.category | html %]">[% (problem.category_display OR '-') | html %]</option> </optgroup> [% END %] - [% IF category_options.size %] - <optgroup label="[% loc('Available categories') %]"> - [% FOREACH cat IN category_options %] - <option value="[% cat.category | html %]"[% ' selected' IF problem.category == cat.category %]>[% cat.category_display | html %]</option> - [% END %] - </optgroup> - [% END %] + [%~ INCLUDE 'report/new/_category_select.html' ~%] </select> diff --git a/templates/web/base/admin/report_blocks.html b/templates/web/base/admin/report_blocks.html index 4c52b14bb..4c679e3b8 100644 --- a/templates/web/base/admin/report_blocks.html +++ b/templates/web/base/admin/report_blocks.html @@ -47,3 +47,7 @@ SET state_groups = c.cobrand.state_groups_admin; </span> [% END %] [% END %] + +[% BLOCK status_message %] + <p><em>[% status_message %]</em></p> +[% END %] diff --git a/templates/web/base/admin/report_edit.html b/templates/web/base/admin/reports/edit.html index e38932d7f..d2b866d01 100644 --- a/templates/web/base/admin/report_edit.html +++ b/templates/web/base/admin/reports/edit.html @@ -7,7 +7,7 @@ PROCESS 'admin/report_blocks.html' -%] -[% map_html %] +[% map_html | safe %] </div> <div id="map_sidebar"> @@ -16,7 +16,7 @@ <div id="side"> -<form method="post" action="[% c.uri_for( 'report_edit', problem.id ) %]" enctype="application/x-www-form-urlencoded" accept-charset="utf-8"> +<form method="post" action="[% c.uri_for_action( '/admin/reports/edit', [ problem.id ] ) %]" enctype="application/x-www-form-urlencoded" accept-charset="utf-8"> <input type="hidden" name="token" value="[% csrf_token %]" > <input type="hidden" name="submit" value="1" > @@ -57,7 +57,7 @@ class="admin-offsite-link">[% problem.latitude %], [% problem.longitude %]</a> [% IF problem.bodies_str %] [% FOREACH body IN problem.bodies.values %] [% SET body_printed = 1 %] - <a href="[% c.uri_for('body', body.id) %]">[% body.name | html %]</a> + <a href="[% c.uri_for_action('admin/bodies/edit', [ body.id ]) %]">[% body.name | html %]</a> [%- ',' IF NOT loop.last %] [% END %] [% IF NOT body_printed %] @@ -81,12 +81,17 @@ class="admin-offsite-link">[% problem.latitude %], [% problem.longitude %]</a> [% IF problem.send_method_used %] ([% problem.send_method_used %]) [% END %] - [% IF problem.state == 'confirmed' AND problem.whensent %] + [% IF problem.state == 'confirmed' AND problem.whensent AND NOT c.cobrand.disable_resend_button %] <input data-confirm="[% loc('Are you sure?') %]" class="btn" type="submit" name="resend" value="[% loc('Resend report') %]"> [% ELSIF NOT problem.whensent %] <input type="submit" class="btn" name="mark_sent" value="[% loc('Mark as sent') %]"> [% END %] </li> +[% IF c.user.is_superuser AND problem.send_fail_count > 0 %] +<li class="sm">[% loc('Send Fail Count:') %] [% problem.send_fail_count %]</li> +<li class="sm">[% loc('Last failure:') %] [% PROCESS format_time time=problem.send_fail_timestamp %]</li> +<li class="sm truncate_height">[% loc('Reason:') %] [% problem.send_fail_reason | html %]</li> +[% END %] <li class="sm">[% loc('Last update:') %] [% PROCESS format_time time=problem.lastupdate %]</li> <li>[% loc('Alerts:') %] [% alert_count %]</li> <li>[% loc('Service:') %] [% problem.service OR '<em>' _ loc('None') _ '</em>' %]</li> @@ -111,7 +116,7 @@ class="admin-offsite-link">[% problem.latitude %], [% problem.longitude %]</a> </ul> </div> -[% status_message %] +[% INCLUDE status_message %] <ul class="plain-list"> <li><label for='title'>[% loc('Subject:') %]</label> diff --git a/templates/web/base/admin/reports.html b/templates/web/base/admin/reports/index.html index 7d8fe9561..adbd50224 100644 --- a/templates/web/base/admin/reports.html +++ b/templates/web/base/admin/reports/index.html @@ -1,7 +1,7 @@ [% INCLUDE 'admin/header.html' title=loc('Search Reports') %] [% PROCESS 'admin/report_blocks.html' %] -<form method="get" action="[% c.uri_for('reports') %]" enctype="application/x-www-form-urlencoded" accept-charset="utf-8"> +<form method="get" action="[% c.uri_for_action('/admin/reports/index') %]" enctype="application/x-www-form-urlencoded" accept-charset="utf-8"> <p><label for="search">[% loc('Search:') %]</label> <input class="form-control" type="text" name="search" size="30" id="search" value="[% searched | html %]"> </form> diff --git a/templates/web/base/admin/responsepriorities/edit.html b/templates/web/base/admin/responsepriorities/edit.html index 02661fd14..b9074999f 100644 --- a/templates/web/base/admin/responsepriorities/edit.html +++ b/templates/web/base/admin/responsepriorities/edit.html @@ -1,57 +1,46 @@ [% INCLUDE 'admin/header.html' title=tprintf(loc('Response Priority for %s'), body.name) -%] -[% rp = response_priority %] -[% UNLESS rp.id %]<h3>[% loc('New priority') %]</h3>[% END %] +[% UNLESS obj %]<h3>[% loc('New priority') %]</h3>[% END %] -<form method="post" - action="[% c.uri_for('', body.id, rp.id || 'new' ) %]" - enctype="application/x-www-form-urlencoded" - accept-charset="utf-8" - class="validate"> +<form method="post" accept-charset="utf-8" class="validate"> - <p> - <strong>[% loc('Name:') %] </strong> - <input type="text" name="name" class="required form-control" size="30" value="[% rp.name | html %]"> - </p> - <p> - <strong>[% loc('Description:') %] </strong> - <input type="text" name="description" class="form-control" size="30" value="[% rp.description | html %]"> - </p> + [% form.field('name').render | safe %] + [% form.field('description').render | safe %] <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> + [% form.field('external_id').render | safe %] <div class="admin-hint"> <p> [% loc('Select if this is the default priority') %] </p> </div> - <p> - <label> - <input type="checkbox" name="is_default" is="is_deleted" value="1"[% ' checked' IF rp.is_default %]> - [% loc('Default priority') %] - </label> - </p> - - [% INCLUDE 'admin/category-checkboxes.html' hint=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.') %] + [% form.field('is_default').render | safe %] + + <fieldset> + <legend> + <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> + [% loc('Categories:') %] + </legend> + [%# TODO Select all/none %] + [% form.field('contacts').render | safe %] + </fieldset> + + [% form.field('deleted').render | safe %] <p> - <label> - <input type="checkbox" name="deleted" id="deleted" value="1"[% ' checked' IF rp.deleted %]> - [% loc('Flag as deleted') %] - </label> - </p> - <p> <input type="hidden" name="token" value="[% csrf_token %]" > - <input type="submit" class="btn" name="Edit priorities" value="[% rp.id ? loc('Save changes') : loc('Create priority') %]" > + <input type="submit" class="btn" name="Edit priorities" value="[% obj ? loc('Save changes') : loc('Create priority') %]" > </p> + </form> [% INCLUDE 'admin/footer.html' %] diff --git a/templates/web/base/admin/responsepriorities/index.html b/templates/web/base/admin/responsepriorities/index.html index 882a3c538..bb6324dbe 100644 --- a/templates/web/base/admin/responsepriorities/index.html +++ b/templates/web/base/admin/responsepriorities/index.html @@ -1,11 +1,55 @@ [% INCLUDE 'admin/header.html' title=loc('Response Priorities') -%] -<ul> - [% FOR body IN bodies %] - <li> - <a href="[% c.uri_for('', body.id) %]">[% body.name %]</a> - </li> - [% END %] -</ul> +<table> + <thead> + <tr> + <th> [% loc('Name') %] </th> + <th> [% loc('Description') %] </th> + <th> [% loc('Categories') %] </th> + <th> [% loc('Default') %] </th> + <th> </th> + </tr> + </thead> + <tbody> + [% FOR p IN response_priorities %] + [% IF c.user.is_superuser AND last_name != p.body.name %] + <tr> + <td colspan="5"><strong>[% p.body.name %]</strong></td> + </tr> + [% SET last_name = p.body.name %] + [% END %] + <tr [% 'class="is-deleted"' IF p.deleted %]> + <td> [% p.name | html %] </td> + <td> [% p.description | html %] </td> + <td> + [% UNLESS p.contacts.size %] + <em>[% loc('All categories') %]</em> + [% ELSE %] + [% FOR contact IN p.contacts %] + [% contact.category_display %][% ',' UNLESS loop.last %] + [% END %] + [% END %] + </td> + <td> [% IF p.is_default %]X[% END %]</td> + <td> <a href="[% c.uri_for(c.controller.action_for('edit'), [p.body_id, p.id]) %]" class="btn">[% loc('Edit') %]</a> </td> + </tr> + [% END %] + </tbody> +</table> + +[% IF c.user.is_superuser %] +<h3>[% loc('Create priority') %]</h3> +<form> +<select name="body_id"> + [% FOR body IN bodies %] + <option value="[% body.id %]">[% body.name | html %]</option> + [% END %] +</select> +<input type="submit" value="[% loc('Go') %]"> +</form> + +[% ELSE %] +<a href="[% c.uri_for(c.controller.action_for('create'), [c.user.from_body.id]) %]" class="btn">[% loc('New priority') %]</a> +[% END %] [% INCLUDE 'admin/footer.html' %] diff --git a/templates/web/base/admin/responsepriorities/list.html b/templates/web/base/admin/responsepriorities/list.html deleted file mode 100644 index eedaccfdb..000000000 --- a/templates/web/base/admin/responsepriorities/list.html +++ /dev/null @@ -1,36 +0,0 @@ -[% INCLUDE 'admin/header.html' title=tprintf(loc('Response Priorities for %s'), body.name) -%] - -<table> - <thead> - <tr> - <th> [% loc('Name') %] </th> - <th> [% loc('Description') %] </th> - <th> [% loc('Categories') %] </th> - <th> [% loc('Default') %] </th> - <th> </th> - </tr> - </thead> - <tbody> - [% FOR p IN response_priorities %] - <tr [% 'class="is-deleted"' IF p.deleted %]> - <td> [% p.name | html %] </td> - <td> [% p.description | html %] </td> - <td> - [% UNLESS p.contacts.size %] - <em>[% loc('All categories') %]</em> - [% ELSE %] - [% FOR contact IN p.contacts %] - [% contact.category_display %][% ',' UNLESS loop.last %] - [% END %] - [% END %] - </td> - <td> [% IF p.is_default %]X[% END %]</td> - <td> <a href="[% c.uri_for('', body.id, p.id) %]" class="btn">[% loc('Edit') %]</a> </td> - </tr> - [% END %] - </tbody> -</table> - -<a href="[% c.uri_for('', body.id, 'new') %]" class="btn">[% loc('New priority') %]</a> - -[% INCLUDE 'admin/footer.html' %] diff --git a/templates/web/base/admin/roles/form.html b/templates/web/base/admin/roles/form.html new file mode 100644 index 000000000..1801746af --- /dev/null +++ b/templates/web/base/admin/roles/form.html @@ -0,0 +1,32 @@ +[% INCLUDE 'admin/header.html' title=loc('Roles') -%] + +<form method="post"> + <div class="admin-hint"> + <p>[% loc("The role's <strong>name</strong> is used to refer to this group of permissions elsewhere in the admin.") %]</p> + </div> + [% form.field('name').render | safe %] + + [% IF form.field('body').is_active %] + [% form.field('body').render | safe %] + [% END %] + + <div class="admin-hint"> + <p>[% loc("Users with this role can perform the following actions within their assigned body or area.") %]</p> + </div> + [% form.field('permissions').render | safe %] + + [% form.field('submit').render | safe %] + + <p> + <input class="btn" type="submit" name="submit" value="[% loc('Save changes') %]"> + </p> + [% IF form.item.id %] + <p> + <input class="btn-danger" type="submit" name="delete_role" value="[% loc('Delete') %]" data-confirm="[% loc('Are you sure?') %]"> + </p> + [% END %] +</form> + +<p><a href="[% c.uri_for(c.controller.action_for('list')) %]">Return to roles list</a></p> + +[% INCLUDE 'admin/footer.html' %] diff --git a/templates/web/base/admin/roles/index.html b/templates/web/base/admin/roles/index.html new file mode 100644 index 000000000..6c561199c --- /dev/null +++ b/templates/web/base/admin/roles/index.html @@ -0,0 +1,35 @@ +[% INCLUDE 'admin/header.html' title=loc('Roles') -%] + +<table> + <tr> + <th>[% loc('Role') %]</th> + <th>[% loc('Permissions') %]</th> + <th> </th> + </tr> +[% FOREACH role IN roles -%] + [% IF c.user.is_superuser AND last_name != role.body.name %] + <tr> + <td colspan="3"><strong>[% role.body.name %]</strong></td> + </tr> + [% SET last_name = role.body.name %] + [% END %] + <tr> + <td>[% role.name | html %]</td> + <td><ul class="no-margin no-bullets"> + [% FOR perm IN role.permissions.sort %] + <li>[% labels.$perm %] + [% END %] + </ul></td> + <td> + <a href="[% c.uri_for(c.controller.action_for('edit'), [role.id]) %]">[% loc('Edit') %]</a> + · <a href="[% c.uri_for_action('admin/users/index', role = role.id) %]">[% loc('Users') %]</a> + </td> + </tr> +[% END -%] +</table> + +<p> + <a href="[% c.uri_for(c.controller.action_for('create')) %]">[% loc('Create') %]</a> +</p> + +[% INCLUDE 'admin/footer.html' %] diff --git a/templates/web/base/admin/states/index.html b/templates/web/base/admin/states/index.html index 1b68d4aea..ca2ef03d2 100644 --- a/templates/web/base/admin/states/index.html +++ b/templates/web/base/admin/states/index.html @@ -45,7 +45,7 @@ </td> <td style="text-align:center;vertical-align:middle" rowspan="[% rows %]"> [% IF state.label != 'confirmed' AND state.label != 'closed' %] - <input class="btn btn--small" type="submit" name="delete:[% state.label %]" value="Delete"> + <input class="btn btn--small btn-danger" type="submit" data-confirm="[% loc('Are you sure?') %]" name="delete:[% state.label %]" value="Delete"> [% END %] </td> </tr> diff --git a/templates/web/base/admin/stats/index.html b/templates/web/base/admin/stats/index.html index d47054427..e6ba5e054 100644 --- a/templates/web/base/admin/stats/index.html +++ b/templates/web/base/admin/stats/index.html @@ -1,10 +1,27 @@ [% INCLUDE 'admin/header.html' title=loc('Stats') %] +[% INCLUDE 'status/stats.html' admin_include_users=1 %] + +[% IF c.cobrand.admin_show_creation_graph -%] + <p> + <a href="[% c.config.BASE_URL %]/fms-live-creation.png" class="admin-offsite-link">[% loc('Graph of problem creation by status over time') %]</a> + </p> +[% END -%] + <ul> <li><a href="[% c.uri_for_action('admin/stats/questionnaire') %]">[% loc('Survey Results') %]</a></li> <li><a href="[% c.uri_for_action('admin/stats/state') %]">[% loc('Problem breakdown by state') %]</a></li> <li><a href="[% c.uri_for_action('admin/stats/fix_rate') %]">[% loc('Category fix rate for problems > 4 weeks old') %]</a></li> <li><a href="[% c.uri_for_action('dashboard/index') %]">[% loc('Summary statistics') %]</a></li> +[% IF c.cobrand.feature('heatmap').keys %] + <li>[% loc('Heatmap') %] <ul> + [% FOR body IN c.cobrand.feature('heatmap').pairs %] + <li><a href="[% c.uri_for_action('dashboard/heatmap') %]?body=[% body.value %]">[% body.key %]</a></li> + [% END %] + </ul> </li> +[% ELSIF c.cobrand.feature('heatmap') %] +<li><a href="[% c.uri_for_action('dashboard/heatmap') %]">[% loc('Heatmap') %]</a></li> +[% END %] [% IF c.cobrand.moniker == 'fixmystreet' %] <li><a href="[% c.uri_for_action('admin/stats/refused') %]">Refused</a></li> [% END %] diff --git a/templates/web/base/admin/template_edit.html b/templates/web/base/admin/templates/edit.html index 2945e36c5..7ce67f96f 100644 --- a/templates/web/base/admin/template_edit.html +++ b/templates/web/base/admin/templates/edit.html @@ -4,7 +4,7 @@ [% UNLESS rt.id %]<h3>[% loc('New template') %]</h3>[% END %] <form method="post" - action="[% c.uri_for('templates', body.id, rt.id || 'new' ) %]" + action="[% c.uri_for_action('/admin/templates/edit', body.id, rt.id || 'new' ) %]" enctype="application/x-www-form-urlencoded" accept-charset="utf-8" class="validate"> @@ -13,7 +13,9 @@ <p class="error">[% loc('Please correct the errors below') %]</p> [% END %] - + [% IF errors.title %] + <div class="form-error">[% errors.title %]</div> + [% END %] <div class="admin-hint"> <p> [% loc('This is a <strong>private</strong> name for this template so you can identify it when updating reports or editing in the admin.') %] diff --git a/templates/web/base/admin/templates_index.html b/templates/web/base/admin/templates/index.html index 40e1be300..9322c6ef6 100644 --- a/templates/web/base/admin/templates_index.html +++ b/templates/web/base/admin/templates/index.html @@ -3,7 +3,7 @@ <ul> [% FOR body IN bodies %] <li> - <a href="[% c.uri_for('templates', body.id) %]">[% body.name %]</a> + <a href="[% c.uri_for_action('/admin/templates/view', body.id) %]">[% body.name %]</a> </li> [% END %] </ul> diff --git a/templates/web/base/admin/templates.html b/templates/web/base/admin/templates/view.html index 21e4eea25..6a1dd9614 100644 --- a/templates/web/base/admin/templates.html +++ b/templates/web/base/admin/templates/view.html @@ -28,12 +28,12 @@ [% IF t.external_status_code %][% t.external_status_code | html %] (external)[% END %] </td> <td> [% IF t.auto_response %]X[% END %] </td> - <td> <a href="[% c.uri_for('templates', body.id, t.id) %]" class="btn">[% loc('Edit') %]</a> </td> + <td> <a href="[% c.uri_for_action('/admin/templates/edit', body.id, t.id) %]" class="btn">[% loc('Edit') %]</a> </td> </tr> [% END %] </tbody> </table> -<a href="[% c.uri_for('templates', body.id, 'new') %]" class="btn">[% loc('New template') %]</a> +<a href="[% c.uri_for_action('/admin/templates/index', body.id, 'new') %]" class="btn">[% loc('New template') %]</a> [% INCLUDE 'admin/footer.html' %] diff --git a/templates/web/base/admin/triage/_inspect.html b/templates/web/base/admin/triage/_inspect.html new file mode 100644 index 000000000..926197ceb --- /dev/null +++ b/templates/web/base/admin/triage/_inspect.html @@ -0,0 +1,77 @@ +[% BLOCK category_list %] +<select class="form-control" name="[% field_name %]" id="[% field_name %]"> + [% IF category_options.size %] + [%~ IF category_groups.size ~%] + [%~ FOREACH group IN category_groups ~%] + [% IF group.name %]<optgroup label="[% group.name %]">[% END %] + [% group_select = 0 %] + [% selected = 0 %] + [%~ FOREACH cat_op IN group.categories ~%] + [% IF group_select == 0 AND problem.category == group.name %] + [% selected = 1; group_select = 1 %] + [% END %] + <option value="[% cat_op.category | html %]"[% ' selected' IF selected OR problem.category == cat_op.category %]>[% cat_op.category_display | html %] ([% cat_op.email | html %])</option> + [% selected = 0 %] + [%~ END ~%] + [% IF group.name %]</optgroup>[% END %] + [%~ END =%] + [% ELSE %] + [% FOREACH cat IN category_options %] + <option value="[% cat.category | html %]"[% ' selected' IF problem.category == cat.category %]>[% cat.category_display | html %]</option> + [% END %] + [% END %] + [% END %] +</select> +[% END %] + +[% permissions = c.user.permissions(problem) %] +[% second_column = BLOCK -%] + <div id="side-inspect"> + + <h2 class="inspect-form-heading">[% loc('Inspect report') %]</h2> + + [% INCLUDE 'errors.html' %] + + <form name="report_inspect_form" id="report_inspect_form" method="post" action="[% c.uri_for( '/report', problem.id ) %]" class="validate"> + + [% INCLUDE 'report/inspect/information.html' no_relocate=1 %] + + [% IF permissions.report_edit_category OR permissions.report_inspect OR permissions.triage %] + <div class="inspect-section"> + <p> + <strong>Holding category:</strong> [% problem.category %] + </p> + + <p> + <label for="category">CONFIRM Subject</label> + [% PROCESS category_list category_groups=end_groups field_name="category" categories_hash=end_categories category_options=end_options %] + </p> + + </div> + [% END %] + + <div class="inspect-section"> + [%- extra_fields = problem.get_extra_fields -%] + [% FOR field IN extra_fields %] + [% NEXT IF field.name == 'urgent' %] + <p> + <label for="[% field.name %]">[% field.description %]</label> + <input class="form-control" name="[% field.name %]" type="text" value="[% field.value | html %]" disabled> + </p> + [% END %] + + [% IF permissions.report_inspect OR permissions.triage %] + [% INCLUDE 'report/inspect/public_update.html' public_update_defaulted=0 %] + [% END %] + + <p> + <input type="hidden" name="token" value="[% csrf_token %]" /> + <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> + + <input type="hidden" name="js" value=""> + <input type="hidden" name="triage" value="1"> + </form> + </div> +[%- END %] diff --git a/templates/web/base/admin/triage/_list-filters.html b/templates/web/base/admin/triage/_list-filters.html new file mode 100644 index 000000000..dd3e17875 --- /dev/null +++ b/templates/web/base/admin/triage/_list-filters.html @@ -0,0 +1,53 @@ +[% select_category = BLOCK %] + [% 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 %] + [%~ IF cat.get_extra_metadata('help_text') %] ([% cat.get_extra_metadata('help_text') %])[% END ~%] + </option> + [% END %] + </select> + [% ELSE %] + [% loc('Everything') %] + [% END %] +[% END %] + +<div class="report-list-filters-wrapper"> + +[% IF use_form_wrapper %] + <form method="get" action=""> +[% END %] + + <p class="report-list-filters"> + [% tprintf(loc('<label for="statuses">Show</label> %s reports <label for="filter_categories">about</label> %s', "The first %s is a dropdown of all/fixed/etc, the second is a dropdown of categories"), 'untriaged', mark_safe(select_category)) %] + <input type="submit" name="filter_update" value="[% loc('Go') %]"> + </p> + + <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> + <option value="updated-asc"[% ' selected' IF sort_key == 'updated-asc' %]>[% loc('Least recently updated') %]</option> + <option value="comments-desc"[% ' selected' IF sort_key == 'comments-desc' %]>[% loc('Most commented') %]</option> + </select> + <input type="submit" name="filter_update" value="[% loc('Go') %]"> + </p> + [% IF page == 'around' %] + <p id="show_old_reports_wrapper" class="report-list-filters[% ' hidden' UNLESS num_old_reports > 0 %]"> + <label for="show_old_reports">[% loc('Show older reports') %]</label> + <input type="checkbox" name="show_old_reports" id="show_old_reports" value="1"[% ' checked' IF show_old_reports %]> + <input type="submit" name="filter_update" value="[% loc('Go') %]"> + </p> + [% END %] + +[% IF use_form_wrapper %] + </form> +[% END %] + +</div> diff --git a/templates/web/base/admin/triage/index.html b/templates/web/base/admin/triage/index.html new file mode 100644 index 000000000..8b6880c24 --- /dev/null +++ b/templates/web/base/admin/triage/index.html @@ -0,0 +1,42 @@ +[% 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 %] + +[% + PROCESS "report/photo-js.html"; + PROCESS "maps/${map.type}.html"; + SET bodyclass = 'mappage'; + INCLUDE 'header.html', + title = 'Awaiting triage' + rss = [ tprintf(loc('Problems within %s, %s', "First %s is the body name, second %s the site name"), name, site_name), rss_url ] +%] + +[% map_html | safe %] + +</div> +<div id="map_sidebar"> + <div id="side"> + + <h1 id="reports_heading"> + Awaiting triage + </h1> + +<section class="full-width"> +[% INCLUDE "admin/triage/_list-filters.html", use_form_wrapper = 1 %] +<div class="js-pagination"> +[% INCLUDE 'pagination.html', param = 'p' %] +</div> +<div id="js-reports-list"> + [% INCLUDE 'reports/_problem-list.html' %] +</div> +<div class="js-pagination"> +[% INCLUDE 'pagination.html', param = 'p' %] +</div> +</section> + + </div> +</div> +[% INCLUDE 'footer.html' %] diff --git a/templates/web/base/admin/update_edit.html b/templates/web/base/admin/update_edit.html index fca9b1904..527b3f9f8 100644 --- a/templates/web/base/admin/update_edit.html +++ b/templates/web/base/admin/update_edit.html @@ -1,7 +1,7 @@ [% INCLUDE 'admin/header.html' title=tprintf(loc('Editing update %d'), update.id ) -%] [% PROCESS 'admin/report_blocks.html' %] -[% status_message %] +[% INCLUDE status_message %] <form method="post" action="[% c.uri_for( 'update_edit', update.id ) %]" enctype="application/x-www-form-urlencoded" accept-charset="utf-8"> <input type="hidden" name="token" value="[% csrf_token %]" > diff --git a/templates/web/base/admin/users/edit.html b/templates/web/base/admin/users/edit.html index 8dd2b926f..204e58607 100644 --- a/templates/web/base/admin/users/edit.html +++ b/templates/web/base/admin/users/edit.html @@ -6,7 +6,7 @@ [% INCLUDE 'admin/header.html' title=title -%] [% PROCESS 'admin/report_blocks.html' %] -[% status_message %] +[% INCLUDE status_message %] [% INCLUDE 'admin/users/form.html' %] diff --git a/templates/web/base/admin/users/form.html b/templates/web/base/admin/users/form.html index 8f0f9ad6e..495da8648 100644 --- a/templates/web/base/admin/users/form.html +++ b/templates/web/base/admin/users/form.html @@ -1,4 +1,7 @@ -<form method="post" id="user_edit" action="[% c.uri_for_action( 'admin/users/edit', user.id ) %]" enctype="application/x-www-form-urlencoded" accept-charset="utf-8"> +<form method="post" id="user_edit" action="[% + SET action_end = user.id || 'add'; + c.uri_for_action( 'admin/users/edit', [ action_end ] ) + %]" enctype="application/x-www-form-urlencoded" accept-charset="utf-8"> <input type="hidden" name="token" value="[% csrf_token %]" > <input type="hidden" name="submit" value="1" > @@ -116,29 +119,6 @@ </label> </li> - [% UNLESS user.is_superuser %] - <li> - <div class="admin-hint"> - <p> - [% loc("Reports made by trusted users will be sent to the responsible body without being inspected first.") %] - </p> - </div> - [% IF c.user.is_superuser %] - <label for="trusted_bodies">[% loc('Trusted by bodies:') %]</label> - <select class="form-control js-multiple" id='trusted_bodies' name='trusted_bodies' multiple> - [% FOR body IN bodies %] - <option value="[% body.id %]"[% ' selected' IF user.has_permission_to('trusted', body.id) %]>[% body.name %]</option> - [% END %] - </select> - [% ELSE %] - <label> - [% loc('Trusted:') %] - <input type="checkbox" id="trusted_bodies" name="trusted_bodies" value="[% c.user.from_body.id %]" [% 'checked' IF user.has_permission_to('trusted', c.user.from_body.id) %]> - </label> - [% END %] - </li> - [% END %] - [% IF c.user.is_superuser %] <li> <div class="admin-hint"> @@ -155,6 +135,20 @@ [% IF available_permissions AND NOT user.is_superuser %] <li> + <div class="admin-hint"> + <p> + [% loc("Users can be assigned one or more roles to give them all the permissions of those roles. Selecting a role or roles will disable manual permission selection.") %] + </p> + </div> + <label for="roles">[% loc('Role:') %]</label> + <select class="form-control js-multiple" id="roles" name="roles" multiple> + [% FOREACH role IN roles %] + <option data-permissions='["[% role.permissions.join('","') | html %]"]' value="[% role.id %]"[% ' selected' IF user.in_role(role.id) %]>[% role.name | html %]</option> + [% END %] + </select> + </li> + + <li> <fieldset> <legend> <div class="admin-hint"> diff --git a/templates/web/base/admin/users/import.html b/templates/web/base/admin/users/import.html index 0c0b903d7..38e4fe240 100644 --- a/templates/web/base/admin/users/import.html +++ b/templates/web/base/admin/users/import.html @@ -1,7 +1,7 @@ [% INCLUDE 'admin/header.html' title=loc("User Import") -%] [% PROCESS 'admin/report_blocks.html' %] -[% status_message %] +[% INCLUDE status_message %] <form method="post" id="user_edit" enctype="multipart/form-data" accept-charset="utf-8"> <input type="hidden" name="token" value="[% csrf_token %]" > @@ -27,7 +27,7 @@ [% FOREACH user IN new_users %] <tr> <td> - <a href="[% c.uri_for_action( 'admin/users/edit', user.id ) %]"> + <a href="[% c.uri_for_action( 'admin/users/edit', [ user.id ] ) %]"> [% user.name %] </a> </td> @@ -50,7 +50,7 @@ [% FOREACH user IN existing_users %] <tr> <td> - <a href="[% c.uri_for_action( 'admin/users/edit', user.id ) %]"> + <a href="[% c.uri_for_action( 'admin/users/edit', [ user.id ] ) %]"> [% user.name %] </a> </td> @@ -65,11 +65,12 @@ <p>[% loc('This page is a quick way to create many new staff users in one go.') %]</p> <p>[% loc("Existing users won't be modified.") %]</p> <p> - [% loc("The uploaded CSV file must contain a header row, and records must have the following fields (in this order):") %] - <pre>name,email,from_body,permissions</pre> + [% loc("The uploaded CSV file must contain a header row, and records can have the following fields:") %] + <pre>name,email,from_body,permissions,roles,passwordhash</pre> <ul> <li><code>from_body</code>: [% loc("the database id of the body to associate that user with, e.g. <code>2217</code> for Buckinghamshire.") %]</li> <li><code>permissions</code>: [% loc("a colon-separated list of permissions to grant that user, e.g. <code>contribute_as_body:moderate:user_edit</code>.") %]</li> + <li><code>roles</code>: [% loc("a colon-separated list of roles to assign to that user.") %]</li> </ul> </p> diff --git a/templates/web/base/admin/users/index.html b/templates/web/base/admin/users/index.html index e939f008b..e573c10fe 100644 --- a/templates/web/base/admin/users/index.html +++ b/templates/web/base/admin/users/index.html @@ -1,42 +1,89 @@ [% INCLUDE 'admin/header.html' title=loc('Search Users') %] [% PROCESS 'admin/report_blocks.html' %] +[% BLOCK role_select %] +<select name="[% label %]" id="[% label %]" class="form-control"> + <option value="">---</option> + [% FOR role IN roles %] + [% IF c.user.is_superuser AND last_name != role.body.name %] + <optgroup label="[% role.body.name %]"> + [% SET last_name = role.body.name %] + [% END %] + <option value="[% role.id %]"[% ' selected' IF role.id == role_selected %]>[% role.name | html %]</option> + [% END %] +</select> +[% END %] + +[% INCLUDE status_message %] + <div class="fms-admin-info"> [% loc("User search finds matches in users' names and email addresses.") %] </div> + <form method="get" action="[% c.uri_for_action('admin/users/index') %]" enctype="application/x-www-form-urlencoded" accept-charset="utf-8"> +<div class="filters"> + <p><label for="search">[% loc('Search:') %]</label> <input class="form-control" type="text" name="search" size="30" id="search" value="[% searched | html %]"> + [% IF roles %] + <p><label for="role">[% loc('Role:') %]</label> + [% INCLUDE role_select label='role' %] + [% END %] + <p class="no-label"><input type="submit" value="[% loc('Go') %]" class="btn"> + +</div> </form> [% IF users.size %] +<form method="post"> <table cellspacing="0" cellpadding="2" border="1"> <tr> + <th>*</th> <th>[% loc('Name') %]</th> <th>[% loc('Email') %]</th> <th>[% loc('Body') %]</th> [% IF c.cobrand.moniker != 'zurich' %] <th>[% loc('Flagged') %]</th> [% END %] - <th>*</th> + <th colspan="2">*</th> </tr> [%- FOREACH user IN users %] <tr> - <td>[% PROCESS value_or_nbsp value=user.name %]</td> - <td><a href="[% c.uri_for_action( 'admin/reports', search => user.email ) %]">[% PROCESS value_or_nbsp value=user.email %]</a></td> + <td align="center">[% IF user.from_body %] + <input type="checkbox" name="uid" value="[% user.id %]" id="uid[% user.id %]"> + [% END %]</td> + <td>[% IF user.from_body %]<label class="inline" for="uid[% user.id %]">[% END %] + [% PROCESS value_or_nbsp value=user.name %] + [% IF user.from_body %]</label>[% END %] + </td> + <td><a href="[% c.uri_for_action( 'admin/reports/index', search => user.email ) %]">[% PROCESS value_or_nbsp value=user.email %]</a></td> <td>[% PROCESS value_or_nbsp value=user.from_body.name %] [% IF user.is_superuser %] * [% END %] </td> [% IF c.cobrand.moniker != 'zurich' %] <td>[% user.flagged == 2 ? loc('User in abuse table') : user.flagged ? loc('Yes') : ' ' %]</td> [% END %] - <td>[% IF user.id %]<a href="[% c.uri_for_action( 'admin/users/edit', user.id ) %]">[% loc('Edit') %]</a>[% END %]</td> + <td>[% IF user.id %]<a href="[% c.uri_for_action( 'admin/users/edit', [ user.id ] ) %]">[% loc('Edit') %]</a>[% END %]</td> + <td>[% IF user.id %]<a href="[% c.uri_for_action( 'admin/users/log', [ user.id ] ) %]">[% loc('Timeline') %]</a>[% END %]</td> </tr> [%- END -%] </table> -[% ELSIF searched %] +<p><label for="roles">[% loc('Assign selected to role:') %]</label> +[% IF c.user.is_superuser %] +[% INCLUDE role_select label='roles' %] +[% ELSE %] +<select class="form-control js-multiple" id="roles" name="roles" multiple> + [% FOREACH role IN roles %] + <option value="[% role.id %]">[% role.name | html %]</option> + [% END %] +</select> +[% END %] +<p><input class="btn" type="submit" value="[% loc('Save changes') %]"> +</form> + +[% ELSIF searched || role_selected %] <div class="fms-admin-warning"> [% loc("Searching found no users.") %] @@ -44,7 +91,7 @@ [% END %] -[% IF NOT searched %] +[% IF NOT ( searched || role_selected )%] <h2>[% loc('Add user') %]</h2> [% INCLUDE 'admin/users/form.html', user = '' %] [% ELSE %] diff --git a/templates/web/base/admin/users/log.html b/templates/web/base/admin/users/log.html new file mode 100644 index 000000000..4b426e0ba --- /dev/null +++ b/templates/web/base/admin/users/log.html @@ -0,0 +1,72 @@ +[% INCLUDE 'admin/header.html' title=loc('Timeline') _ ', ' _ user.name %] + +<style> +.timeline ul { + margin-bottom: 0; +} +.timeline dd { + margin-bottom: 0; +} +</style> + +[% +action_map = { + add = 'Added' + delete = 'Deleted' + edit = 'Edited' + merge = 'Merged' + moderation = 'Moderated' + resend = 'Resent' + category_change = 'Changed category of' + state_change = 'Changed state of' +} +%] + +[%- date = '' %] +[% FOREACH moment IN time.keys.sort.reverse %] + [%- curdate = time.$moment.0.date.strftime('%A, %e %B %Y') -%] + [%- IF date != curdate %] + [% '</dl>' IF date %] + <h2>[% curdate %]</h2> + + <dl class="timeline"> + [%- date = curdate -%] + [%- END -%] + <dt><b>[% time.$moment.0.date.hms %]</b></dt> + <dd><ul> + [% FOREACH item IN time.$moment %] + <li> + [%~ IF item.obj.problem_id %] + [%~ SET report_url = c.uri_for( '/report', item.obj.problem_id ) _ "#update_" _ item.obj.id %] + [%~ ELSE %] + [%~ SET report_url = c.uri_for('/report', item.obj.id) %] + [%~ END %] + [%~ SET report_link = "<a href='" _ report_url _ "'>" _ item.obj.id _ "</a>" %] + [%- SWITCH item.type -%] + [%~ CASE 'problem' %] + [%- tprintf(loc('Problem %s created'), mark_safe(report_link)) %], ‘[% item.obj.title | html %]’ + [%~ CASE 'problemContributedBy' %] + [%- 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 %] + [%~ CASE 'shortlistAdded' %] + [%- tprintf(loc('Problem %s added to shortlist'), mark_safe(report_link)) %] + [%~ CASE 'shortlistRemoved' %] + [%- tprintf(loc('Problem %s removed from shortlist'), mark_safe(report_link)) %] + [%~ CASE 'log' %] + [%~ SET object_summary = item.log.object_summary %] + [% IF object_summary %] + [%~ SET link = tprintf('<a href="%s">%s</a>', item.log.link, object_summary) %] + [%- tprintf('%s %s %s', action_map.${item.log.action}, item.log.actual_object_type, mark_safe(link)) %] + [% ' – ' _ item.log.reason IF item.log.reason %] + [% ELSE %] + [%- tprintf('%s %s %s', action_map.${item.log.action}, item.log.actual_object_type, item.log.object_id) %] + [% END %] + [%- END %] + </li> + [%- END %] + </ul></dd> +[% END %] + +[% INCLUDE 'admin/footer.html' %] diff --git a/templates/web/base/alert/_index_text.html b/templates/web/base/alert/_index_text.html new file mode 100644 index 000000000..80ed142d1 --- /dev/null +++ b/templates/web/base/alert/_index_text.html @@ -0,0 +1,25 @@ +<p> +[% IF c.cobrand.is_council %] +[% tprintf(loc('%s has a variety of RSS feeds and email alerts for local +problems, including alerts for all problems within a particular ward, or all +problems within a certain distance of a particular location.', "%s is the site name"), site_name) %] +[% ELSE %] +[% tprintf(loc('%s has a variety of RSS feeds and email alerts for local problems, including +alerts for all problems within a particular ward or council, or all problems +within a certain distance of a particular location.', "%s is the site name"), site_name) %] +[% END %] +</p> + +[% IF location_error %] + <div class="error">[% location_error | safe %]</div> +[% ELSE %] + [% INCLUDE 'errors.html' %] +[% END %] + +<p> +[% IF c.cobrand.is_council %] +[% tprintf(loc('To find out what local alerts we have for you, please enter your %s postcode or street name and area:'), c.cobrand.council_area) %] +[% ELSE %] +[% loc('To find out what local alerts we have for you, please enter your postcode or street name and area' ) %] +[% END %] +</p> diff --git a/templates/web/base/alert/_list.html b/templates/web/base/alert/_list.html index d997a5abb..782989a5c 100644 --- a/templates/web/base/alert/_list.html +++ b/templates/web/base/alert/_list.html @@ -22,24 +22,18 @@ <h3>[% loc('Problems in an area') %]</h3> [% END %] - <p id="rss_local"> - <a href="[% rss_feed_uri %]"><img src='/i/feed.png' width='16' height='16' title='[% loc('RSS feed of nearby problems') %]' alt='[% loc('RSS feed') %]' border='0'></a> - <label class="label-containing-checkbox" for="[% rss_feed_id %]"> - <input type="radio" name="feed" id="[% rss_feed_id %]" value="[% rss_feed_id %]"[% IF rss_feed_id == selected_feed || selected_feed == '' %] checked[% END %]> - [% tprintf( loc('Problems within %.1fkm of %s'), population_radius, name_of_location ) %] - [% loc('(covers roughly 200,000 people)') %] - </label> - </p> + [% PROCESS 'alert/_list_rss_local.html' %] <p id="rss_local_alt"> [% SET distance_options = '<a href="' _ rss_feed_2k _ ' ">2km</a> / <a href="' _ rss_feed_5k _ ' ">5km</a> / <a href="' _ rss_feed_10k _ '">10km</a> / <a href="' _ rss_feed_20k _ '">20km</a>' %] - [% tprintf(loc('(we also have RSS feeds for problems within %s)', "%s is a list of distance links, e.g. [2km] / [5km] / [10km] / [20km]"), distance_options) %] + [% tprintf(loc('(we also have RSS feeds for problems within %s)', "%s is a list of distance links, e.g. [2km] / [5km] / [10km] / [20km]"), mark_safe(distance_options)) %] </p> [% FOREACH option IN options %] <p> - <a href="[% option.uri %]"><img src="/i/feed.png" width="16" height="16" -title="[% option.rss_text %]" alt="RSS feed" border="0"></a> + <a href="[% option.uri %]" class="alerts-rss-link"> + <img src="/i/feed.png" width="16" height="16" title="[% option.rss_text %]" alt="[% loc('RSS feed') %]"> + </a> <label class="label-containing-checkbox" for="[% option.id %]"> <input type="radio" name="feed" id="[% option.id %]" value="[% option.id %]"[% IF option.id == selected_feed %] checked[% END %]> [% option.text %] @@ -55,8 +49,9 @@ title="[% option.rss_text %]" alt="RSS feed" border="0"></a> [% FOREACH option IN reported_to_options %] <p> - <a href="[% option.uri %]"><img src="/i/feed.png" width="16" height="16" - title="[% option.rss_text %]" alt="RSS feed" border="0"></a> + <a href="[% option.uri %]" class="alerts-rss-link"> + <img src="/i/feed.png" width="16" height="16" title="[% option.rss_text %]" alt="[% loc('RSS feed') %]"> + </a> <label class="label-containing-checkbox" for="[% option.id %]"> <input type="radio" name="feed" id="[% option.id %]" value="[% option.id %]"[% IF option.id == selected_feed %] checked[% END %]> [% option.text %] diff --git a/templates/web/base/alert/_list_rss_local.html b/templates/web/base/alert/_list_rss_local.html new file mode 100644 index 000000000..a7fd82ca2 --- /dev/null +++ b/templates/web/base/alert/_list_rss_local.html @@ -0,0 +1,10 @@ + <p id="rss_local"> + <a href="[% rss_feed_uri %]" class="alerts-rss-link"> + <img src="/i/feed.png" width="16" height="16" title="[% loc('RSS feed of nearby problems') %]" alt="[% loc('RSS feed') %]"> + </a> + <label class="label-containing-checkbox" for="[% rss_feed_id %]"> + <input type="radio" name="feed" id="[% rss_feed_id %]" value="[% rss_feed_id %]"[% IF rss_feed_id == selected_feed || selected_feed == '' %] checked[% END %]> + [% tprintf( loc('Problems within %.1fkm of %s'), population_radius, name_of_location ) %] + [% loc('(covers roughly 200,000 people)') %] + </label> + </p> diff --git a/templates/web/base/alert/index.html b/templates/web/base/alert/index.html index fa6e01fad..80186ded7 100644 --- a/templates/web/base/alert/index.html +++ b/templates/web/base/alert/index.html @@ -3,41 +3,19 @@ <h1>[% loc('Local RSS feeds and email alerts') %]</h1> -<p> -[% IF c.cobrand.is_council %] -[% tprintf(loc('%s has a variety of RSS feeds and email alerts for local -problems, including alerts for all problems within a particular ward, or all -problems within a certain distance of a particular location.', "%s is the site name"), site_name) %] -[% ELSE %] -[% tprintf(loc('%s has a variety of RSS feeds and email alerts for local problems, including -alerts for all problems within a particular ward or council, or all problems -within a certain distance of a particular location.', "%s is the site name"), site_name) %] -[% END %] -</p> - -[% IF location_error %] - <div class="error">[% location_error %]</div> -[% ELSE %] - [% INCLUDE 'errors.html' %] -[% END %] +[% PROCESS 'alert/_index_text.html' %] -<p> -[% IF c.cobrand.is_council %] -[% tprintf(loc('To find out what local alerts we have for you, please enter your %s postcode or street name and area:'), c.cobrand.council_area) %] -[% ELSE %] -[% loc('To find out what local alerts we have for you, please enter your postcode or street name and area' ) %] -[% END %] -</p> <form method="get" action="/alert/list" class="form-box js-geolocate"> <fieldset> + <legend class="visuallyhidden">[% loc('Search for location of email alert or RSS feed') %]</legend> <label for="pc">[% loc('Postcode or street name and area') %]</label> <p class="form-hint" id="pc-hint">[% tprintf(loc('e.g. ‘%s’ or ‘%s’'), c.cobrand.example_places) %]</p> <div class="form-txt-submit-box"> <input class="form-control" type="text" id="pc" name="pc" value="[% pc | html %]" aria-describedby="pc-hint"> - <input class="green-btn" type="submit" value="[% loc('Go') %]"> + [% INCLUDE 'around/_postcode_submit_button.html' attr='class="green-btn"' %] </div> </fieldset> - <a href="/alert/list" id="geolocate_link">… [% loc('or locate me automatically') %]</a> + <a href="/alert/list" id="geolocate_link">… [% loc('or use my location') %]</a> </form> [% IF photos.size %] diff --git a/templates/web/base/alert/list.html b/templates/web/base/alert/list.html index 14215b65d..dbc877a69 100644 --- a/templates/web/base/alert/list.html +++ b/templates/web/base/alert/list.html @@ -10,7 +10,7 @@ [% IF pretty_pc %] [% - pretty_pc = pretty_pc | html | replace(' ', ' '); + pretty_pc = pretty_pc | replace(' ', ' '); # Non-breaking space title = tprintf( loc("Local RSS feeds and email alerts for ‘%s’"), pretty_pc ); %] [% END %] diff --git a/templates/web/base/alert/updates.html b/templates/web/base/alert/updates.html index a77f8d0f9..0fbed2254 100644 --- a/templates/web/base/alert/updates.html +++ b/templates/web/base/alert/updates.html @@ -5,7 +5,7 @@ [% INCLUDE 'errors.html' %] -<p><a href="[% c.uri_for( '/rss', problem_id ) %]"> +<p><a href="[% c.uri_for( '/rss', problem.id ) %]"> <img src="/i/feed.png" width="16" height="16" title="[% loc('RSS feed') %]" alt="[% loc('RSS feed of updates to this problem' ) %]" border="0" style="float:right"> </a> </p> @@ -16,15 +16,27 @@ <form action="/alert/subscribe" method="post"> <fieldset> + [% IF c.user_exists %] + [% IF c.user.has_permission_to("contribute_as_another_user", problem.bodies_str_ids) %] + <label class="hidden n" for="alert_rznvy">[% loc('Email') %]</label> + <div class="form-txt-submit-box"> + <input class="form-control" type="email" name="rznvy" id="alert_rznvy" value="[% email | html %]"> + <input class="green-btn" type="submit" value="[% loc('Subscribe') %]"> + </div> + [% ELSE %] + <input class="green-btn" type="submit" name="alert" value="[% loc('Subscribe') %]"> + [% END %] + [% ELSE %] <label class="hidden n" for="alert_rznvy">[% loc('Your email') %]</label> <div class="form-txt-submit-box"> <input class="form-control" type="email" name="rznvy" id="alert_rznvy" value="[% email | html %]"> <input class="green-btn" type="submit" value="[% loc('Subscribe') %]"> </div> + [% END %] <input type="hidden" name="token" value="[% csrf_token %]"> - <input type="hidden" name="id" value="[% problem_id | html %]"> + <input type="hidden" name="id" value="[% problem.id | html %]"> <input type="hidden" name="type" value="updates"> </fieldset> </form> diff --git a/templates/web/base/around/_error_multiple.html b/templates/web/base/around/_error_multiple.html index 34164973a..337ce7c77 100644 --- a/templates/web/base/around/_error_multiple.html +++ b/templates/web/base/around/_error_multiple.html @@ -10,7 +10,10 @@ [% IF match.icon %] <img src="[% match.icon %]" alt=""> [% END %] - <a href="/around?lat=[% match.latitude | uri %]&lon=[% match.longitude | uri %][% IF c.req.params.category %]&category=[% c.req.params.category | uri %][% END %]">[% match.address | html %]</a> + <a href="/around?lat=[% match.latitude | uri %]&lon=[% match.longitude | uri ~%] + [%~ IF c.get_param('category') %]&category=[% c.get_param('category') | uri %][% END ~%] + [%~ IF c.get_param('filter_category') %]&filter_category=[% c.get_param('filter_category') | uri %][% END ~%] + [%~ IF c.get_param('filter_group') %]&filter_group=[% c.get_param('filter_group') | uri %][% END %]">[% match.address | html %]</a> </li> [% END %] </ul> diff --git a/templates/web/base/around/_postcode_form_examples.html b/templates/web/base/around/_postcode_form_examples.html new file mode 100644 index 000000000..975d33927 --- /dev/null +++ b/templates/web/base/around/_postcode_form_examples.html @@ -0,0 +1 @@ +<p class="form-hint" id="pc-hint">[% tprintf(loc('e.g. ‘%s’ or ‘%s’'), c.cobrand.example_places) %]</p> diff --git a/templates/web/base/around/_postcode_submit_button.html b/templates/web/base/around/_postcode_submit_button.html new file mode 100644 index 000000000..749a3a950 --- /dev/null +++ b/templates/web/base/around/_postcode_submit_button.html @@ -0,0 +1,6 @@ +<input type="submit" [% attr | safe %] value="[% + IF c.cobrand.moniker == 'cheshireeast'; + 'Search for location'; + ELSE; + loc('Go'); + END %]"> diff --git a/templates/web/base/around/display_location.html b/templates/web/base/around/display_location.html index 6c71ad631..d0592749e 100755 --- a/templates/web/base/around/display_location.html +++ b/templates/web/base/around/display_location.html @@ -51,9 +51,13 @@ <input type="hidden" name="latitude" id="fixmystreet.latitude" value="[% latitude | html %]"> <input type="hidden" name="longitude" id="fixmystreet.longitude" value="[% longitude | html %]"> + + [% IF c.get_param('filter_group') %] + <input type="hidden" name="filter_group" id="filter_group" value="[% c.get_param('filter_group') | html %]"> + [% END %] [% END %] - [% map_html %] + [% map_html | safe %] [% IF c.req.params.no_pins %] <a class="big-hide-pins-link" rel='nofollow' href="[% c.uri_with( { no_pins => 0 } ) %]">[% loc('Show pins') %]</a> @@ -62,7 +66,7 @@ [% END %] <p class="sub-map-links" id='sub_map_links'> - [% map_sub_links %] + [% map_sub_links | safe %] [% IF c.req.params.no_pins %] <a id='hide_pins_link' rel='nofollow' href="[% c.uri_with( { no_pins => 0 } ) %]">[% loc('Show pins') %]</a> [% ELSE %] diff --git a/templates/web/base/around/location_error.html b/templates/web/base/around/location_error.html index fc9b2b8ce..8e1a75008 100644 --- a/templates/web/base/around/location_error.html +++ b/templates/web/base/around/location_error.html @@ -1 +1 @@ -<p class="form-error">[% location_error %]</p> +<p class="form-error">[% location_error | safe %]</p> diff --git a/templates/web/base/around/postcode_form.html b/templates/web/base/around/postcode_form.html index ca82f3388..60fa1a703 100644 --- a/templates/web/base/around/postcode_form.html +++ b/templates/web/base/around/postcode_form.html @@ -10,21 +10,30 @@ <form action="[% c.uri_for('/around') %]" method="get" name="postcodeForm" id="postcodeForm" class="js-geolocate"> <label for="pc">[% question %]:</label> - <p class="form-hint" id="pc-hint">[% tprintf(loc('e.g. ‘%s’ or ‘%s’'), c.cobrand.example_places) %]</p> + [% INCLUDE 'around/_postcode_form_examples.html' %] <div> <input type="text" name="pc" value="[% pc | html %]" id="pc" size="10" maxlength="200" required aria-describedby="pc-hint"> - <input type="submit" value="[% loc('Go') %]" id="sub"> + [% INCLUDE 'around/_postcode_submit_button.html' attr='id="sub"' %] </div> [% IF partial_token %] <input type="hidden" name="partial" value="[% partial_token.token %]"> [% END %] - [% IF c.user_exists AND c.user.categories.size %] + [% IF c.get_param('filter_category') OR c.get_param('filter_group') %] + <input type="hidden" name="filter_category" value="[% c.get_param('filter_category') | html %]"> + <input type="hidden" name="filter_group" value="[% c.get_param('filter_group') | html %]"> + [% ELSIF c.user_exists AND c.user.categories.size %] <input type="hidden" name="filter_category" value="[% c.user.categories_string | html %]"> [% END %] </form> - <a href="[% c.uri_for('/around') %]" id="geolocate_link">… [% loc('or locate me automatically') %]</a> + [%~ SET link_params = { + geolocate = 1 + }; + IF c.get_param('filter_category'); link_params.filter_category = c.get_param('filter_category'); END; + IF c.get_param('filter_group'); link_params.filter_group = c.get_param('filter_group'); END; + %] + <a href="[% c.uri_for('/around', link_params) | html %]" id="geolocate_link">… [% loc('or use my location') %]</a> [% UNLESS possible_location_matches %] [% INCLUDE 'around/_postcode_form_post.html' %] diff --git a/templates/web/base/around/tabbed_lists.html b/templates/web/base/around/tabbed_lists.html index f135684b9..b3284468a 100755 --- a/templates/web/base/around/tabbed_lists.html +++ b/templates/web/base/around/tabbed_lists.html @@ -1,5 +1,7 @@ [% INCLUDE "reports/_list-filters.html" %] +<h2 class="hidden-js">[% loc('Reports') %]</h2> + <div class="js-pagination"> [% INCLUDE 'pagination.html' param = 'p' %] </div> diff --git a/templates/web/base/auth/2fa/form-add.html b/templates/web/base/auth/2fa/form-add.html new file mode 100644 index 000000000..3603ec46c --- /dev/null +++ b/templates/web/base/auth/2fa/form-add.html @@ -0,0 +1,17 @@ +<p>[% loc('Please scan this image with your app, or enter the text code into your app, then generate a new one-time code and enter it below:') %]</p> + +<p align="center"><img src="[% qr_code %]" alt=""></p> +<p align="center">[% secret32.replace('(....)', '$1 ') %]</p> + +[% IF incorrect_code %] + <div class="form-error">[% loc('Sorry, that wasn’t the correct code') %]. + [% loc('Try again') %]:</div> +[% END %] + +<label for="2fa_code">[% loc('Code') %]</label> +<div class="form-txt-submit-box"> + <input autofocus class="form-control" type="number" id="2fa_code" name="2fa_code" value="" required> + <input type="submit" value="[% loc('Submit') %]" class="btn-primary"> +</div> +<input type="hidden" name="secret32" value="[% secret32 %]"> +<input type="hidden" name="2fa_action" value="confirm"> diff --git a/templates/web/base/auth/2faform.html b/templates/web/base/auth/2fa/form.html index bd6a7bd18..e093f6554 100644 --- a/templates/web/base/auth/2faform.html +++ b/templates/web/base/auth/2fa/form.html @@ -8,7 +8,7 @@ <h1>[% loc("Nearly done! Now check your phone…") %]</h1> <p>[% loc("Please generate a two-factor code and enter it below:") %]</p> [% END %] - <form action="/auth" method="post"> + <form action="/[% form_action OR 'auth' %]" method="post"> <input type="hidden" name="username" value="[% c.get_param('username') | html %]"> <input type="hidden" name="password_sign_in" value="[% c.get_param('password_sign_in') | html %]"> <input type="hidden" name="r" value="[% c.get_param('r') | html %]"> diff --git a/templates/web/base/auth/2fa/intro.html b/templates/web/base/auth/2fa/intro.html new file mode 100644 index 000000000..7813507a3 --- /dev/null +++ b/templates/web/base/auth/2fa/intro.html @@ -0,0 +1,32 @@ +[% +INCLUDE 'header.html', title = loc('Two-factor authentication'), bodyclass = 'fullwidthpage' +%] + +<div class="confirmation-header confirmation-header--phone"> + <h1>[% loc('Two-factor authentication') %]</h1> + + <form action="/[% form_action OR 'auth' %]" method="post"> + + [% IF stage == 'success' %] + <p>[% loc('Thanks, you have successfully enabled two-factor authentication on your account.') %]</p> + <p><a href="/my">[% loc('Your account') %]</a></p> + + [% ELSIF stage == 'activate' %] + [% PROCESS 'auth/2fa/form-add.html' %] + + [% ELSE # stage is intro %] + <p align="center">[% loc('Your account requires two-factor authentication to be set up.') %]</p> + <p align="center"> + <input class="btn-primary" type="submit" value="[% loc('Activate two-factor authentication') %]"> + </p> + <input type="hidden" name="2fa_action" value="activate"> + [% END %] + + <input type="hidden" name="username" value="[% c.get_param('username') | html %]"> + <input type="hidden" name="password_sign_in" value="[% c.get_param('password_sign_in') | html %]"> + <input type="hidden" name="r" value="[% c.get_param('r') | html %]"> + <input type="hidden" name="token" value="[% token | html %]"> + </form> +</div> + +[% INCLUDE 'footer.html' %] diff --git a/templates/web/base/auth/create.html b/templates/web/base/auth/create.html index 1886da95b..b8830e385 100644 --- a/templates/web/base/auth/create.html +++ b/templates/web/base/auth/create.html @@ -1,6 +1,8 @@ [% IF forgotten; title = loc('Forgot password'); +ELSIF expired_password; + title = loc('Password expired'); ELSE; title = loc('Create an account'); END; @@ -9,9 +11,11 @@ INCLUDE 'header.html', bodyclass='authpage' %] <h1> [% title %] + [% IF NOT expired_password %] <small> [% tprintf(loc('or <a href="%s">sign in</a>'), '/auth') %] </small> + [% END %] </h1> [% IF forgotten %] @@ -19,23 +23,32 @@ INCLUDE 'header.html', bodyclass='authpage' %] [% IF c.config.SMS_AUTHENTICATION %] [% loc('Sign in by email or text, providing a new password. When you click the link in your email or enter the SMS authentication code, your password will be updated.') %]</p> [% ELSE %] - [% loc('Sign in by email instead, providing a new password. When you click the link in your email, your password will be updated.') %]</p> + [% loc('Sign in by email instead, providing a new password. When you click the link in your email, your password will be updated.') %] [% END %] </p> +[% ELSIF expired_password %] +<p> + <a href="/auth/sign_out">[% loc('Sign out') %]</a> +</p> +<p> + [% loc('Your password has expired, please create a new one below. When you click the link in your email, your password will be updated.') %] +</p> [% END %] -<form action="/auth/[% forgotten ? 'forgot' : 'create' %]" method="post" name="general_auth" class="validate"> +<form action="/auth/[% expired_password ? 'expired' : forgotten ? 'forgot' : 'create' %]" method="post" name="general_auth" class="validate"> <fieldset> <input type="hidden" name="r" value="[% c.req.params.r | html %]"> + [% IF NOT expired_password %] + [% loc_username_error = INCLUDE 'auth/_username_error.html' default='email' %] -[% IF c.config.SMS_AUTHENTICATION %] - [% SET username_label = loc('Your email or mobile') %] -[% ELSE %] - [% SET username_label = loc('Your email') %] -[% END %] + [% IF c.config.SMS_AUTHENTICATION %] + [% SET username_label = loc('Your email or mobile') %] + [% ELSE %] + [% SET username_label = loc('Your email') %] + [% END %] <label class="n" for="username">[% username_label %]</label> [% IF loc_username_error %] @@ -43,6 +56,8 @@ INCLUDE 'header.html', bodyclass='authpage' %] [% END %] <input type="text" class="form-control required" id="username" name="username" value="[% username | html %]" autofocus autocomplete="username"> + [% END %] + [% IF field_errors.password_register %] <p class='form-error'>[% field_errors.password_register %]</p> [% END %] @@ -54,7 +69,7 @@ INCLUDE 'header.html', bodyclass='authpage' %] <div class="form-txt-submit-box"> <input class="required form-control js-password-validate" type="password" name="password_register" id="password_register" value="" autocomplete="new-password"> - <input class="green-btn" type="submit" name="sign_in_by_code" value="[% loc('Sign in') %]"> + <input class="green-btn" type="submit" name="sign_in_by_code" value="[% expired_password ? loc('Reset') : loc('Sign in') %]"> </div> </fieldset> diff --git a/templates/web/base/auth/general.html b/templates/web/base/auth/general.html index e2e880871..30b1bf63f 100644 --- a/templates/web/base/auth/general.html +++ b/templates/web/base/auth/general.html @@ -24,15 +24,22 @@ [% IF NOT oauth_need_email AND c.cobrand.social_auth_enabled %] [% IF c.config.FACEBOOK_APP_ID %] <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"> + <button name="social_sign_in" id="facebook_sign_in" value="facebook" class="btn btn--block btn--social btn--facebook"> <img alt="" src="/i/facebook-icon-32.png" width="17" height="32"> [% loc('Log in with Facebook') %] </button> </div> [% END %] + [% IF c.cobrand.feature('oidc_login') %] + <div class="form-box"> + <button name="social_sign_in" id="oidc_sign_in" value="oidc" class="btn btn--block btn--social btn--oidc"> + [% tprintf(loc('Login with %s'), c.cobrand.feature('oidc_login').display_name) %] + </button> + </div> + [% END %] [% IF c.config.TWITTER_KEY %] <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"> + <button name="social_sign_in" id="twitter_sign_in" value="twitter" class="btn btn--block btn--social btn--twitter"> <img alt="" src="/i/twitter-icon-32.png" width="17" height="32"> [% loc('Log in with Twitter') %] </button> diff --git a/templates/web/base/auth/generate_token.html b/templates/web/base/auth/generate_token.html index f7061be45..9152d0cb3 100644 --- a/templates/web/base/auth/generate_token.html +++ b/templates/web/base/auth/generate_token.html @@ -8,37 +8,63 @@ INCLUDE 'header.html', title = loc('Security'), bodyclass = 'fullwidthpage' <h1>[% loc('Your token has been generated') %]</h1> <p> - <strong>[% loc('Token:') %]</strong> + <strong>[% loc('Token') %]:</strong> <span>[% existing_token | html %]</span> </p> <p><a href="/my">[% loc('Your account') %]</a></p> </div> -[% ELSIF toggle_2fa_on %] +[% ELSIF toggle_2fa_off %] <div class="confirmation-header"> - <h1>[% loc('Two-factor authentication has been activated') %]</h1> - - <p align="center"><img src="[% qr_code %]"></p> - <p align="center">[% secret32.replace('(....)', '$1 ') %]</p> + <h1>[% loc('Two-factor authentication has been deactivated') %]</h1> <p><a href="/my">[% loc('Your account') %]</a></p> </div> -[% ELSIF toggle_2fa_off %] +[% ELSIF stage == 'success' %] <div class="confirmation-header"> - <h1>[% loc('Two-factor authentication has been deactivated') %]</h1> - + <h1>[% loc('Two-factor authentication has been activated') %]</h1> + <p>[% loc('Thanks, you have successfully enabled two-factor authentication on your account.') %]</p> <p><a href="/my">[% loc('Your account') %]</a></p> </div> +[% ELSIF stage == 'activate' %] + <div class="confirmation-header confirmation-header--phone"> + <h1>[% loc('Two-factor authentication') %]</h1> + + <form action="[% c.uri_for_action('/auth/profile/generate_token') %]" method="post" name="generate_token"> + <input type="hidden" name="token" value="[% csrf_token %]"> + [% PROCESS 'auth/2fa/form-add.html' %] + </form> + [% ELSE %] <h1>[% loc('Security') %]</h1> <form action="[% c.uri_for_action('/auth/profile/generate_token') %]" method="post" name="generate_token"> + +<h2>[% loc('Two-factor authentication') %]</h2> + + <input type="hidden" name="token" value="[% csrf_token %]"> + + <p> + [% IF c.user.is_superuser || c.user.from_body %] + [% IF has_2fa %] + <input name="2fa_activate" type="submit" class="btn" value="[% loc('Change two-factor authentication') %]"> + [% IF !c.cobrand.call_hook('must_have_2fa', c.user) %] + <input name="2fa_deactivate" type="submit" class="btn" value="[% loc('Deactivate two-factor authentication') %]"> + [% END %] + [% ELSE %] + <input name="2fa_activate" type="submit" class="btn" value="[% loc('Activate two-factor authentication') %]"> + [% END %] + [% END %] + </p> + +<h2>[% loc('Token') %]</h2> + <input type="hidden" name="token" value="[% csrf_token %]"> [% IF existing_token %] @@ -50,17 +76,15 @@ INCLUDE 'header.html', title = loc('Security'), bodyclass = 'fullwidthpage' <p> <input name="generate_token" type="submit" class="btn" value="[% existing_token ? loc('Replace token') : loc('Generate token') %]"> - [% IF c.user.is_superuser %] - <input name="toggle_2fa" type="submit" class="btn" value="[% has_2fa ? loc('Deactivate two-factor authentication') : loc('Activate two-factor authentication') %]"> - [% END %] </p> -</form> [% IF existing_token %] <p> [% loc('If you generate a new token the existing token will no longer work.') %] </p> [% END %] + +</form> [% END %] [% INCLUDE 'footer.html' %] diff --git a/templates/web/base/common_header_tags.html b/templates/web/base/common_header_tags.html index e29d96655..6edcc63a4 100644 --- a/templates/web/base/common_header_tags.html +++ b/templates/web/base/common_header_tags.html @@ -1,6 +1,13 @@ [% SET start = c.config.ADMIN_BASE_URL IF admin %] <meta http-equiv="content-type" content="text/html; charset=utf-8"> +<link rel="manifest" href="/.well-known/manifest.webmanifest"> +[% IF manifest_theme %] + <meta name='theme-color' content='[% manifest_theme.theme_colour %]'> + [% FOREACH icon IN manifest_theme.icons %] + <link rel="apple-touch-icon" sizes="[% icon.sizes %]" href="[% icon.src %]"> + [% END %] +[% END %] [% IF csrf_token %] <meta content="[% csrf_token %]" name="csrf-token" /> @@ -15,6 +22,14 @@ (function(a){a=a.documentElement;a.className=a.className.replace(/\bno-js\b/,"js");var b=-1<a.className.indexOf("ie8");b=Modernizr.mq("(min-width: 48em)")||b?"desktop":"mobile";"IntersectionObserver"in window&&(a.className+=" lazyload");"mobile"==b&&(a.className+=' mobile[% " map-fullscreen only-map map-reporting" IF page == "around" %]')})(document); </script> +<script nonce="[% csp_nonce %]"> +if ('serviceWorker' in navigator) { + window.addEventListener('load', function() { + navigator.serviceWorker.register('/service-worker.js'); + }); +} +</script> + [% IF robots %] <meta name="robots" content="[% robots %]"> [% ELSIF c.config.STAGING_SITE %] @@ -23,10 +38,7 @@ [% INCLUDE 'header_rss.html' %] -<title> - [% "$title :: " | html IF title %] - [% site_name -%] -</title> +[% INCLUDE 'header/title.html' %] [% IF bodyclass.match('frontpage') %] <link rel="prefetch" href="[% version('/js/validation_rules.js') %]"> diff --git a/templates/web/base/common_scripts.html b/templates/web/base/common_scripts.html index fd7011763..b8c4db343 100644 --- a/templates/web/base/common_scripts.html +++ b/templates/web/base/common_scripts.html @@ -39,8 +39,14 @@ IF c.user_exists AND (c.user.from_body OR c.user.is_superuser); version('/jslib/jquery-1.7.2.min.js'), version('/cobrands/fixmystreet/staff.js') ); + IF bodyclass.match('mappage') AND c.cobrand.suggest_duplicates AND NOT login_success AND NOT oauth_need_email; + scripts.push( + version('/js/duplicates.js') + ); + END; IF c.user.has_body_permission_to('planned_reports'); scripts.push( + version('/vendor/idb-keyval-iife.min.js'), version('/cobrands/fixmystreet/offline.js'), ); END; @@ -68,6 +74,7 @@ END; IF admin; scripts.push( version('/cobrands/fixmystreet/admin.js'), + version('/vendor/html5sortable.min.js'), ); END; diff --git a/templates/web/base/contact/enquiry/index.html b/templates/web/base/contact/enquiry/index.html new file mode 100644 index 000000000..c88ca221e --- /dev/null +++ b/templates/web/base/contact/enquiry/index.html @@ -0,0 +1,79 @@ +[% INCLUDE 'header.html', + bodyclass = 'twothirdswidthpage', + title = loc('General Enquiry') +%] + +<form method="post" action="/contact/enquiry/submit" class="validate" enctype="multipart/form-data"> + <input type="hidden" name="token" value="[% csrf_token %]"> + <input type="hidden" name="submit_problem" value="1"> + <fieldset> + [% INCLUDE 'errors.html' %] + + <label for="form_name">[% loc('Your name') %]</label> + [% IF field_errors.name %] + <div class="form-error">[% field_errors.name %]</div> + [% END %] + <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> + [% 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"> + + <div class="form-group"> + <label for="form_phone">[% loc('Your phone number') %]</label> + <span class="required-text required-text--optional">[% loc('optional') %]</span> + <input type="text" class="form-control extra.phone" name="extra.phone" id="form_phone" value="[% report.user.phone | html %]" size="30"> + </div> + + <label for="form_category">[% loc('Subject') %]</label> + [% IF field_errors.category %] + <div class="form-error">[% field_errors.category %]</div> + [% END %] + <select class="form-control required" name="category" id="category"> + <option value="">[% loc('-- Please select --') %]</option> + [% FOREACH contact IN contacts %] + <option value="[% contact.category | html %]" [% "selected" IF report.category == contact.category %]>[% contact.category | html %]</option> + [% END %] + </select> + + <label for="form_detail">[% loc('Message') %]</label> + [% IF field_errors.detail %] + <div class="form-error">[% field_errors.detail %]</div> + [% END %] + <textarea class="form-control required" name="detail" id="form_detail" rows="7" cols="50">[% report.detail | html %]</textarea> + + <input type="hidden" name="upload_fileid" value="[% upload_fileid %]"> + <label for="form_photo"> + [% loc('Photos/Documents') %] + </label> + + [% IF field_errors.photo %] + <p class='form-error'>[% field_errors.photo %]</p> + [% END %] + + <div id="form_photos"> + [% IF upload_fileid OR report.get_extra_metadata('enquiry_files').keys.count %] + <p>[% loc('You have already attached files to this report. Note that you can attach a maximum of 3 to this report (if you try to upload more, the oldest will be removed).') %]</p> + [% FOREACH id IN upload_fileid.split(',') %] + <img align="right" src="/photo/temp.[% id %]" alt=""> + [% END %] + + [% IF report.get_extra_metadata('enquiry_files') %] + [% FOREACH id IN report.get_extra_metadata('enquiry_files').values %] + [% id %]<br /> + [% END %] + <input type="hidden" name="enquiry_files" value="[% enquiry_files | html %]" /> + [% END %] + [% END %] + <p><input type="file" name="photo1" id="form_photo"></p> + <p><input type="file" name="photo2" id="form_photo2"></p> + <p><input type="file" name="photo3" id="form_photo3"></p> + </div> + + <input class="final-submit green-btn" type="submit" value="[% loc('Send') %]"> + + </fieldset></form> + +[% INCLUDE 'footer.html' pagefooter = 'yes' %] diff --git a/templates/web/base/contact/enquiry/submit.html b/templates/web/base/contact/enquiry/submit.html new file mode 100644 index 000000000..050fd31a9 --- /dev/null +++ b/templates/web/base/contact/enquiry/submit.html @@ -0,0 +1 @@ +[% INCLUDE 'contact/submit.html' %] diff --git a/templates/web/base/contact/index.html b/templates/web/base/contact/index.html index 85fa40f89..05a24160f 100644 --- a/templates/web/base/contact/index.html +++ b/templates/web/base/contact/index.html @@ -12,7 +12,11 @@ [% IF c.cobrand.moniker == 'fixmystreet' %] <h1>FixMyStreet technical support</h1> [% ELSE %] -<h1>[% loc('Contact the team') %]</h1> + [% TRY %] + [% INCLUDE 'contact/_heading.html' %] + [% CATCH file %] + <h1>[% loc('Contact the team') %]</h1> + [% END %] [% END %] <form method="post" action="/contact/submit" class="validate"> @@ -92,7 +96,7 @@ <div class="form-group"> <label for="form_phone">[% loc('Your phone number') %]</label> - <span class="required-text required-text--optional">optional</span> + <span class="required-text required-text--optional">[% loc('optional') %]</span> <input type="text" class="form-control extra.phone" name="extra.phone" id="form_phone" value="" size="30"> </div> diff --git a/templates/web/base/dashboard/heatmap-list.html b/templates/web/base/dashboard/heatmap-list.html new file mode 100644 index 000000000..d736a11f4 --- /dev/null +++ b/templates/web/base/dashboard/heatmap-list.html @@ -0,0 +1,28 @@ +<h3>Five newest reports</h3> +[% INCLUDE column problems = five_newest %] + +<h3>Five most recent commented reports<br> +<small>Not from yourself/backend</small> +</h3> +[% INCLUDE column problems = five_commented %] + +<h3>Ten least recently updated open reports</h3> +[% INCLUDE column problems = ten_oldest %] + +[% BLOCK column %] +<section class="full-width"> + <ul class="item-list item-list--reports"> + [% IF problems.size %] + [% FOREACH problem IN problems %] + [% INCLUDE 'reports/_list-entry.html' include_sentinfo = 1 include_lastupdate = 1 %] + [% END %] + [% ELSE %] + <li class="item-list__item item-list__item--empty"> + <p>[% loc('There are no reports to show.') %]</p> + </li> + [% END %] + </ul> +</section> +[% END %] + + diff --git a/templates/web/base/dashboard/heatmap.html b/templates/web/base/dashboard/heatmap.html new file mode 100755 index 000000000..ca4d02926 --- /dev/null +++ b/templates/web/base/dashboard/heatmap.html @@ -0,0 +1,55 @@ +[% + map_js.push( + '/vendor/HeatmapLayer.js', + '/cobrands/fixmystreet/density-map.js', + ); + PROCESS "maps/${map.type}.html"; + SET bodyclass = 'mappage'; + INCLUDE 'header.html', + title = tprintf(loc('%s - Summary reports'), body.name) +%] + +[% map_html | safe %] + +</div> +<div id="map_sidebar"> + <div id="side"> + + <h1 id="reports_heading"> + [% body.name %] + </h1> + +<div class="full-width"> + +[% INCLUDE "reports/_list-filters.html", use_form_wrapper = 1 heatmap=1 %] + +<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 %]"> + +<p class="report-list-filters"> +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> + [% END %] +</select> + +</div> + +<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> + <input type="radio" name="heatmap" id="heatmap_no" value="No"> + <label class="btn" for="heatmap_no">Pin map</label> +</p> + +<div id="js-reports-list"> + [% INCLUDE 'dashboard/heatmap-list.html' %] +</div> + + </div> +</div> +[% INCLUDE 'footer.html' %] diff --git a/templates/web/base/dashboard/index.html b/templates/web/base/dashboard/index.html index c90823d37..5ac414bde 100644 --- a/templates/web/base/dashboard/index.html +++ b/templates/web/base/dashboard/index.html @@ -38,9 +38,10 @@ <p> <label for="category">[% loc('Category:') %]</label> <select class="form-control" name="category" id="category"><option value=''>[% loc('All') %]</option> - [% FOR cat IN contacts %] + [% BLOCK category_option %] <option value='[% cat.category | html %]'[% ' selected' IF category == cat.category %]>[% cat.category_display | html %]</option> [% END %] + [%~ INCLUDE 'report/new/_category_select.html' category_options=contacts ~%] </select> </p> diff --git a/templates/web/base/debug_footer.html b/templates/web/base/debug_footer.html deleted file mode 100644 index a1b7fc155..000000000 --- a/templates/web/base/debug_footer.html +++ /dev/null @@ -1,40 +0,0 @@ -[% IF c.config.STAGING_SITE and c.config.SHOW_DEBUG %] - -<hr style="clear: both;"> - -<ul> - <li>cobrand.moniker: [% c.cobrand.moniker %]</li> - <li>additional_template_paths: [% additional_template_paths.join(', ') || '--empty--' %]</li> - <li>lang_code: [% lang_code %]</li> - <li>user.id: [% c.user.id || '--not logged in--' %]</li> -</ul> - -<style type="text/css"> - #overrides_form { - font-size: 80%; - } - #overrides_form label { - float: left; - text-align: right; - padding-right: 0.5em; - width: 12em; - } - -</style> - -<!-- Use a post so that we don't clutter up the url --> -<form action="" method="post" id="overrides_form" name="overrides_form"> - - <label for="_override_clear_all">Clear all overrides:</label> - <input type="checkbox" name="_override_clear_all" id="_override_clear_all" value="1"><br> - - [% FOREACH k IN ['cobrand_moniker', 'lang'] %] - <label for="override_[% k %]">[% k %]:</label> - <input type="text" name="_override_[% k %]" id="override_[% k %]" value="[% c.get_override(k)%]"><br> - [% END %] - - <label> </label><input type="submit" value="Change overrides"> -</form> - -[% END %] - diff --git a/templates/web/base/debug_header.html b/templates/web/base/debug_header.html index 92ccbc357..222878871 100644 --- a/templates/web/base/debug_header.html +++ b/templates/web/base/debug_header.html @@ -1,5 +1,5 @@ -[% IF c.config.STAGING_SITE and c.config.SHOW_DEBUG %] - <p class="dev-site-notice"> - [% loc("This is a developer site; things might break at any time, and the database will be periodically deleted.") %] - </p> +[% IF c.config.STAGING_SITE and !c.config.STAGING_FLAGS.hide_staging_banner ~%] + <div class="dev-site-notice"> + [% loc("Staging site") %] + </div> [% END %] diff --git a/templates/web/base/defect_type/format.html b/templates/web/base/defect_type/format.html deleted file mode 100644 index 3c0781501..000000000 --- a/templates/web/base/defect_type/format.html +++ /dev/null @@ -1,9 +0,0 @@ -[% -# 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 241b310de..6d4acccf8 100755 --- a/templates/web/base/errors/generic.html +++ b/templates/web/base/errors/generic.html @@ -1,12 +1,13 @@ -[% INCLUDE 'header.html', bodyclass = 'fullwidthpage', title = loc('Error') %] +[% DEFAULT title = loc('Error') %] +[% INCLUDE 'header.html', bodyclass = 'fullwidthpage', title = title %] [% 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> + <h1>[% title %]</h1> + <p>[% message | safe %]</p> </div> [% INCLUDE 'footer.html' %] diff --git a/templates/web/base/footer.html b/templates/web/base/footer.html index e2bdbb01a..e2bdbb01a 100755..100644 --- a/templates/web/base/footer.html +++ b/templates/web/base/footer.html diff --git a/templates/web/base/header.html b/templates/web/base/header.html index 7f423ff9e..b3d77b3a6 100644 --- a/templates/web/base/header.html +++ b/templates/web/base/header.html @@ -4,12 +4,9 @@ # SET html_att = html_att _ ' dir="rtl"'; -%] <!doctype html> -<!--[if IE 8]> <html class="no-js ie8"[% html_att %]><![endif]--> -<!--[if IE 9]> <html class="no-js ie9"[% html_att %]><![endif]--> -<!--[if gt IE 9]><!--><html class="no-js"[% html_att %] -[% IF appcache ~%] - manifest="/offline/appcache.manifest" -[%~ END %]><!--<![endif]--> +<!--[if IE 8]> <html class="no-js ie8"[% html_att | safe %]><![endif]--> +<!--[if IE 9]> <html class="no-js ie9"[% html_att | safe %]><![endif]--> +<!--[if gt IE 9]><!--><html class="no-js"[% html_att | safe %]><!--<![endif]--> <head> <meta name="viewport" content="initial-scale=1.0"> @@ -26,15 +23,14 @@ [% TRY %][% PROCESS 'set_body_class.html' %][% CATCH file %][% END %] <body class="[% bodyclass | html IF bodyclass %]"> + [% INCLUDE 'debug_header.html' %] [% TRY %][% PROCESS 'before_wrapper.html' %][% CATCH file %][% END %] <div class="wrapper"> <div class="table-cell"> [% INCLUDE 'header_site.html' %] - [% pre_container_extra %] + [% pre_container_extra | safe %] <div class="container"> <div class="content[% " $mainclass" | html IF mainclass %]" role="main"> - - <!-- [% INCLUDE 'debug_header.html' %] --> diff --git a/templates/web/base/header/css.html b/templates/web/base/header/css.html index 219369465..a5d2580e8 100644 --- a/templates/web/base/header/css.html +++ b/templates/web/base/header/css.html @@ -8,4 +8,4 @@ <![endif]--> <link rel="stylesheet" href="[% version('/vendor/OpenLayers/theme/default/style.css') %]"> -[% extra_css %] +[% extra_css | safe %] diff --git a/templates/web/base/header/title.html b/templates/web/base/header/title.html new file mode 100644 index 000000000..f3ff5119c --- /dev/null +++ b/templates/web/base/header/title.html @@ -0,0 +1,4 @@ +<title> + [% tprintf('%s :: ', title) IF title %] + [% site_name -%] +</title> diff --git a/templates/web/base/header_opengraph.html b/templates/web/base/header_opengraph.html index 8cda4c717..6d2b55fed 100644 --- a/templates/web/base/header_opengraph.html +++ b/templates/web/base/header_opengraph.html @@ -1,5 +1,5 @@ <meta property="og:url" content="[% c.cobrand.base_url %][% c.req.uri.path %]"> - <meta property="og:title" content="[% title || site_name | html %]"> + <meta property="og:title" content="[% title || site_name %]"> <meta property="og:site_name" content="[% site_name %]"> [% IF c.req.uri.path == '/' %]<meta property="og:description" content="[% loc('Report, view, and discuss local street-related problems.') %]">[% END %] <meta property="og:type" content="website"> diff --git a/templates/web/base/header_opengraph_image.html b/templates/web/base/header_opengraph_image.html index 7ec1aabb0..4cd106fc8 100644 --- a/templates/web/base/header_opengraph_image.html +++ b/templates/web/base/header_opengraph_image.html @@ -1,4 +1,13 @@ + [% IF problem.photo %] + [% photo = problem.photos.first %] + [% data = problem.get_first_image_og %] + <meta property="og:image" content="[% c.cobrand.base_url %][% photo.url_og %]"> + <meta property="og:image:type" content="[% data.content_type %]"> + <meta property="og:image:width" content="[% data.width %]"> + <meta property="og:image:height" content="[% data.height %]"> + [% ELSE %] <meta property="og:image" content="[% c.cobrand.base_url %]/cobrands/fixmystreet/images/fms-og_image.jpg"> <meta property="og:image:type" content="image/jpeg"> <meta property="og:image:width" content="1200"> <meta property="og:image:height" content="630"> + [% END %] diff --git a/templates/web/base/js/translation_strings.html b/templates/web/base/js/translation_strings.html index 881f6ecb9..2eb652c1f 100644 --- a/templates/web/base/js/translation_strings.html +++ b/templates/web/base/js/translation_strings.html @@ -3,105 +3,108 @@ var fixmystreet = fixmystreet || {}; fixmystreet.password_minimum_length = [% c.cobrand.password_minimum_length %]; translation_strings = { - update: '[% loc('Please enter a message') | replace("'", "\\'") %]', + update: '[% loc('Please enter a message', "JS") %]', + error: '[% loc('Error', "JS") %]', title: { - required: '[% loc('Please enter a subject') | replace("'", "\\'") %]', - maxlength: '[% loc('Summaries are limited to {0} characters in length. Please shorten your summary') | replace("'", "\\'") %]' + required: '[% loc('Please enter a subject', "JS") %]', + maxlength: '[% loc('Summaries are limited to {0} characters in length. Please shorten your summary', "JS") %]', + notEmail: '[% loc('Please make sure you are not including an email address', "JS") %]' }, detail: { - required: '[% loc('Please enter some details') | replace("'", "\\'") %]', - maxlength: '[% loc('Reports are limited to {0} characters in length. Please shorten your report') | replace("'", "\\'") %]', + required: '[% loc('Please enter some details', "JS") %]', + maxlength: '[% loc('Reports are limited to {0} characters in length. Please shorten your report', "JS") %]', }, name: { - required: '[% loc('Please enter your name') | replace("'", "\\'") %]', - validName: '[% loc('Please enter your full name, councils need this information – if you do not wish your name to be shown on the site, untick the box below') | replace("'", "\\'") %]' + required: '[% loc('Please enter your name', "JS") %]', + validName: '[% loc('Please enter your full name, councils need this information – if you do not wish your name to be shown on the site, untick the box below', "JS") %]' }, - category: '[% loc('Please choose a category') | replace("'", "\\'") %]', + category: '[% loc('Please choose a category', "JS") %]', rznvy: { - required: '[% loc('Please enter your email') | replace("'", "\\'") %]', - email: '[% loc('Please enter a valid email') | replace("'", "\\'") %]' + required: '[% loc('Please enter your email', "JS") %]', + email: '[% loc('Please enter a valid email', "JS") %]' }, email: { - required: '[% loc('Please enter your email') | replace("'", "\\'") %]', - email: '[% loc('Please enter a valid email') | replace("'", "\\'") %]' + required: '[% loc('Please enter your email', "JS") %]', + email: '[% loc('Please enter a valid email', "JS") %]' }, password_sign_in: { - required: '[% loc('Please enter a password') | replace("'", "\\'") %]' + required: '[% loc('Please enter a password', "JS") %]' }, password_register: { - short: '[% tprintf(loc('Please make sure your password is at least %d characters long'), c.cobrand.password_minimum_length) | replace("'", "\\'") %]', + short: '[% tprintf(loc('Please make sure your password is at least %d characters long', "JS"), c.cobrand.password_minimum_length) %]', }, phone: { - required: '[% loc('Please enter your phone number') | replace("'", "\\'") %]' + required: '[% loc('Please enter your phone number', "JS") %]' }, - fms_extra_title: '[% loc('Please enter your title') | replace("'", "\\'") %]', - first_name: '[% loc('Please enter your first name') | replace("'", "\\'") %]', - last_name: '[% loc('Please enter your second name') | replace("'", "\\'") %]', - right_place: '[% loc('Right place?') | replace("'", "\\'") %]', - try_again: '[% loc('Try again') | replace("'", "\\'") %]', - place_pin_on_map: '[% loc('Place pin on map') | replace("'", "\\'") %]', - back: '[% loc('Back') | replace("'", "\\'") %]', - how_to_send: '[% loc('How to send successful reports') | replace("'", "\\'") %]', - more_details: '[% loc('Details') | replace("'", "\\'") %]', + fms_extra_title: '[% loc('Please enter your title', "JS") %]', + first_name: '[% loc('Please enter your first name', "JS") %]', + last_name: '[% loc('Please enter your second name', "JS") %]', + right_place: '[% loc('Reposition if needed, then hit Continue', "JS") %]', + try_again: '[% loc('Try again', "JS") %]', + place_pin_on_map: '[% loc('Place pin on map', "JS") %]', + back: '[% loc('Back', "JS") %]', + how_to_send: '[% loc('How to send successful reports', "JS") %]', + more_details: '[% loc('Details', "JS") %]', - this_report: '[% loc('This report') | replace("'", "\\'") %]', - this_is_the_problem: '[% loc('This is the problem') | replace("'", "\\'") %]', + this_report: '[% loc('This report', "JS") %]', + this_is_the_problem: '[% loc('This is the problem', "JS") %]', - or: '[% loc(' or ') | replace("'", "\\'") %]', + or: '[% loc(' or ', "JS") %]', - geolocation_declined: '[% loc('You declined; please fill in the box above') | replace("'", "\\'") %]', - geolocation_no_position: '[% loc('Could not look up location') | replace("'", "\\'") %]', - geolocation_no_result: '[% loc('No result returned') | replace("'", "\\'") %]', - geolocation_unknown: '[% loc('Unknown error') | replace("'", "\\'") %]', + geolocation_declined: '[% loc('You declined; please fill in the box above', "JS") %]', + geolocation_no_position: '[% loc('Could not look up location', "JS") %]', + geolocation_no_result: '[% loc('No result returned', "JS") %]', + geolocation_unknown: '[% loc('Unknown error', "JS") %]', - correct_position: '[% loc('Right place?') | replace("'", "\\'") %]', + correct_position: '[% loc('Right place?', "JS") %]', - reporting_a_problem: '[% loc('Reporting a problem') | replace("'", "\\'") %]', - ok: '[% loc('OK') | replace("'", "\\'") %]', - map: '[% loc('MAP') | replace("'", "\\'") %]', + reporting_a_problem: '[% loc('Reporting a problem', "JS") %]', + ok: '[% loc('Continue', "JS") %]', + map: '[% loc('MAP', "JS") %]', - map_map: '[% loc('Map') | replace("'", "\\'") %]', - map_satellite: '[% loc('Satellite') | replace("'", "\\'") %]', + map_map: '[% loc('Map', "JS") %]', + map_satellite: '[% loc('Satellite', "JS") %]', - expand_map: '[% loc('Expand map') | replace("'", "\\'") %]', - collapse_map: '[% loc('Collapse map') | replace("'", "\\'") %]', + expand_map: '[% loc('Expand map', "JS") %]', + collapse_map: '[% loc('Collapse map', "JS") %]', - permalink: '[% loc('Permalink') | replace("'", "\\'") %]', + filter: '[% loc('Filter', "JS") %]', - show_pins: '[% loc('Show pins') | replace("'", "\\'") %]', - hide_pins: '[% loc('Hide pins') | replace("'", "\\'") %]', + show_pins: '[% loc('Show pins', "JS") %]', + hide_pins: '[% loc('Hide pins', "JS") %]', - upload_max_files_exceeded: '[% loc ('Sorry! You’ve hit the limit of images that can be attached to one report.') | 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_max_files_exceeded: '[% loc('Sorry! You’ve hit the limit of images that can be attached to one report.', "JS") %]', + upload_default_message: '[% loc('Drag photos here or <u>browse photos</u>', "JS") %]', + upload_default_message_mobile: '[% loc('<u>Take or choose existing photo</u>', "JS") %]', + upload_cancel_confirmation: '[% loc('Are you sure you want to cancel this upload?', "JS") %]', + upload_invalid_file_type: '[% loc('Please upload an image only', "JS") %]', [% IF c.config.SMS_AUTHENTICATION ~%] - login_with_email: '[% loc('Log in with email/text') | replace("'", "\\'") %]', + login_with_email: '[% loc('Log in with email/text', "JS") %]', [% ELSE ~%] - login_with_email: '[% loc('Log in with email') | replace("'", "\\'") %]', + login_with_email: '[% loc('Log in with email', "JS") %]', [% END ~%] report_a_problem_btn: { - default: '[% loc('Report a problem') | replace("'", "\\'") %]', - here: '[% loc('Report a problem here') | replace("'", "\\'") %]', - another: '[% loc('Report another problem here') | replace("'", "\\'") %]' + default: '[% loc('Report a problem', "JS") %]', + here: '[% loc('Report a problem here', "JS") %]', + another: '[% loc('Report another problem here', "JS") %]' }, 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("'", "\\'") %]' + your_reports: '[% loc('Your offline reports', "JS") %]', + update_saved: '[% loc('Your update has been saved offline for submission when back online.', "JS") %]', + update_data_saved: '[% loc('Offline update data saved', "JS") %]', + clear_data: '[% loc('Clear offline data', "JS") %]', + are_you_sure: '[% loc('Are you sure?', "JS") %]', + data_cleared: '[% loc('Offline data cleared', "JS") %]', + reports_saved: '[% loc('Reports saved offline.', "JS") %]', + saving_reports: '[% loc('Saving reports offline', "This is followed by a progress count, e.g. 3/5", "JS") %]', + you_are_offline: '[% loc('You are offline', "JS") %]', + N_saved: '[% loc('<span>%s</span> saved.', "JS") %]', + saved_to_submit: '[% loc('You have <a id="oFN" href=""><span>%s</span> saved to submit</a>.', "JS") %]', + update_single: '[% loc('update', "JS") %]', + update_plural: '[% loc('updates', "JS") %]' } }; [% END %] diff --git a/templates/web/base/main_nav.html b/templates/web/base/main_nav.html index 189630902..1c253fd01 100644 --- a/templates/web/base/main_nav.html +++ b/templates/web/base/main_nav.html @@ -4,11 +4,11 @@ SET ul_class="nav-menu nav-menu--main" UNLESS ul_class.defined; %] [% BLOCK navitem ~%] - <li [% liattrs %]> + <li [% liattrs | safe %]> [%~ IF c.req.uri.path == uri AND NOT always_url ~%] - <span [% attrs %]>[% label %]</span> + <span [% attrs | safe %]>[% label %]</span> [%~ ELSE ~%] - <a href="[% uri %][% suffix IF suffix %]" [% attrs %]>[% label %]</a> + <a href="[% uri %][% suffix IF suffix %]" [% attrs | safe %]>[% label %]</a> [%~ END ~%] </li> [%~ END %] diff --git a/templates/web/base/main_nav_items.html b/templates/web/base/main_nav_items.html index 75fdecd9d..02999d492 100644 --- a/templates/web/base/main_nav_items.html +++ b/templates/web/base/main_nav_items.html @@ -1,12 +1,4 @@ -[%~ IF problem ~%] - [%~ INCLUDE navitem uri='/report/new?longitude=' _ problem.longitude _ '&latitude=' _ problem.latitude label=loc('Report another problem here') attrs='class="report-a-problem-btn"' ~%] -[%~ ELSIF latitude AND longitude ~%] - [%~ INCLUDE navitem uri='/report/new?longitude=' _ longitude _ '&latitude=' _ latitude label=loc('Report a problem here') attrs='class="report-a-problem-btn"' ~%] -[%~ ELSIF homepage_template ~%] - [%~ INCLUDE navitem uri='/report' label=loc('Report a problem') attrs='class="report-a-problem-btn"' ~%] -[%~ ELSE ~%] - [%~ INCLUDE navitem uri='/' label=loc('Report a problem') attrs='class="report-a-problem-btn"' ~%] -[%~ END ~%] +[% INCLUDE 'navigation/_report.html' %] [%~ IF c.user_exists ~%] [%~ INCLUDE navitem uri='/my' label=loc('Your account') ~%] @@ -18,23 +10,7 @@ [%~ INCLUDE navitem always_url=1 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_string | 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 ~%] +[%~ INCLUDE 'navigation/_all_reports.html' ~%] [%~ IF pc; diff --git a/templates/web/base/maps/google-ol.html b/templates/web/base/maps/google-ol.html index 8e0690f9d..47c940129 100644 --- a/templates/web/base/maps/google-ol.html +++ b/templates/web/base/maps/google-ol.html @@ -6,7 +6,7 @@ [% INCLUDE maps/openlayers.html %] [% UNLESS around_page %] <p class="sub-map-links" id="sub_map_links"> - [% map_sub_links %] + [% map_sub_links | safe %] </p> [% END %] [% END %] diff --git a/templates/web/base/maps/noscript_map.html b/templates/web/base/maps/noscript_map.html index 8418c4eb8..0b7431148 100644 --- a/templates/web/base/maps/noscript_map.html +++ b/templates/web/base/maps/noscript_map.html @@ -1,23 +1,23 @@ [% SET start = c.config.ADMIN_BASE_URL IF admin -%] <div class="noscript"> <div id="[% nsm_prefix %]drag"> - <[% map.img_type %] + <[% map.img_type | safe %] alt="NW map tile" id="[% nsm_prefix %]t2.2" name="tile_[% map.x_tile - 1 %].[% map.y_tile - 1 %]" src="[% map.tiles.0 %]" style="top:0; left:0;"> - <[% map.img_type %] + <[% map.img_type | safe %] alt="NE map tile" id="[% nsm_prefix %]t2.3" name="tile_[% map.x_tile %].[% map.y_tile - 1 %]" src="[% map.tiles.1 %]" style="top:0px; left:256px;"> <br> - <[% map.img_type %] + <[% map.img_type | safe %] alt="SW map tile" id="[% nsm_prefix %]t3.2" name="tile_[% map.x_tile - 1 %].[% map.y_tile %]" src="[% map.tiles.2 %]" style="top:256px; left:0;"> - <[% map.img_type %] + <[% map.img_type | safe %] alt="SE map tile" id="[% nsm_prefix %]t3.3" name="tile_[% map.x_tile %].[% map.y_tile %]" src="[% map.tiles.3 %]" diff --git a/templates/web/base/maps/noscript_map_base_wmx.html b/templates/web/base/maps/noscript_map_base_wmx.html new file mode 100644 index 000000000..45de9926e --- /dev/null +++ b/templates/web/base/maps/noscript_map_base_wmx.html @@ -0,0 +1,18 @@ +<div class="noscript"> + <div id="[% nsm_prefix %]drag"> + [%- FOR row IN map.tiles -%] + [%- FOR tile IN row -%] + [%- top_px = tile.row_offset * map.tile_size -%] + [%- left_px = tile.col_offset * map.tile_size %] + <[% map.img_type | safe %] + alt="[% tile.alt %]" + id="[% nsm_prefix %]t[% tile.dotted_id %]" + name="tile_[% tile.dotted_id %]" + src="[% tile.src %]" + style="width: [% map.tile_size %]px; top: [% top_px %]px; left: [% left_px %]px"> + [%- END -%] + [% END %] + </div> + <div id="[% nsm_prefix %]pins">[% FOR pin IN map.pins %][% INCLUDE 'maps/pin.html' %][% END %]</div> + [% INCLUDE 'maps/_compass.html' %] +</div> diff --git a/templates/web/base/maps/openlayers.html b/templates/web/base/maps/openlayers.html index 2f748cb19..f4c78767c 100644 --- a/templates/web/base/maps/openlayers.html +++ b/templates/web/base/maps/openlayers.html @@ -6,6 +6,9 @@ <input type="hidden" name="zoom" value="[% map.zoom %]"> <div id="js-map-data" +[%- IF c.config.STAGING_SITE %] + data-staging=1 +[%- END %] [%- UNLESS c.cobrand.call_hook('hide_areas_on_reports') %] data-area="[% map.area.join(',') %]" [%- END %] @@ -33,9 +36,13 @@ <div id="map_box" aria-hidden="true"> [% pre_map %] <div id="map"> - [% INCLUDE 'maps/noscript_map.html' js = 1 %] + [% IF noscript_map_template == 'maps/noscript_map_base_wmx.html' %] + [% INCLUDE 'maps/noscript_map_base_wmx.html' js = 1 %] + [% ELSE %] + [% INCLUDE 'maps/noscript_map.html' js = 1 %] + [% END %] </div> [% IF map.copyright %] - <div class="olControlAttribution" style="position: absolute;">[% map.copyright %]</div> + <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..."> diff --git a/templates/web/base/maps/wms.html b/templates/web/base/maps/wms.html new file mode 100644 index 000000000..93fcb95dd --- /dev/null +++ b/templates/web/base/maps/wms.html @@ -0,0 +1,4 @@ +[% map_html = BLOCK %] +[% INCLUDE maps/openlayers.html noscript_map_template = 'maps/noscript_map_base_wmx.html' %] +[% INCLUDE maps/wms_config.html %] +[% END %] diff --git a/templates/web/base/maps/wms_config.html b/templates/web/base/maps/wms_config.html new file mode 100644 index 000000000..f7fe3510c --- /dev/null +++ b/templates/web/base/maps/wms_config.html @@ -0,0 +1,13 @@ +<script nonce="[% csp_nonce %]"> + var fixmystreet = window.fixmystreet || {}; + fixmystreet.wms_config = { + 'map_projection': '[% map.map_projection %]', + 'tile_urls': [% map.tile_urls | safe %], + 'tile_size': [% map.tile_size %], + 'layer_names': [% map.layer_names | safe %], + 'wms_version': '[% map.wms_version %]', + 'format': '[% map.format %]', + 'scales': [% map.scales | safe %], + 'requestEncoding': "REST" + }; +</script> diff --git a/templates/web/base/maps/wmts.html b/templates/web/base/maps/wmts.html new file mode 100644 index 000000000..25c9065a3 --- /dev/null +++ b/templates/web/base/maps/wmts.html @@ -0,0 +1,4 @@ +[% map_html = BLOCK %] +[% INCLUDE maps/openlayers.html noscript_map_template = 'maps/noscript_map_base_wmx.html' %] +[% INCLUDE maps/wmts_config.html %] +[% END %] diff --git a/templates/web/base/maps/wmts_config.html b/templates/web/base/maps/wmts_config.html index 0b80a055b..680de57e3 100644 --- a/templates/web/base/maps/wmts_config.html +++ b/templates/web/base/maps/wmts_config.html @@ -3,12 +3,12 @@ fixmystreet.wmts_config = { 'map_projection': '[% map.map_projection %]', 'tile_dpi': [% map.tile_dpi %], - 'tile_urls': [% map.tile_urls %], + 'tile_urls': [% map.tile_urls | safe %], 'tile_suffix': '[% map.tile_suffix %]', - 'layer_names': [% map.layer_names %], + 'layer_names': [% map.layer_names | safe %], 'layer_style': '[% map.layer_style %]', 'matrix_set': '[% map.matrix_set %]', - 'scales': [% map.scales %], + 'scales': [% map.scales | safe %], 'origin_x': [% map.origin_x %], 'origin_y': [% map.origin_y %] }; diff --git a/templates/web/base/my/my.html b/templates/web/base/my/my.html index 64ddb768e..04c5b6941 100644 --- a/templates/web/base/my/my.html +++ b/templates/web/base/my/my.html @@ -6,7 +6,7 @@ %] [% IF problems.size %] - [% map_html %] + [% map_html | safe %] </div> <div id="map_sidebar"> <div id="side"> @@ -34,7 +34,7 @@ li .my-account-buttons a { <ul> <li>[% loc('Name:') %] [% c.user.name %] <li>[% loc('Email:') %] [% c.user.email OR '-' %] - <p class="my-account-buttons"> + <p class="my-account-buttons my-account-buttons--email"> [% IF NOT c.user.email %] <a href="/auth/change_email">[% loc('Add') %]</a> [% ELSIF c.user.email_verified %] @@ -60,13 +60,17 @@ li .my-account-buttons a { </ul> <p class="my-account-buttons"> - <a href="/auth/change_password"> - [%~ IF c.user.password ~%] - [% loc('Change password') %] - [%~ ELSE ~%] - [% loc('Set password') %] - [%~ END ~%] + [% IF c.session.oauth.change_password_uri %] + <a class="change-password" href="[% c.session.oauth.change_password_uri | html %]">[% loc('Change password') %]</a> + [% ELSE %] + <a class="change-password" href="/auth/change_password"> + [%~ IF c.user.password ~%] + [% loc('Change password') %] + [%~ ELSE ~%] + [% loc('Set password') %] + [%~ END ~%] </a> + [% END %] [% IF c.user AND (c.user.from_body OR c.user.is_superuser) %] <a href="/auth/generate_token">[% loc('Security') %]</a> [% END %] diff --git a/templates/web/base/my/planned.html b/templates/web/base/my/planned.html index 366a554d9..d5fcc48ae 100644 --- a/templates/web/base/my/planned.html +++ b/templates/web/base/my/planned.html @@ -6,7 +6,7 @@ %] [% IF problems.size %] - [% map_html %] + [% map_html | safe %] </div> <div id="map_sidebar"> <div id="side"> diff --git a/templates/web/base/navigation/_all_reports.html b/templates/web/base/navigation/_all_reports.html new file mode 100644 index 000000000..3f2aa6bbc --- /dev/null +++ b/templates/web/base/navigation/_all_reports.html @@ -0,0 +1,13 @@ +[%~ + IF c.user_exists AND c.user.from_body AND ( c.user.categories.size OR c.user.area_ids.size ); + reports_uri = '/my/inspector_redirect'; + ELSE; + reports_uri = '/reports'; + IF c.cobrand.council_area; + body_name = c.cobrand.council_area | uri; + reports_uri = "${reports_uri}/${body_name}"; + END; + END; + + INCLUDE navitem uri=reports_uri label=loc('All reports'); +~%] diff --git a/templates/web/base/navigation/_report.html b/templates/web/base/navigation/_report.html new file mode 100644 index 000000000..c00c29585 --- /dev/null +++ b/templates/web/base/navigation/_report.html @@ -0,0 +1,9 @@ +[%~ IF problem AND NOT problem.non_public ~%] + [%~ INCLUDE navitem uri='/report/new?longitude=' _ problem.longitude _ '&latitude=' _ problem.latitude label=loc('Report another problem here') attrs='class="report-a-problem-btn"' ~%] +[%~ ELSIF latitude AND longitude ~%] + [%~ INCLUDE navitem uri='/report/new?longitude=' _ longitude _ '&latitude=' _ latitude label=loc('Report a problem here') attrs='class="report-a-problem-btn"' ~%] +[%~ ELSIF homepage_template ~%] + [%~ INCLUDE navitem uri='/report' label=loc('Report a problem') attrs='class="report-a-problem-btn"' ~%] +[%~ ELSE ~%] + [%~ INCLUDE navitem uri='/' label=loc('Report a problem') attrs='class="report-a-problem-btn"' ~%] +[%~ END ~%] diff --git a/templates/web/base/offline/appcache.html b/templates/web/base/offline/fallback.html index ed48b7a00..b8e1ee9b9 100644 --- a/templates/web/base/offline/appcache.html +++ b/templates/web/base/offline/fallback.html @@ -1,11 +1,9 @@ [% SET bodyclass = "fullwidthpage offlinepage" ~%] -[% INCLUDE 'header.html' appcache = 1 %] +[% INCLUDE 'header.html' %] -<h1>[% loc('Internet glitch') %]</h1> +<h1>[% loc('Offline') %]</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> +<p>[% loc('Sorry, we don’t have a good enough connection to fetch that page.') %]</p> <ul class="item-list item-list--reports" id="offline_list"></ul> diff --git a/templates/web/base/offline/manifest.html b/templates/web/base/offline/manifest.html deleted file mode 100644 index 93d26cb94..000000000 --- a/templates/web/base/offline/manifest.html +++ /dev/null @@ -1,16 +0,0 @@ -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/offline/service_worker.html b/templates/web/base/offline/service_worker.html new file mode 100644 index 000000000..3c480f9b1 --- /dev/null +++ b/templates/web/base/offline/service_worker.html @@ -0,0 +1,104 @@ +[% +SET bodyclass = "offlinepage"; # For selection of scripts +PROCESS 'common_scripts.html'; +SET offline_html = version('../templates/web/base/offline/fallback.html', '/offline/fallback'); +SET scripts_seen = {}; + +~%] + +importScripts('[% version('/vendor/idb-keyval-iife.min.js') %]'); + +const requiredOffline = [ + "[% version('/cobrands/' _ c.cobrand.asset_moniker _ '/base.css') %]", + "[% version('/cobrands/' _ c.cobrand.asset_moniker _ '/layout.css') %]", + "[% version('/vendor/OpenLayers/theme/default/style.css') %]", + "[% version('/vendor/fancybox/jquery.fancybox-1.3.4.css') %]", + [% + FOR script IN scripts; + NEXT IF scripts_seen.${script}; + scripts_seen.${script} = 1; + ~%] + "[%- script %]", + [% END %] + "[% offline_html %]" +]; + +const staticCache = 'static'; +// const pageCache = 'pages'; + +addEventListener('install', function(evt) { + evt.waitUntil(precache()); +}); + +async function precache() { + const cache = await caches.open(staticCache); + return cache.addAll(requiredOffline); +} + +addEventListener('fetch', fetchEvent => { + const request = fetchEvent.request; + const url = new URL(request.url); + + if (url.origin !== location.origin) { + return; + } + + // Handle inspection form submission if offline... + if (request.method === 'POST' && RegExp('/report/\\d+$').test(url)) { + fetchEvent.respondWith(async function() { + const fetchPromise = fetch(request.clone()); + try { + return await fetchPromise; + } + 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 data = await idbKeyval.get('offlineData') || { cachedReports: {}, forms: [] }; + var forms = data.forms; + if (!forms.length || formData != forms[forms.length - 1][1]) { + forms.push([request.url, formData]); + } + return idbKeyval.set('offlineData', data); + }()); + + return Response.redirect('/my/planned?saved=1'); + }; + }()); + } + + if (request.method !== "GET") { + return; + } + + fetchEvent.respondWith(async function() { + if (request.mode === 'navigate') { + const fetchPromise = fetch(request); + +// For now, only save pages manually for inspectors +// fetchEvent.waitUntil(async function() { +// const responseCopy = (await fetchPromise).clone(); +// const cache = await caches.open(pageCache); +// await responseCopy.ok ? cache.put(request, responseCopy) : cache.delete(request); +// }()); + + try { + return await fetchPromise; + } + catch { + let cached = await caches.match(request) || await caches.match("[% offline_html %]"); + return cached || offlineResponse(); + } + } else { + const responseFromCache = await caches.match(request); + return responseFromCache || fetch(request); + } + }()); +}); + +var offlineResponse = () => + new Response('Service Unavailable', { status: 503, statusText: 'Service Unavailable', headers: { 'Content-Type': 'text/html' }}); diff --git a/templates/web/base/pagination.html b/templates/web/base/pagination.html index 3b7bdc0b2..a52632a25 100644 --- a/templates/web/base/pagination.html +++ b/templates/web/base/pagination.html @@ -1,5 +1,5 @@ -[% IF pager.total_entries > 1 %] - <p class="pagination" data-page="[% pager.current_page %]"> +[% IF pager AND pager.total_entries > 1 %] + <p class="pagination" data-page="[% pager.current_page | html %]"> [% IF pager.previous_page %] <a class="prev" href="[% c.uri_with({ $param => pager.previous_page, ajax => undefined }) %][% '#' _ hash IF hash %]">[% loc('Previous') %]</a> [% END %] diff --git a/templates/web/base/questionnaire/index.html b/templates/web/base/questionnaire/index.html index 4b6ce82f9..36123013f 100644 --- a/templates/web/base/questionnaire/index.html +++ b/templates/web/base/questionnaire/index.html @@ -5,7 +5,7 @@ INCLUDE 'header.html', title = loc('Questionnaire'); %] -[% map_html %] +[% map_html | safe %] </div> @@ -23,7 +23,9 @@ [% IF errors %] <ul class="error questionnaire-errors"> -<li>[% errors.join("</li>\n<li>") %]</li> + [% FOR error IN errors %] + <li>[% error %]</li> + [% END %] </ul> [% END %] diff --git a/templates/web/base/report/_inspect.html b/templates/web/base/report/_inspect.html index fa79d9912..771942b16 100644 --- a/templates/web/base/report/_inspect.html +++ b/templates/web/base/report/_inspect.html @@ -1,6 +1,3 @@ -[% extra_js = [ - version('/js/duplicates.js'), -] -%] [% permissions = c.user.permissions(problem) %] [% second_column = BLOCK -%] <div id="side-inspect"> @@ -11,60 +8,7 @@ <form name="report_inspect_form" id="report_inspect_form" method="post" action="[% c.uri_for( '/report', problem.id ) %]" class="validate"> - <div class="inspect-section"> - <p style="float: right"> - <label for="non_public">[% loc('Private') %]</label> - <input type="checkbox" id="non_public" name="non_public" value="1"[% ' checked' IF problem.non_public %]> - </p> - <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) %] - (<a href="[% c.uri_for_action( "admin/report_edit", problem.id ) %]">[% loc('admin') %]</a>) - [% END %] - </p> - [% IF permissions.report_inspect AND problem.user.phone %] - <p> - <strong>[% loc('Phone Reporter:') %]</strong> - <a href="tel:[% problem.user.phone | html %]">[% problem.user.phone_display | html %]</a> - </p> - [% END %] - <p> - [% SET local_coords = problem.local_coords; %] - [% 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> - [% IF problem.nearest_address() %] - <p> - <strong>[% loc('Nearest calculated address:') %]</strong> - [% problem.nearest_address() %] - </p> - [% END %] - <p> - <a target="_blank" href="https://www.google.com/maps/dir/?api=1&destination=[% problem.latitude %],[% problem.longitude %]" class="btn btn--block btn--navigate">[% loc('Navigate to this problem') %]</a> - </p> - <p> - <a href="#" class="btn btn--block btn--geolocate">[% loc('Set to my current location') %]</a> - </p> - [% IF permissions.report_reject %] - [% TRY %] - [% INCLUDE 'report/_inspect_reject_button.html' %] - [% CATCH file %] - <p> - <a href="[% c.uri_for( '/contact', { id => problem.id, reject => 1 } ) %]" class="btn btn--block">[% loc('Reject report') %]</a> - </p> - [% END %] - [% END %] - </div> + [% INCLUDE 'report/inspect/information.html' %] [% IF permissions.report_edit_category OR permissions.report_inspect %] <div class="inspect-section"> @@ -80,43 +24,16 @@ <p data-category="[% cat_name | html %]" [%~ IF cat_name != problem.category %] class="hidden"[% END %] data-priorities='[% priorities_by_category.$cat_name | html %]' - data-defect-types='[% category_defect_types.$cat_name | html %]' data-templates='[% templates_by_category.$cat_name | html %]'> - [% IF cat_name == problem.category %] - [% INCLUDE 'report/new/category_extras_fields.html' metas=category_extras.$cat_name hide_notices=1 show_hidden=1 %] - [% ELSE %] - [% INCLUDE 'report/new/category_extras_fields.html' report_meta='' metas=category_extras.$cat_name hide_notices=1 show_hidden=1 %] - [% END %] + [% INCLUDE 'report/new/category_extras_fields.html' metas=category_extras.$cat_name hide_notices=1 show_hidden=1 %] </p> [% END %] [% IF permissions.report_inspect %] - [% PROCESS 'defect_type/format.html' %] - <p> - <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> - [% IF permissions.report_instruct AND NOT problem.get_extra_metadata('inspected') %] - <div id="js-inspect-action-scheduled" class="[% "hidden" UNLESS problem.state == 'action scheduled' %]"> - <p>[% loc('Do you want to automatically raise a defect?') %]</p> - <p class="segmented-control segmented-control--radio"> - <input type="radio" name="raise_defect" id="raise_defect_yes" value="1"> - <label class="btn" for="raise_defect_yes">[% loc('Yes') %]</label> - <input type="radio" name="raise_defect" id="raise_defect_no" value="0"> - <label class="btn" for="raise_defect_no">[% loc('No') %]</label> - </p> - </div> - [% 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> @@ -143,65 +60,14 @@ [% IF permissions.report_edit_priority OR permissions.report_inspect %] <div class="inspect-section"> - <p> - <label for="problem_priority">[% loc('Priority') %]</label> - <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> - [% 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> - <p> - <label for="detailed_information">[% loc('Extra details') %]</label> - [% IF max_detailed_info_length %] - <span id="detailed_information_length"> - [% tprintf(loc('%d characters maximum'), max_detailed_info_length) %] - </span> - [% END %] - <textarea rows="2" name="detailed_information" id="detailed_information" class="form-control" - [% IF max_detailed_info_length %]data-max-length="[% max_detailed_info_length %]"[% END %]>[% problem.get_extra_metadata('detailed_information') | html %]</textarea> - </p> - [% END %] - + [% INCLUDE 'report/inspect/extra_details.html' %] </div> [% END %] <div class="inspect-section"> [% IF permissions.report_inspect %] - <p> - <label class="label-containing-checkbox"> - <input type="checkbox" name="include_update" value="1" class="js-toggle-public-update" checked> - [% loc('Save with a public update') %] - </label> - </p> - <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> - [% END %] - - [% IF problem.get_extra_metadata('inspected') %] - [% IF problem.whensent %] - <p>[% loc("<strong>Note:</strong> This report has been sent onwards for action. Any changes made won't be passed on.") %]</p> - [% ELSE %] - <p>[% loc("<strong>Note:</strong> This report hasn't yet been sent onwards for action. Any changes made may not be passed on.") %]</p> - [% END %] - [% TRY %][% INCLUDE 'report/_inspect_extra_info.html' %][% CATCH file %][% END %] + [% INCLUDE 'report/inspect/public_update.html' %] [% END %] <p> diff --git a/templates/web/base/report/_item.html b/templates/web/base/report/_item.html index 200c690a6..4d74b3be9 100644 --- a/templates/web/base/report/_item.html +++ b/templates/web/base/report/_item.html @@ -22,15 +22,23 @@ [% IF shortlist %] [% item_extra_class = "item-list__item--indented item-list__item--act-and-sort" %] [% item_action = BLOCK %] - [% item_action %] + [% item_action | safe %] <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 %] +[%~ TRY ~%] + [% PROCESS 'report/_item_extra_class.html' %] +[%~ CATCH file ~%] +[%~ END ~%] + <li class="item-list__item item-list--reports__item [% item_extra_class %]" data-report-id="[% problem.id | html %]" data-lastupdate="[% problem.lastupdate %]" id="report-[% problem.id | html %]"> <a href="[% c.cobrand.relative_url_for_report( problem ) %][% problem.url %]"> + [% TRY ~%] + [% 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=""> [% END %] @@ -39,6 +47,8 @@ [% CATCH file %] <h3 class="item-list__heading">[% problem.title | html %]</h3> [% END %] + [% END ~%] + [% IF c.user.has_permission_to('report_inspect', problem.bodies_str_ids) %] <div class="item-list__description">[% problem.detail | html %]</div> [% END %] @@ -98,12 +108,12 @@ [%# We don't want to output shortlist on report page (in duplicate list) %] [% ELSIF page == 'around' ~%] [%# The around page list is already contained within the new report form %] - [% item_action.replace('("shortlist-[^"]*)', '$1-' _ problem.id) %] + [% item_action.replace('("shortlist-[^"]*)', '$1-' _ problem.id) | safe %] [% ELSE ~%] <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 %] + [% item_action | safe %] </form> [% END ~%] [% END %] diff --git a/templates/web/base/report/_item_expandable.html b/templates/web/base/report/_item_expandable.html index 7723ed54a..fad935407 100644 --- a/templates/web/base/report/_item_expandable.html +++ b/templates/web/base/report/_item_expandable.html @@ -44,10 +44,15 @@ [% INCLUDE 'report/_main_sent_info.html' %] [% INCLUDE 'report/photo.html' object=problem %] [% full_detail %] + [% IF inline_maps %] + <div class="duplicate-map"> + <img src="/report/[% problem.id %]/map?inline_duplicate=1" alt="" /> + </div> + [% END %] </div> <div class="item-list__item--expandable__actions"> - <button class="btn btn--small js-toggle-expansion" data-more="[% loc('Read more') %]" data-less="[% loc('Read less') %]">[% loc('Read more') %]</button> + <button type="button" class="btn btn--small js-toggle-expansion" data-more="[% loc('Read more') %]" data-less="[% loc('Read less') %]">[% loc('Read more') %]</button> </div> </li> diff --git a/templates/web/base/report/_main.html b/templates/web/base/report/_main.html index e4612cc4a..9a498c619 100644 --- a/templates/web/base/report/_main.html +++ b/templates/web/base/report/_main.html @@ -48,7 +48,7 @@ can_moderate_title = c.user.can_moderate_title(problem, can_moderate) [% END %] [% FOR error IN moderate_errors %] - <p class="form-error js-moderation-error">[% error %]</p> + <p class="form-error js-moderation-error">[% error | safe %]</p> [% END %] [% IF can_moderate_title %] diff --git a/templates/web/base/report/_updates_disallowed_message.html b/templates/web/base/report/_updates_disallowed_message.html new file mode 100644 index 000000000..de2e36382 --- /dev/null +++ b/templates/web/base/report/_updates_disallowed_message.html @@ -0,0 +1,5 @@ +<p>[% loc('This report is now closed to updates.') %] + [% tprintf(loc('You can <a href="%s">make a new report in the same location</a>.'), + c.uri_for( '/report/new', { longitude = longitude, latitude = latitude } ) + ) %] +</p> diff --git a/templates/web/base/report/display.html b/templates/web/base/report/display.html index ade6b808e..f08df931d 100644 --- a/templates/web/base/report/display.html +++ b/templates/web/base/report/display.html @@ -3,14 +3,14 @@ PROCESS "report/photo-js.html"; PROCESS "maps/${map.type}.html"; - problem_title = problem.title_safe _ ' - ' _ loc('Viewing a problem'); + problem_title = tprintf('%s - %s', problem.title_safe, loc('Viewing a problem')); INCLUDE 'header.html' title = problem_title rss = [ tprintf(loc('Updates to this problem, %s', "%s is the site name"), site_name), "/rss/$problem.id" ] robots = 'index, nofollow'; %] -[% map_html %] +[% map_html | safe %] </div> <div id="map_sidebar"> @@ -66,7 +66,7 @@ </div> - [% second_column %] + [% second_column | safe %] [% IF two_column_sidebar %] </div> diff --git a/templates/web/base/report/display_tools.html b/templates/web/base/report/display_tools.html index 4ba8c8b2c..e16ffcb2c 100644 --- a/templates/web/base/report/display_tools.html +++ b/templates/web/base/report/display_tools.html @@ -1,5 +1,6 @@ <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 ) %] <li><form method="post" action="/report/[% problem.id %]/delete" id="remove-from-site-form"> <input type="hidden" name="token" value="[% csrf_token %]"> @@ -10,12 +11,13 @@ c.cobrand.moniker == 'fixmystreet' ? 'Unsuitable?' : loc('Report abuse') %]</a></li> [% END %] - [% IF NOT problem.extra.closed_updates AND c.cobrand.moniker != 'zurich' %] - <li><a rel="nofollow" id="key-tool-report-updates" class="feed js-feed" href="[% c.uri_for( '/alert/subscribe', { id => problem.id } ) %]">[% loc('Get updates' ) %]</a></li> + [% IF c.cobrand.moniker != 'zurich' %] + <li><a rel="nofollow" id="key-tool-report-updates" class="feed" href="[% c.uri_for( '/alert/subscribe', { id => problem.id } ) %]">[% loc('Get updates' ) %]</a></li> [% END %] [% IF c.cobrand.moniker == 'fixmystreet' %] <li><a rel="nofollow" id="key-tool-report-share" class="share" href="#report-share">[% loc('Share') %]</a></li> [% END %] + [% END %] [% IF c.cobrand.moniker == 'zurich' %] <li><a class="chevron" id="key-tool-problems-nearby" href="[% c.uri_for( '/around', { lat => latitude, lon => longitude } ) %]">[% loc( 'Problems on the map' ) %]</a></li> [% ELSE %] @@ -44,7 +46,15 @@ [% loc('Receive email when updates are left on this problem.' ) %]</p> <fieldset> [% IF c.user_exists %] - <input class="green-btn" type="submit" name="alert" value="[% loc('Subscribe') %]"> + [% IF c.user.has_permission_to("contribute_as_another_user", problem.bodies_str_ids) %] + <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"> + <input class="green-btn" type="submit" name="alert" value="[% loc('Subscribe') %]"> + </div> + [% ELSE %] + <input class="green-btn" type="submit" name="alert" value="[% loc('Subscribe') %]"> + [% END %] [% ELSE %] <label for="alert_rznvy">[% loc('Your email') %]</label> <div class="form-txt-submit-box"> diff --git a/templates/web/base/report/form/user.html b/templates/web/base/report/form/user.html index 6381d2928..1c941a302 100644 --- a/templates/web/base/report/form/user.html +++ b/templates/web/base/report/form/user.html @@ -5,21 +5,41 @@ [% loc('Next:') %] [% loc('Tell us about you') %] </h2> [% IF c.user_exists OR NOT c.cobrand.social_auth_enabled %] - <button class="btn btn--block hidden-nojs js-new-report-user-show">[% loc('Continue') %]</button> + <button type="button" class="btn btn--block hidden-nojs js-new-report-user-show">[% loc('Continue') %]</button> [% ELSE %] [% IF c.config.FACEBOOK_APP_ID %] - <button name="facebook_sign_in" id="facebook_sign_in" value="facebook_sign_in" class="btn btn--block btn--social btn--facebook"> + <button name="social_sign_in" id="facebook_sign_in" value="facebook" class="btn btn--block btn--social btn--facebook"> <img alt="" src="/i/facebook-icon-32.png" width="17" height="32"> [% loc('Log in with Facebook') %] </button> [% END %] + [% IF c.cobrand.feature('oidc_login') %] + <button name="social_sign_in" id="oidc_sign_in" value="oidc" class="btn btn--block btn--social btn--oidc"> + [% tprintf(loc('Login with %s'), c.cobrand.feature('oidc_login').display_name) %] + </button> + [% END %] [% IF c.config.TWITTER_KEY %] - <button name="twitter_sign_in" id="twitter_sign_in" value="twitter_sign_in" class="btn btn--block btn--social btn--twitter"> + <button name="social_sign_in" id="twitter_sign_in" value="twitter" class="btn btn--block btn--social btn--twitter"> <img alt="" src="/i/twitter-icon-32.png" width="17" height="32"> [% loc('Log in with Twitter') %] </button> [% END %] - <button class="btn btn--block hidden-nojs js-new-report-user-show">[% loc('Log in with email') %]</button> + <button type="button" class="btn btn--block hidden-nojs js-new-report-user-show">[% loc('Log in with email') %]</button> [% END %] + <div class="js-show-if-anonymous + [%~ ' hidden-js' UNLESS type == 'report' AND c.cobrand.allow_anonymous_reports == 'button' %]"> + <small id="or">[% loc('or') %]</small> + <button name="report_anonymously" value="yes" class="btn btn--block js-new-report-submit">[% loc('Report anonymously') %]</button> + <small>[% loc('No personal details will be stored, and you will not receive updates about this report.') %]</small> + </div> </div> + +[% IF (c.user_exists OR NOT c.cobrand.social_auth_enabled) AND type == 'report' AND c.cobrand.allow_anonymous_reports == 'button' %] +<div class="form-section-preview form-section-preview--next hidden-js"> + <button name="report_anonymously" value="yes" class="btn btn--block">[% loc('Report anonymously') %]</button> + <small>[% loc('No personal details will be stored, and you will not receive updates about this report.') %]</small> + <small id="or">[% loc('or') %]</small> +</div> +[% END %] + <!-- /report/form/user.html --> 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 4ae3db868..33526cc46 100644 --- a/templates/web/base/report/form/user_loggedout_by_email.html +++ b/templates/web/base/report/form/user_loggedout_by_email.html @@ -25,11 +25,7 @@ </div> [% END %] - [% IF c.cobrand.social_auth_enabled AND NOT email_required %] - [% PROCESS 'report/form/user_loggedout_email.html' name='username_register' required=0 %] - [% ELSE %] - [% PROCESS 'report/form/user_loggedout_email.html' name='username_register' required=1 %] - [% END %] + [% PROCESS 'report/form/user_loggedout_email.html' name='username_register' %] [% IF type != 'update' AND c.config.SMS_AUTHENTICATION %] [% UNLESS c.cobrand.call_hook('disable_phone_number_entry') %] diff --git a/templates/web/base/report/form/user_loggedout_by_email_heading.html b/templates/web/base/report/form/user_loggedout_by_email_heading.html index 6aa90c2fd..221b75101 100644 --- a/templates/web/base/report/form/user_loggedout_by_email_heading.html +++ b/templates/web/base/report/form/user_loggedout_by_email_heading.html @@ -1,13 +1,13 @@ [% IF c.config.SMS_AUTHENTICATION %] [% IF type == 'update' %] - <h5 class="hidden-js">[% loc('<strong>No</strong> Let me confirm my update by email/text') %]</h5> + <h3 class="hidden-js">[% loc('<strong>No</strong> Let me confirm my update by email/text') %]</h3> [% ELSE %] - <h5 class="hidden-js">[% loc('<strong>No</strong> Let me confirm my report by email/text') %]</h5> + <h3 class="hidden-js">[% loc('<strong>No</strong> Let me confirm my report by email/text') %]</h3> [% END %] [% ELSE %] [% IF type == 'update' %] - <h5 class="hidden-js">[% loc('<strong>No</strong> Let me confirm my update by email') %]</h5> + <h3 class="hidden-js">[% loc('<strong>No</strong> Let me confirm my update by email') %]</h3> [% ELSE %] - <h5 class="hidden-js">[% loc('<strong>No</strong> Let me confirm my report by email') %]</h5> + <h3 class="hidden-js">[% loc('<strong>No</strong> Let me confirm my report by email') %]</h3> [% END %] [% END %] diff --git a/templates/web/base/report/form/user_loggedout_email.html b/templates/web/base/report/form/user_loggedout_email.html index c32691eb4..9f631987b 100644 --- a/templates/web/base/report/form/user_loggedout_email.html +++ b/templates/web/base/report/form/user_loggedout_email.html @@ -15,6 +15,5 @@ [% END %] <input type="[% username_type %]" name="username" id="form_[% name %]" value="[% username_value | html %]" - [% IF required %]required[% END %] class="form-control required"> <!-- /user_loggedout_email.html --> diff --git a/templates/web/base/report/form/user_loggedout_password.html b/templates/web/base/report/form/user_loggedout_password.html index 02cfc9525..4b8611fcb 100644 --- a/templates/web/base/report/form/user_loggedout_password.html +++ b/templates/web/base/report/form/user_loggedout_password.html @@ -1,18 +1,14 @@ <!-- user_loggedout_password.html --> <div id="form_sign_in_yes" class="form-box hidden-js js-new-report-sign-in-shown"> - <h5 class="hidden-js">[% loc('<strong>Yes</strong> I have a password') %]</h5> + <h3 class="hidden-js">[% loc('<strong>Yes</strong> I have a password') %]</h3> <p class="hidden-nojs"> [% loc('No account?') %] <a class="js-new-report-hide-sign-in" href="#">[% loc('Fill in your details manually.') %]</a> </p> - [% IF c.cobrand.social_auth_enabled %] - [% PROCESS 'report/form/user_loggedout_email.html' name='username_sign_in' required=0 %] - [% ELSE %] - [% PROCESS 'report/form/user_loggedout_email.html' name='username_sign_in' required=1 %] - [% END %] + [% PROCESS 'report/form/user_loggedout_email.html' name='username_sign_in' %] <label for="password_sign_in">[% loc('Your password') %]</label> [% IF field_errors.password %] diff --git a/templates/web/base/report/inspect/_extra_details_field.html b/templates/web/base/report/inspect/_extra_details_field.html new file mode 100644 index 000000000..6a0dfaeec --- /dev/null +++ b/templates/web/base/report/inspect/_extra_details_field.html @@ -0,0 +1,10 @@ +<p> + <label for="detailed_information">[% loc('Extra details') %]</label> + [% IF max_detailed_info_length %] + <span id="detailed_information_length"> + [% tprintf(loc('%d characters maximum'), max_detailed_info_length) %] + </span> + [% END %] + <textarea rows="2" name="detailed_information" id="detailed_information" class="form-control" + [% IF max_detailed_info_length %]data-max-length="[% max_detailed_info_length %]"[% END %]>[% problem.get_extra_metadata('detailed_information') | html %]</textarea> +</p> diff --git a/templates/web/base/report/inspect/extra_details.html b/templates/web/base/report/inspect/extra_details.html new file mode 100644 index 000000000..7777e9a78 --- /dev/null +++ b/templates/web/base/report/inspect/extra_details.html @@ -0,0 +1,23 @@ +<p> + <label for="problem_priority">[% loc('Priority') %]</label> + <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> + [% 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 new file mode 100644 index 000000000..b81b37543 --- /dev/null +++ b/templates/web/base/report/inspect/information.html @@ -0,0 +1,56 @@ + <div class="inspect-section"> + <p style="float: right"> + <label for="non_public">[% loc('Private') %]</label> + <input type="checkbox" id="non_public" name="non_public" value="1"[% ' checked' IF problem.non_public %]> + </p> + <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) %] + (<a href="[% c.uri_for_action( 'admin/reports/edit', [ problem.id ] ) %]">[% loc('admin') %]</a>) + [% END %] + </p> + [% IF permissions.report_inspect AND problem.user.phone %] + <p> + <strong>[% loc('Phone Reporter:') %]</strong> + <a href="tel:[% problem.user.phone | html %]">[% problem.user.phone_display | html %]</a> + </p> + [% END %] + <p> + [% SET local_coords = problem.local_coords; %] + [% 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> + [% IF problem.nearest_address() %] + <p> + <strong>[% loc('Nearest calculated address:') %]</strong> + [% problem.nearest_address() %] + </p> + [% END %] + <p> + <a target="_blank" href="https://www.google.com/maps/dir/?api=1&destination=[% problem.latitude %],[% problem.longitude %]" class="btn btn--block btn--navigate">[% loc('Navigate to this problem') %]</a> + </p> + [% UNLESS no_relocate %] + <p> + <a href="#" class="btn btn--block btn--geolocate">[% loc('Set to my current location') %]</a> + </p> + [% END %] + [% IF permissions.report_reject %] + [% TRY %] + [% INCLUDE 'report/_inspect_reject_button.html' %] + [% CATCH file %] + <p> + <a href="[% c.uri_for( '/contact', { id => problem.id, reject => 1 } ) %]" class="btn btn--block">[% loc('Reject report') %]</a> + </p> + [% END %] + [% END %] + </div> diff --git a/templates/web/base/report/inspect/public_update.html b/templates/web/base/report/inspect/public_update.html new file mode 100644 index 000000000..be07d7b89 --- /dev/null +++ b/templates/web/base/report/inspect/public_update.html @@ -0,0 +1,14 @@ +[% IF NOT public_update_defaulted.defined %] + [% public_update_defaulted = 1 %] +[% END %] + <p> + <label class="label-containing-checkbox"> + <input type="checkbox" name="include_update" value="1" class="js-toggle-public-update"[% ' checked' IF public_update_defaulted %]> + [% loc('Save with a public update') %] + </label> + </p> + <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> diff --git a/templates/web/base/report/new/_category_select.html b/templates/web/base/report/new/_category_select.html new file mode 100644 index 000000000..d5aa9842b --- /dev/null +++ b/templates/web/base/report/new/_category_select.html @@ -0,0 +1,13 @@ +[%~ IF category_groups.size ~%] + [%~ FOREACH group IN category_groups ~%] + [% IF group.name %]<optgroup label="[% group.name %]">[% END %] + [%~ FOREACH cat IN group.categories ~%] + [% INCLUDE category_option %] + [%~ END ~%] + [% IF group.name %]</optgroup>[% END %] + [%~ END =%] +[%~ ELSE ~%] + [%~ FOREACH cat IN category_options ~%] + [% INCLUDE category_option %] + [%~ END =%] +[%~ END ~%] diff --git a/templates/web/base/report/new/category.html b/templates/web/base/report/new/category.html index ec53263ca..b5bfd0251 100644 --- a/templates/web/base/report/new/category.html +++ b/templates/web/base/report/new/category.html @@ -1,3 +1,4 @@ +[% TRY %][% PROCESS 'report/new/_form_labels.html' %][% CATCH file %][% END ~%] [% # If only one option, pre-select that as if it were already selected. This # carries through to the category_extras template because this template is @@ -8,10 +9,10 @@ END ~%] [% IF category_options.size OR category_groups.size ~%] [%~ BLOCK category_option ~%] - [% cat_op_lc = cat_op.category | lower =%] - <option value='[% cat_op.category | html %]'[% ' selected' IF report.category == cat_op.category || category_lc == cat_op_lc ~%] - >[% IF loop.first %][% cat_op.category_display %][% ELSE %][% cat_op.category_display | html %][% END %] - [%~ IF cat_op.get_extra_metadata('help_text') %] ([% cat_op.get_extra_metadata('help_text') %])[% END ~%] + [% cat_lc = cat.category | lower =%] + <option value='[% cat.category | html %]'[% ' selected' IF report.category == cat.category || category_lc == cat_lc ~%] + >[% 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> [%~ END ~%] @@ -19,27 +20,15 @@ END category_lc = category | lower; END; ~%] <label for='form_category' id="form_category_label"> - [%~ loc('Category') ~%] + [%~ form_category_label OR loc('Category') ~%] </label>[% =%] - <select class="validCategory form-control[% IF category_groups.size %] js-grouped-select[% END %]" name="category" id="form_category" + <select required class="validCategory form-control[% IF category_groups.size %] js-grouped-select[% END %]" name="category" id="form_category" [%~ IF c.user.from_body =%] [%~ prefill_report = ( c.cobrand.prefill_report_fields_for_inspector && inspector ) || c.user.has_body_permission_to('report_prefill') %] data-body="[% c.user.from_body.name %]" data-prefill="[% prefill_report %]" [%~ END ~%] - required> - [%~ IF category_groups.size ~%] - [%~ FOREACH group IN category_groups ~%] - [% IF group.name %]<optgroup label="[% group.name %]">[% END %] - [%~ FOREACH cat_op IN group.categories ~%] - [% INCLUDE category_option %] - [%~ END ~%] - [% IF group.name %]</optgroup>[% END %] - [%~ END =%] - [%~ ELSE ~%] - [%~ FOREACH cat_op IN category_options ~%] - [% INCLUDE category_option %] - [%~ END =%] - [%~ END ~%] + > + [%~ INCLUDE 'report/new/_category_select.html' ~%] </select> [%~ IF category_groups.size ~%] <label id="form_subcategory_label" class="hidden"> diff --git a/templates/web/base/report/new/category_extras.html b/templates/web/base/report/new/category_extras.html index c7bdad94d..9b4149119 100644 --- a/templates/web/base/report/new/category_extras.html +++ b/templates/web/base/report/new/category_extras.html @@ -1,5 +1,6 @@ -[% SET default_list = [] %][% FOR b IN bodies_to_list.values %][% default_list.push(b.name) %][% END %] +[% SET default_list = [] %][% FOR b IN bodies_to_list.values %][% default_list.push(b.cobrand_name) %][% END %] [% DEFAULT list_of_names = default_list %] +[% category = mark_safe(category) %] <div id="category_meta"> [%- IF unresponsive.$category %] @@ -9,14 +10,16 @@ [%- IF category_extras.$category.size %] [% UNLESS category_extras_hidden.$category %] - <div class="extra-category-questions"> - <h2 class="form-section-heading">[% category %]</h2> - <p class="form-section-description"> - [% tprintf( - loc('Help <strong>%s</strong> resolve your problem quicker, by providing some extra detail. This extra information will not be published online.'), - list_of_names.join( '</strong>' _ loc(' or ') _ '<strong>' ) - ); %] - </p> + <div class="extra-category-questions"> + [% UNLESS category_extras_notices.$category %] + <h2 class="visuallyhidden form-section-heading">[% loc('Extra details') %]</h2> + <p class="form-section-description"> + [% tprintf( + loc('Help <strong>%s</strong> resolve your problem quicker, by providing some extra detail. This extra information will not be published online.'), + mark_safe(list_of_names.join( '</strong>' _ loc(' or ') _ '<strong>' )) + ); %] + </p> + [% END %] [% INCLUDE 'report/new/category_extras_fields.html' metas=category_extras.$category %] </div> [% ELSE %] diff --git a/templates/web/base/report/new/category_extras_fields.html b/templates/web/base/report/new/category_extras_fields.html index dd5c3911d..2c728481c 100644 --- a/templates/web/base/report/new/category_extras_fields.html +++ b/templates/web/base/report/new/category_extras_fields.html @@ -1,6 +1,6 @@ [%- FOR meta IN metas %] [%- meta_name = meta.code -%] - [%- x_meta_name = 'x' _ meta.code # For report_meta and field_erros lookup, as TT hides codes starting "_" -%] + [%- x_meta_name = 'x' _ meta.code # For report_meta and field_errors lookup, as TT hides codes starting "_" -%] [% IF c.cobrand.category_extra_hidden(meta) AND NOT show_hidden %] @@ -8,7 +8,7 @@ [% ELSIF meta.variable != 'false' || NOT hide_notices %] - <label for="[% cat_prefix %]form_[% meta_name %]">[% meta.description %]</label> + <label for="[% cat_prefix %]form_[% meta_name %]">[% (meta.description OR meta.code) | safe %]</label> [% TRY %][% INCLUDE 'report/new/_category_extra_field_notice.html' %][% CATCH file %][% END %] [% IF field_errors.$x_meta_name %] <p class='form-error'>[% field_errors.$x_meta_name %]</p> diff --git a/templates/web/base/report/new/category_wrapper.html b/templates/web/base/report/new/category_wrapper.html index 33c6813f9..a5e0e3556 100644 --- a/templates/web/base/report/new/category_wrapper.html +++ b/templates/web/base/report/new/category_wrapper.html @@ -1,6 +1,6 @@ <div id="form_category_row"> [% IF js %] - <label for="form_category">[% loc('Category') %]</label> + <label for="form_category">[% form_category_label OR loc('Category') %]</label> <select class="validCategory form-control" name="category" id="form_category" [%~ IF c.user.from_body =%] [%~ prefill_report = c.cobrand.prefill_report_fields_for_inspector || c.user.has_body_permission_to('report_prefill') %] @@ -19,10 +19,16 @@ [% PROCESS "report/new/duplicate_suggestions.html" %] -<div id="js-post-category-messages" class="js-hide-if-invalid-category"> +[% IF disable_form_message %] +<div id="js-category-stopper" class="box-warning" role="alert" aria-live="assertive"> + [% disable_form_message | safe %] +</div> +[% ELSE %] +<div id="js-post-category-messages" class="js-hide-if-invalid-category_extras"> [%# This section includes 'Pick an asset' text, roadworks info, extra category questions %] [%- IF category_extras OR report_extra_fields %] [% PROCESS "report/new/category_extras.html" %] [%- END %] </div> +[% END %] diff --git a/templates/web/base/report/new/councils_text.html b/templates/web/base/report/new/councils_text.html index 5f4b113ca..9b3d6fce7 100644 --- a/templates/web/base/report/new/councils_text.html +++ b/templates/web/base/report/new/councils_text.html @@ -1,4 +1,5 @@ [% FILTER collapse %] +[% category = mark_safe(category) %] [% IF unresponsive.$category OR unresponsive.ALL OR bodies_to_list.size == 0 %] [% tprintf( loc('These will be published online for others to see, in accordance with our <a href="%s">privacy policy</a>.'), diff --git a/templates/web/base/report/new/councils_text_all.html b/templates/web/base/report/new/councils_text_all.html index d39288765..08e27e8b3 100644 --- a/templates/web/base/report/new/councils_text_all.html +++ b/templates/web/base/report/new/councils_text_all.html @@ -1,13 +1,23 @@ -[% SET default_list = [] %][% FOR b IN bodies_to_list.values %][% default_list.push(b.name) %][% END %] +[% SET default_list = [] %][% FOR b IN bodies_to_list.values %][% default_list.push(b.cobrand_name) %][% END %] [% DEFAULT list_of_names = default_list %] +[% category = mark_safe(category) %] <p> -[% +[% UNLESS non_public_categories.$category; + tprintf( loc('These will be sent to <strong>%s</strong> and also published online for others to see, in accordance with our <a href="%s">privacy policy</a>.'), - list_of_names.join( '</strong>' _ loc(' or ') _ '<strong>' ), c.cobrand.privacy_policy_url + mark_safe(list_of_names.join( '</strong>' _ loc(' or ') _ '<strong>' )), c.cobrand.privacy_policy_url + ); + +ELSE; + + tprintf( + loc('These will be sent to <strong>%s</strong> but not published online.'), + mark_safe(list_of_names.join( '</strong>' _ loc(' or ') _ '<strong>' )) ); -%] + +END %] [% TRY %][% INCLUDE 'report/new/councils_extra_text.html' %][% CATCH file %][% END %] </p> diff --git a/templates/web/base/report/new/councils_text_private.html b/templates/web/base/report/new/councils_text_private.html index cab38c97e..80bcfed74 100644 --- a/templates/web/base/report/new/councils_text_private.html +++ b/templates/web/base/report/new/councils_text_private.html @@ -1,4 +1,5 @@ [% FILTER collapse %] +[% category = mark_safe(category) %] [% IF unresponsive.$category OR unresponsive.ALL OR bodies_to_list.size == 0 %] [% loc('These details will never be shown online without your permission.') %] [% ELSE %] diff --git a/templates/web/base/report/new/duplicate_suggestions.html b/templates/web/base/report/new/duplicate_suggestions.html index 582ba58e9..bd86eb883 100644 --- a/templates/web/base/report/new/duplicate_suggestions.html +++ b/templates/web/base/report/new/duplicate_suggestions.html @@ -1,9 +1,9 @@ -[% IF c.cobrand.suggest_duplicates %] +[% IF c.cobrand.suggest_duplicates AND NOT login_success AND NOT oauth_need_email %] [% extra_js.push( version('/js/duplicates.js'), ) -%] <div id="js-duplicate-reports" class="duplicate-report-suggestions hidden"> - <button class="duplicate-report-suggestions__close js-hide-duplicate-suggestions">[% loc('Close') %]</button> + <button type="button" class="duplicate-report-suggestions__close js-hide-duplicate-suggestions">[% loc('Close') %]</button> <h2 class="form-section-heading">[% loc('Already been reported?') %]</h2> <div class="form-section-description"> [% IF c.cobrand.is_council %] @@ -14,7 +14,7 @@ </div> <ul class="item-list"></ul> - <button class="btn btn--block js-hide-duplicate-suggestions">[% loc('Continue – report a new problem') %]</button> + <button type="button" class="btn btn--block js-hide-duplicate-suggestions">[% loc('Continue – report a new problem') %]</button> </div> <div class="js-template-get-updates hidden"> <div id="alerts" class="get-updates js-alert-list"> @@ -29,7 +29,15 @@ <input type="hidden" name="token" value="[% csrf_token %]" disabled> <input type="hidden" name="type" value="updates" disabled> [% IF c.user_exists %] - <input type="submit" value="[% loc('Get updates') %]" class="btn btn--block" id="alert_email_button"> + [% IF c.user.has_permission_to('contribute_as_another_user', bodies_ids) %] + <label for="rznvy_input">[% loc('Email') %]</label> + <div class="form-txt-submit-box"> + <input type="email" class="form-control" name="rznvy" id="rznvy_input" aria-described-by="rznvy_hint" disabled> + <input type="submit" value="[% loc('Get updates') %]" class="btn" id="alert_email_button"> + </div> + [% ELSE %] + <input type="submit" value="[% loc('Get updates') %]" class="btn btn--block" id="alert_email_button"> + [% END %] [% ELSE %] <label for="rznvy_input">[% loc('Your email') %]</label> <div class="form-txt-submit-box"> diff --git a/templates/web/base/report/new/fill_in_details.html b/templates/web/base/report/new/fill_in_details.html index fa7aabce3..8db096c96 100644 --- a/templates/web/base/report/new/fill_in_details.html +++ b/templates/web/base/report/new/fill_in_details.html @@ -30,7 +30,7 @@ <input type="hidden" name="longitude" id="fixmystreet.longitude" value="[% longitude | html %]"> [% IF report.used_map %] - [% map_html %] + [% map_html | safe %] </div> <div id="map_sidebar"> <div id="side-form"> diff --git a/templates/web/base/report/new/fill_in_details_form.html b/templates/web/base/report/new/fill_in_details_form.html index c9bb2bf87..3954e1e43 100644 --- a/templates/web/base/report/new/fill_in_details_form.html +++ b/templates/web/base/report/new/fill_in_details_form.html @@ -1,4 +1,4 @@ -<h1>[% loc('Report your problem') %]</h1> +[% PROCESS 'report/new/form_heading.html' %] <div class="js-new-report-user-hidden"> @@ -26,7 +26,7 @@ <p class="form-error">[% loc('Sorry, we could not log you in. Please fill in the form below.') %]</p> [% END %] -[% sidebar_html %] +[% sidebar_html | safe %] [% INCLUDE 'errors.html' %] diff --git a/templates/web/base/report/new/form_after_heading.html b/templates/web/base/report/new/form_after_heading.html new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/templates/web/base/report/new/form_after_heading.html diff --git a/templates/web/base/report/new/form_heading.html b/templates/web/base/report/new/form_heading.html index e69de29bb..bd61baa95 100644 --- a/templates/web/base/report/new/form_heading.html +++ b/templates/web/base/report/new/form_heading.html @@ -0,0 +1 @@ +<h1>[% loc('Report your problem') %]</h1> diff --git a/templates/web/base/report/new/form_public_councils_text.html b/templates/web/base/report/new/form_public_councils_text.html new file mode 100644 index 000000000..a4cd5db49 --- /dev/null +++ b/templates/web/base/report/new/form_public_councils_text.html @@ -0,0 +1,11 @@ +[% BLOCK public_councils_text %] +<h2 class="form-section-heading js-hide-if-private-category">[% loc( 'Public details' ) %]</h2> +<h2 class="form-section-heading form-section-heading--private js-hide-if-public-category hidden-js">[% loc( 'Report details' ) %]</h2> +<div class="form-section-description" id="js-councils_text"> + [% IF js %] + [% PROCESS 'report/new/councils_text_all.html' list_of_names = [ loc('the local council') ] %] + [% ELSE %] + [% PROCESS 'report/new/councils_text.html' %] + [% END %] +</div> +[% END %] diff --git a/templates/web/base/report/new/form_report.html b/templates/web/base/report/new/form_report.html index 39e29c723..3b28d4aa7 100644 --- a/templates/web/base/report/new/form_report.html +++ b/templates/web/base/report/new/form_report.html @@ -1,23 +1,35 @@ +[% SET form_show_category_only = NOT category || field_errors.category || disable_form_message || have_disable_qn_to_answer %] +[% TRY %][% PROCESS 'report/new/_form_labels.html' %][% CATCH file %][% END %] + <!-- report/new/form_report.html --> -[% INCLUDE 'report/new/form_heading.html' %] +[% INCLUDE 'report/new/form_after_heading.html' %] [% IF field_errors.bodies %] <p class='form-error'>[% field_errors.bodies %]</p> [% END %] +[% PROCESS 'report/new/form_public_councils_text.html' %] +[% IF public_councils_text_at_top %] + [% INCLUDE public_councils_text %] +[% END %] + [% PROCESS "report/new/category_wrapper.html" %] [% TRY %][% PROCESS 'report/new/after_category.html' %][% CATCH file %][% END %] -<div class="js-hide-if-invalid-category"> -[% TRY %][% PROCESS 'report/new/_form_labels.html' %][% CATCH file %][% END %] - <h2 class="form-section-heading">[% loc( 'Public details' ) %]</h2> - <div class="form-section-description" id="js-councils_text"> - [% IF js %] - [% PROCESS 'report/new/councils_text_all.html' list_of_names = [ loc('the local council') ] %] - [% ELSE %] - [% PROCESS 'report/new/councils_text.html' %] - [% END %] +[% IF form_show_category_only %] + <div class="hidden-js"> + <input class="btn btn--primary btn--block btn--final" type="submit" name="submit_category_part_only" value="[% loc('Submit') %]"> </div> + [% SET field_required = '' %] +[% ELSE %] + [% SET field_required = ' required' %] +[% END %] + +<div class="js-hide-if-invalid-category[% ' hidden-nojs' IF form_show_category_only %]"> + + [% UNLESS public_councils_text_at_top %] + [% INCLUDE public_councils_text %] + [% END %] [% INCLUDE 'report/new/form_title.html' %] @@ -66,7 +78,7 @@ <p class='form-error'>[% field_errors.detail %]</p> [% END %] - <textarea class="form-control" rows="7" cols="26" name="detail" id="form_detail" [% IF form_detail_placeholder %]aria-describedby="detail-hint"[% END %] required>[% report.detail | html %]</textarea> + <textarea class="form-control" rows="7" cols="26" name="detail" id="form_detail" [% IF form_detail_placeholder %]aria-describedby="detail-hint"[% END %][% field_required %]>[% report.detail | html %]</textarea> [% TRY %][% PROCESS 'report/new/inline-tips.html' %][% CATCH file %][% END %] diff --git a/templates/web/base/report/new/form_title.html b/templates/web/base/report/new/form_title.html index b436092d8..423a0cf0e 100644 --- a/templates/web/base/report/new/form_title.html +++ b/templates/web/base/report/new/form_title.html @@ -5,4 +5,4 @@ [% IF field_errors.title %] <p class='form-error'>[% field_errors.title %]</p> [% END %] -<input class="form-control" type="text" value="[% report.title | html %]" name="title" id="form_title" aria-describedby="title-hint" required> +<input class="form-control" type="text" value="[% report.title | html %]" name="title" id="form_title" aria-describedby="title-hint"[% field_required %] autocomplete="off"> diff --git a/templates/web/base/report/new/form_user.html b/templates/web/base/report/new/form_user.html index 2292ed78b..73e1b5d33 100644 --- a/templates/web/base/report/new/form_user.html +++ b/templates/web/base/report/new/form_user.html @@ -1,7 +1,7 @@ <!-- report/new/form_user.html --> -<div class="js-hide-if-invalid-category"> +<div class="js-hide-if-invalid-category[% ' hidden-nojs' IF form_show_category_only %]"> - [% PROCESS 'report/form/user.html' %] + [% PROCESS 'report/form/user.html' type='report' %] <div class="hidden-js js-new-report-user-shown"> <div class="hidden-nojs form-section-preview"> @@ -10,7 +10,7 @@ <strong class="js-form-section-preview" data-source="#form_title"></strong> <span class="js-form-section-preview" data-source="#form_detail"></span> </p> - <button class="btn btn--block js-new-report-user-hide">[% loc('Edit report details') %]</button> + <button type="button" class="btn btn--block js-new-report-user-hide">[% loc('Edit report details') %]</button> </div> [% IF c.user_exists %] diff --git a/templates/web/base/report/new/form_user_loggedin.html b/templates/web/base/report/new/form_user_loggedin.html index 37f0c6f0b..0d259e695 100644 --- a/templates/web/base/report/new/form_user_loggedin.html +++ b/templates/web/base/report/new/form_user_loggedin.html @@ -6,9 +6,9 @@ [% INCLUDE form_as %] </div> [% ELSE %] - [% can_contribute_as_another_user = c.user.has_permission_to("contribute_as_another_user", bodies.keys) %] - [% can_contribute_as_anonymous_user = c.user.has_permission_to("contribute_as_anonymous_user", bodies.keys) %] - [% can_contribute_as_body = c.user.from_body AND c.user.has_permission_to("contribute_as_body", bodies.keys) %] + [% can_contribute_as_another_user = c.user.has_permission_to("contribute_as_another_user", bodies_ids) %] + [% can_contribute_as_anonymous_user = c.user.has_permission_to("contribute_as_anonymous_user", bodies_ids) %] + [% can_contribute_as_body = c.user.from_body AND c.user.has_permission_to("contribute_as_body", bodies_ids) %] [% IF can_contribute_as_another_user OR can_contribute_as_anonymous_user OR can_contribute_as_body %] [% INCLUDE form_as %] [% END %] @@ -25,7 +25,7 @@ <option value="another_user">[% loc('Another user') %]</option> [% END %] [% IF js || can_contribute_as_body %] - <option value="body" [% c.user.from_body AND ( c.user.has_body_permission_to('planned_reports') || c.user.has_body_permission_to('default_to_body') ) ? 'selected' : '' %]>[% c.user.from_body.name %]</option> + <option value="body" [% c.user.from_body AND ( c.user.has_body_permission_to('planned_reports') || c.user.has_body_permission_to('default_to_body') ) ? 'selected' : '' %]>[% c.user.from_body.cobrand_name %]</option> [% END %] </select> [% END %] @@ -61,9 +61,11 @@ <input class="form-control" type="text" value="[% report.user.email | html %]" name="email" id="form_email"> [% END %] -[% IF c.user.has_permission_to("report_inspect", bodies.keys) OR c.user.has_permission_to("report_mark_private", bodies.keys) %] +[% 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 %]> + <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 %]> <label class="inline" for="form_non_public">[% loc('Private') %] </label> </div> [% END %] diff --git a/templates/web/base/report/new/login_success_form.html b/templates/web/base/report/new/login_success_form.html index 5038c6beb..32c414bda 100644 --- a/templates/web/base/report/new/login_success_form.html +++ b/templates/web/base/report/new/login_success_form.html @@ -1,8 +1,8 @@ -<h1>[% loc('Report your problem') %]</h1> +[% PROCESS 'report/new/form_heading.html' %] <p class='form-success'>[% loc('You have successfully signed in; please check and confirm your details are accurate:') %]</p> -[% sidebar_html %] +[% sidebar_html | safe %] [% INCLUDE 'errors.html' %] @@ -13,6 +13,7 @@ [% ELSE %] [% PROCESS "report/form/user_loggedout.html" type='report' object=report %] [% END %] - [% PROCESS 'report/new/form_report.html' %] + [% 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') %]"> </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 5b4622cda..a0adbe563 100644 --- a/templates/web/base/report/new/oauth_email_form.html +++ b/templates/web/base/report/new/oauth_email_form.html @@ -1,11 +1,11 @@ -<h1>[% loc('Report your problem') %]</h1> +[% PROCESS 'report/new/form_heading.html' %] <p class="form-error"> [% loc('Please note your report has <strong>not yet been sent</strong>.') %] [% loc('We need your email address, please give it below.') %] </p> -[% sidebar_html %] +[% sidebar_html | safe %] [% INCLUDE 'errors.html' %] @@ -17,5 +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') %]"> </div> </fieldset> diff --git a/templates/web/base/report/new/report_import.html b/templates/web/base/report/new/report_import.html index f2ead081b..f68e21301 100644 --- a/templates/web/base/report/new/report_import.html +++ b/templates/web/base/report/new/report_import.html @@ -2,6 +2,8 @@ <h1>External import</h1> +[% INCLUDE 'errors.html' %] + <p>You may inject problem reports into FixMyStreet programatically using this simple interface. Upon receipt, an email will be sent to the address given, with a link the user must click in order to check the details of their report, @@ -14,12 +16,14 @@ line each starting with <samp>ERROR:</samp>. <p>You may submit the following information by POST to this URL (i.e. <samp>[% c.uri_for('/import') %]</samp> ):</p> +[% IF NOT errors AND NOT c.req.params.web %] <style type="text/css" media="screen"> input { /* Hide the form elements - they are just here for simpler testing */ - display: none; + display: none !important; } </style> +[% END %] <form method="POST" action="/import" enctype="multipart/form-data"> @@ -28,66 +32,76 @@ line each starting with <samp>ERROR:</samp>. <dd> <em>Required</em>. Name of application/service using this interface. - <input type="text" name="service" /> + <input type="text" name="service" value="[% input.service %]"> </dd> <dt>id</dt> <dd> Unique ID of a user/device, for possible future use.<br> <small>(e.g. used by Flickr import to know which accounts to look at)</small> - <input type="text" name="id" /> + <input type="text" name="id" value="[% input.id %]"> </dd> <dt>subject</dt> <dd> <em>Required</em>. Subject of problem report. - <input type="text" name="subject" /> + <input type="text" name="subject" value="[% input.subject %]"> </dd> <dt>detail</dt> <dd> Main body and details of problem report. - <input type="text" name="detail" /> + <input type="text" name="detail" value="[% input.detail %]"> </dd> <dt>name</dt> <dd> <em>Required</em>. Name of problem reporter. - <input type="text" name="name" /> + <input type="text" name="name" value="[% input.name %]"> </dd> <dt>email</dt> <dd> <em>Required</em>. Email address of problem reporter. - <input type="text" name="email" /> + <input type="text" name="email" value="[% input.email %]"> </dd> <dt>phone</dt> <dd> Telephone number of problem reporter. - <input type="text" name="phone" /> + <input type="text" name="phone" value="[% input.phone %]"> </dd> <dt>easting / northing</dt> <dt>lat / lon</dt> <dd> Location of problem report. You can either supply eastings/northings, or WGS84 latitude/longitude. - <input type="text" name="easting" /> - <input type="text" name="northing" /> - <input type="text" name="lat" /> - <input type="text" name="lon" /> + <input type="text" name="easting" value="[% input.easting %]"> + <input type="text" name="northing" value="[% input.northing %]"> + <input type="text" name="lat" value="[% input.lat %]"> + <input type="text" name="lon" value="[% input.lon %]"> </dd> + [% IF c.cobrand.allow_photo_upload %] + <input type="hidden" name="upload_fileid" value="[% upload_fileid %]"> + [% IF upload_fileid %] + [% FOREACH id IN upload_fileid.split(',') %] + <img align="right" src="/photo/temp.[% id %]" alt=""> + [% END %] + [% END %] + <dt>photo</dt> <dd> - Photo of problem (JPEG only). + Photo of problem. <input type="file" name="photo" /> </dd> + [% END %] + </dl> -<input type="hidden" name="web" value="0"> -<input type="submit" /> +<input type="hidden" name="web" value="[% c.req.params.web ? 1 : 0 %]"> +<input type="submit" value="[% loc('Submit') %]"> </form> -[% INCLUDE 'footer.html' %]
\ No newline at end of file +[% INCLUDE 'footer.html' %] diff --git a/templates/web/base/report/update-form-wrapper.html b/templates/web/base/report/update-form-wrapper.html index 3a75036cc..a46207a3c 100644 --- a/templates/web/base/report/update-form-wrapper.html +++ b/templates/web/base/report/update-form-wrapper.html @@ -1,12 +1,21 @@ [% UNLESS c.cobrand.updates_disallowed(problem) %] + + [% IF NOT c.user_exists AND problem.non_public # Came via other-reported token or similar %] + <p>[% tprintf(loc('To provide an update, please <a href="%s">sign in</a>.'), '/auth?r=report/' _ problem.id) %]</p> + + [% ELSE %] + [% IF two_column_sidebar %] - <button class="btn btn--provide-update js-provide-update hidden-nojs">[% loc('Provide an update') %]</button> + <button type="button" class="btn btn--provide-update js-provide-update hidden-nojs">[% loc('Provide an update') %]</button> <div class="hidden-js"> [% END %] [% INCLUDE 'report/update-form.html' %] [% IF two_column_sidebar %] </div> [% END %] + + [% END %] + [% ELSE %] [% TRY %][% INCLUDE 'report/_updates_disallowed_message.html' %][% CATCH file %][% END %] [% END %] diff --git a/templates/web/base/report/update-form.html b/templates/web/base/report/update-form.html index afa110280..d235455ed 100644 --- a/templates/web/base/report/update-form.html +++ b/templates/web/base/report/update-form.html @@ -1,5 +1,5 @@ [% allow_creation = (!c.cobrand.only_authed_can_create || (c.user && c.user.from_body)) AND NOT c.cobrand.updates_disallowed(problem) %] -[% RETURN IF NOT allow_creation OR problem.extra.closed_updates %] +[% RETURN IF NOT allow_creation %] <div id="update_form"> [% IF NOT login_success AND NOT oauth_need_email %] @@ -24,6 +24,7 @@ [% IF login_success %] [% PROCESS "report/update/form_user_loggedin.html" %] [% INCLUDE 'report/update/form_update.html' %] + <hr> [% ELSIF oauth_need_email %] <div id="form_sign_in"> [% PROCESS "report/form/user_loggedout_by_email.html" object=update type='update' valid_class='validNameU' email_required=1 %] diff --git a/templates/web/base/report/update/form_user.html b/templates/web/base/report/update/form_user.html index d9a181e26..92120271f 100644 --- a/templates/web/base/report/update/form_user.html +++ b/templates/web/base/report/update/form_user.html @@ -1,11 +1,11 @@ <!-- report/update/form_user.html --> -[% PROCESS 'report/form/user.html' %] +[% PROCESS 'report/form/user.html' type='update' %] <div class="hidden-js js-new-report-user-shown"> <div class="hidden-nojs form-section-preview"> <h2 class="form-section-heading">[% loc('Your update') %]</h2> <p class="js-form-section-preview" data-source="#form_update"></p> - <button class="btn btn--block js-new-report-user-hide">[% loc('Edit your update') %]</button> + <button type="button" class="btn btn--block js-new-report-user-hide">[% loc('Edit your update') %]</button> </div> [% IF c.user_exists %] diff --git a/templates/web/base/report/updates.html b/templates/web/base/report/updates.html index 817cc7eb4..93bae4d64 100644 --- a/templates/web/base/report/updates.html +++ b/templates/web/base/report/updates.html @@ -6,6 +6,9 @@ [%- END %] [%- NEXT %] [%- END %] +[%- IF update.get_extra_metadata('triage_report') == 1 AND ( NOT c.user OR ( NOT c.user.from_body AND NOT c.user.is_superuser ) ) %] + [%- NEXT %] +[%- END %] [% INCLUDE 'report/update.html' %] [% END %] diff --git a/templates/web/base/reports/_list-filter-status.html b/templates/web/base/reports/_list-filter-status.html new file mode 100644 index 000000000..6fa998fc1 --- /dev/null +++ b/templates/web/base/reports/_list-filter-status.html @@ -0,0 +1,45 @@ +[% SET show_all_states = c.cobrand.filter_show_all_states OR (c.user_exists AND (c.user.is_superuser OR c.user.belongs_to_body(body.id))) %] + +<select class="form-control js-multiple" name="status" id="statuses" multiple + data-all="[% loc('All') %]" + [% IF show_all_states %] + [% options = []; + FOR group IN filter_states; FOR state IN group.1; + NEXT IF state == 'hidden'; + SET state = 'fixed' IF state == 'fixed - council'; + options.push(state); + END; END + %] + data-all-options='["[% options.join('", "') %]"]' + [%~ ELSE ~%] + [%~ IF has_fixed_state ~%] + data-all-options='["open","closed","fixed"]' + [%~ ELSE ~%] + data-all-options='["open","closed"]' + [%~ END ~%] + [%~ END ~%] + [% INCLUDE 'reports/_status_filter_options.html' %] + > + [% IF c.user_exists AND c.user.has_body_permission_to('planned_reports') AND !shortlist AND !heatmap %] + <option value="shortlisted"[% ' selected' IF filter_status.shortlisted %]>[% loc('Shortlisted') %]</option> + <option value="unshortlisted"[% ' selected' IF filter_status.unshortlisted %]>[% loc('Unshortlisted') %]</option> + [% END %] + [% IF c.user_exists AND ( c.user.has_body_permission_to('report_inspect') OR c.user.has_body_permission_to('report_mark_private') ) %] + <option value="non_public"[% ' selected' IF filter_status.non_public %]>[% loc('Private only') %]</option> + [% END %] + [% IF show_all_states %] + [% FOR group IN filter_states %] + [% FOR state IN group.1 %] + [% NEXT IF state == 'hidden' %] + [% SET state = 'fixed' IF state == 'fixed - council' ~%] + <option value="[% state %]"[% ' selected' IF filter_status.$state %]>[% prettify_state(state, 1) %]</option> + [% END %] + [% END %] + [% ELSE %] + <option value="open"[% ' selected' IF filter_status.open %]>[% prettify_state('confirmed') %]</option> + <option value="closed"[% ' selected' IF filter_status.closed %]>[% prettify_state('closed') %]</option> + [% IF has_fixed_state %] + <option value="fixed"[% ' selected' IF filter_status.fixed %]>[% prettify_state('fixed') %]</option> + [% END %] + [% END %] +</select> diff --git a/templates/web/base/reports/_list-filters-sort.html b/templates/web/base/reports/_list-filters-sort.html new file mode 100644 index 000000000..c5911e716 --- /dev/null +++ b/templates/web/base/reports/_list-filters-sort.html @@ -0,0 +1,14 @@ +<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> + <option value="updated-asc"[% ' selected' IF sort_key == 'updated-asc' %]>[% loc('Least recently updated') %]</option> + <option value="comments-desc"[% ' selected' IF sort_key == 'comments-desc' %]>[% loc('Most commented') %]</option> + </select> + <input type="submit" name="filter_update" value="[% loc('Go') %]"> +</p> diff --git a/templates/web/base/reports/_list-filters.html b/templates/web/base/reports/_list-filters.html index b898817fc..f5d1faa65 100644 --- a/templates/web/base/reports/_list-filters.html +++ b/templates/web/base/reports/_list-filters.html @@ -1,59 +1,28 @@ -[% SET show_all_states = c.cobrand.filter_show_all_states OR (c.user_exists AND (c.user.is_superuser OR c.user.belongs_to_body(body.id))) %] -[% select_status = BLOCK %] - <select class="form-control js-multiple" name="status" id="statuses" multiple - data-all="[% loc('All') %]" - [% IF show_all_states %] - [% options = []; - FOR group IN filter_states; FOR state IN group.1; - NEXT IF state == 'hidden'; - SET state = 'fixed' IF state == 'fixed - council'; - options.push(state); - END; END - %] - data-all-options='["[% options.join('", "') %]"]' - [%~ ELSE ~%] - [%~ IF has_fixed_state ~%] - data-all-options='["open","closed","fixed"]' - [%~ ELSE ~%] - data-all-options='["open","closed"]' - [%~ END ~%] - [%~ END ~%] - [% INCLUDE 'reports/_status_filter_options.html' %] - > - [% 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 %] - [% IF c.user_exists AND ( c.user.has_body_permission_to('report_inspect') OR c.user.has_body_permission_to('report_mark_private') ) %] - <option value="non_public"[% ' selected' IF filter_status.non_public %]>[% loc('Private only') %]</option> - [% END %] - [% IF show_all_states %] - [% FOR group IN filter_states %] - [% FOR state IN group.1 %] - [% NEXT IF state == 'hidden' %] - [% SET state = 'fixed' IF state == 'fixed - council' ~%] - <option value="[% state %]"[% ' selected' IF filter_status.$state %]>[% prettify_state(state, 1) %]</option> - [% END %] - [% END %] - [% ELSE %] - <option value="open"[% ' selected' IF filter_status.open %]>[% prettify_state('confirmed') %]</option> - <option value="closed"[% ' selected' IF filter_status.closed %]>[% prettify_state('closed') %]</option> - [% IF has_fixed_state %] - <option value="fixed"[% ' selected' IF filter_status.fixed %]>[% prettify_state('fixed') %]</option> - [% END %] - [% END %] - </select> +[% select_status = PROCESS 'reports/_list-filter-status.html' %] + +[% 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 ) ) %]> + [% cat.category_display %] + [%~ IF cat.get_extra_metadata('help_text') %] ([% cat.get_extra_metadata('help_text') %])[% END ~%] + </option> + [% END %] [% END %] + [% select_category = BLOCK %] [% IF filter_categories.size %] + [% SET filter_group = c.get_param('filter_group') %] <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 %] - [%~ IF cat.get_extra_metadata('help_text') %] ([% cat.get_extra_metadata('help_text') %])[% END ~%] - </option> + [% IF category_groups %] + [% FOR group IN category_groups %] + <optgroup label="[% group.name %]"> + [% INCLUDE category_options categories=group.categories %] + </optgroup> [% END %] + [% ELSE %] + [% INCLUDE category_options categories=filter_categories %] + [% END %] </select> [% ELSE %] [% loc('Everything') %] @@ -67,24 +36,12 @@ [% END %] <p class="report-list-filters"> - [% tprintf(loc('<label for="statuses">Show</label> %s reports <label for="filter_categories">about</label> %s', "The first %s is a dropdown of all/fixed/etc, the second is a dropdown of categories"), select_status, select_category) %] + [% tprintf(loc('<label for="statuses">Show</label> %s reports <label for="filter_categories">about</label> %s', "The first %s is a dropdown of all/fixed/etc, the second is a dropdown of categories"), mark_safe(select_status), mark_safe(select_category)) %] <input type="submit" name="filter_update" value="[% loc('Go') %]"> </p> - <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> - <option value="updated-asc"[% ' selected' IF sort_key == 'updated-asc' %]>[% loc('Least recently updated') %]</option> - <option value="comments-desc"[% ' selected' IF sort_key == 'comments-desc' %]>[% loc('Most commented') %]</option> - </select> - <input type="submit" name="filter_update" value="[% loc('Go') %]"> - </p> + [% PROCESS 'reports/_list-filters-sort.html' %] + [% IF page == 'around' %] <p id="show_old_reports_wrapper" class="report-list-filters[% ' hidden' UNLESS num_old_reports > 0 %]"> <label for="show_old_reports">[% loc('Show older reports') %]</label> diff --git a/templates/web/base/reports/_rss.html b/templates/web/base/reports/_rss.html index fdb833315..4bb30c274 100644 --- a/templates/web/base/reports/_rss.html +++ b/templates/web/base/reports/_rss.html @@ -1,8 +1,11 @@ <div class="shadow-wrap"> <ul id="key-tools"> <li><a rel="nofollow" id="key-tool-updates-area" class="feed" href="[% rss_url %]">[% - IF c.cobrand.moniker == 'bromley' AND thing == 'council'; - 'Get updates of reports in Bromley'; + SET monikers = ['bromley','hounslow']; + IF monikers.grep(c.cobrand.moniker).size AND thing == 'council'; + 'Get updates of reports in ' _ c.cobrand.moniker.ucfirst; + ELSIF c.cobrand.moniker == 'isleofwight'; + 'Get updates of reports on the Isle of Wight'; ELSIF c.cobrand.moniker == 'bromley'; 'Get updates of reports in this ward'; ELSIF c.cobrand.is_council; diff --git a/templates/web/base/reports/body.html b/templates/web/base/reports/body.html index 8be72d632..d723a7992 100755 --- a/templates/web/base/reports/body.html +++ b/templates/web/base/reports/body.html @@ -1,9 +1,16 @@ +[% 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 %] + [% IF ward %] - [% name = "$ward.name, $body.name" + [% name = "$ward.name, $body_name" thing = loc('ward') %] [% ELSE %] - [% name = body.name + [% name = body_name thing = loc('council') %] [% END %] @@ -25,7 +32,7 @@ rss = [ tprintf(loc('Problems within %s, %s', "First %s is the body name, second %s the site name"), name, site_name), rss_url ] %] -[% map_html %] +[% map_html | safe %] [% IF c.user && c.user.has_body_permission_to('planned_reports') %] <p class="sub-map-links" id="sub_map_links"> @@ -41,15 +48,15 @@ <h1 id="reports_heading"> [% ward.name %] </h1> - <a href="[% body_url %]">[% body.name %]</a> + <a href="[% body_url %]">[% body_name %]</a> [% ELSIF wards %] <h1 id="reports_heading"> [% FOREACH w IN wards %][% w.name %][% IF NOT loop.last %], [% END %][% END %] </h1> - <a href="[% body_url %]">[% body.name %]</a> + <a href="[% body_url %]">[% body_name %]</a> [% ELSE %] <h1 id="reports_heading"> - [% body.name %] + [% body_name %] </h1> [% END %] diff --git a/templates/web/base/reports/index.html b/templates/web/base/reports/index.html index dfb99f089..dcad59dad 100755 --- a/templates/web/base/reports/index.html +++ b/templates/web/base/reports/index.html @@ -25,7 +25,7 @@ <h2>[% loc('All time') %]</h2> <div class="labelled-line-chart"> <canvas id="chart-all-reports" width="600" height="300" - data-labels="["[% problem_periods.join('","') %]"]" + data-labels="[[% FOR period IN problem_periods %]"[% period %]"[% IF NOT loop.last %],[% END %][% END %]]" data-values-reports="[[% problems_reported_by_period.join(',') %]]" data-values-fixed="[[% problems_fixed_by_period.join(',') %]]" ></canvas> diff --git a/templates/web/base/status/stats.html b/templates/web/base/status/stats.html index 02f9de904..90904abaa 100644 --- a/templates/web/base/status/stats.html +++ b/templates/web/base/status/stats.html @@ -2,7 +2,6 @@ [%- total_problems_live = total_problems_live | format_number; - total_problems_users = total_problems_users | format_number; comments_confirmed = (comments.confirmed || 0) | format_number; alerts_1 = alerts.1 | format_number; alerts_0 = alerts.0 | format_number; @@ -17,6 +16,7 @@ <ul> <li>[% tprintf( loc('<strong>%s</strong> live problems'), decode(total_problems_live) ) %] [% IF admin_include_users %] + [% total_problems_users = total_problems_users | format_number ~%] [% tprintf( loc('from %s different users'), decode(total_problems_users) ) %] [% END %] </li> |