diff options
Diffstat (limited to 'templates/web/base')
79 files changed, 840 insertions, 531 deletions
diff --git a/templates/web/base/admin/body-form.html b/templates/web/base/admin/body-form.html index 55d0e500c..54445a282 100644 --- a/templates/web/base/admin/body-form.html +++ b/templates/web/base/admin/body-form.html @@ -75,8 +75,7 @@ </div> <p> <label for="area_ids">[% loc('Area covered') %]</label> - <select class="form-control" name="area_ids" id="area_ids" multiple> - <option value=""> -- [% loc('Select an area') %] -- </option> + <select class="form-control js-multiple" name="area_ids" id="area_ids" multiple data-none="-- [% loc('Select an area') %] --"> [% SET body_areas = body.areas %] [% FOR area IN areas %] [% SET aid = area.id %] diff --git a/templates/web/base/admin/config_page.html b/templates/web/base/admin/config_page.html index 87032b0b6..d448d2a63 100644 --- a/templates/web/base/admin/config_page.html +++ b/templates/web/base/admin/config_page.html @@ -55,7 +55,7 @@ running version <strong>[% git_version || 'unknown' %]</strong>. </tr> [% INCLUDE with_cobrand value="MAP_TYPE" cob=c.cobrand.map_type %] [% INCLUDE with_cobrand value="EXAMPLE_PLACES" - conf = decode(c.config.EXAMPLE_PLACES.join(', ')) + conf = c.config.EXAMPLE_PLACES.join(', ') cob = c.cobrand.example_places %] [% INCLUDE with_cobrand value="LANGUAGES" cob = c.cobrand.languages %] diff --git a/templates/web/base/admin/exordefects/index.html b/templates/web/base/admin/exordefects/index.html index dba58198d..65b2aa486 100644 --- a/templates/web/base/admin/exordefects/index.html +++ b/templates/web/base/admin/exordefects/index.html @@ -6,26 +6,29 @@ [% 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="text" class="form-control" - placeholder="[% ('Click here or enter as dd/mm/yyyy') %]" name="start_date" id="start_date" - value="[% start_date ? start_date.strftime( '%d/%m/%Y') : '' | html %]" /> + <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="text" class="form-control" - placeholder="[% ('Click here or enter as dd/mm/yyyy') %]" name="end_date" id="end_date" size="5" - value="[% end_date ? end_date.strftime( '%d/%m/%Y') : '' | html %]" /> + <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> - [% ('Inspector:') %] <select class="form-control" id='user_id' name='user_id'> + <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" /> diff --git a/templates/web/base/admin/report_blocks.html b/templates/web/base/admin/report_blocks.html index f5896b88f..4c52b14bb 100644 --- a/templates/web/base/admin/report_blocks.html +++ b/templates/web/base/admin/report_blocks.html @@ -15,7 +15,7 @@ SET state_groups = c.cobrand.state_groups_admin; [% BLOCK abuse_button -%] [% IF allowed_pages.abuse_edit -%] -[% IF email_in_abuse %]<small>[% loc('(Email in abuse table)') %]</small>[% ELSE %]<input type="submit" class="btn" name="banuser" value="[% loc('Ban email address') %]" />[% END %] +[% IF username_in_abuse %]<small>[% loc('User in abuse table') %]</small>[% ELSE %]<input type="submit" class="btn" name="banuser" value="[% loc('Ban user') %]" />[% END %] [%- END %] [%- END %] diff --git a/templates/web/base/admin/report_edit.html b/templates/web/base/admin/report_edit.html index 3c8134b80..ff99bb907 100644 --- a/templates/web/base/admin/report_edit.html +++ b/templates/web/base/admin/report_edit.html @@ -1,8 +1,8 @@ [% PROCESS "maps/${map.type}.html" admin = 1; + SET bodyclass = 'mappage with-notes'; INCLUDE 'admin/header.html' - title = tprintf(loc('Editing problem %d'), problem.id ), - bodyclass = 'mappage with-notes'; + title = tprintf(loc('Editing problem %d'), problem.id ); PROCESS 'admin/report_blocks.html' -%] @@ -126,12 +126,17 @@ class="admin-offsite-link">[% problem.latitude %], [% problem.longitude %]</a> </select></li> <li><label for="name">[% loc('Name:') %]</label> <input type='text' class="form-control" name='name' id='name' value='[% problem.name | html %]'></li> -<li><label for="email">[% loc('Email:') %]</label> - <input type='text' class="form-control" id='email' name='email' value='[% problem.user.email | html %]'> +<li><label for="username">[% loc('User:') %]</label> + <input type='text' class="form-control" id='username' name='username' value='[% problem.user.username | html %]'> [% PROCESS abuse_button %] [% PROCESS flag_button user=problem.user %] </li> -<li>[% loc('Phone:') %] [% problem.user.phone | html %]</li> +[% IF problem.user.phone_display != problem.user.username %] +<li>[% loc('Phone:') %] [% problem.user.phone_display | html %]</li> +[% END %] +[% IF problem.user.email != problem.user.username %] +<li>[% loc('Email:') %] [% problem.user.email | html %]</li> +[% END %] <li><label class="inline-text" for="flagged">[% loc('Flagged:') %]</label> <input type="checkbox" id="flagged" name="flagged"[% ' checked' IF problem.flagged %]></li> <li><label class="inline-text" for="non_public">[% loc('Private') %]:</label> diff --git a/templates/web/base/admin/stats.html b/templates/web/base/admin/stats.html deleted file mode 100644 index 150afd619..000000000 --- a/templates/web/base/admin/stats.html +++ /dev/null @@ -1,106 +0,0 @@ -[% INCLUDE 'admin/header.html' title=loc('Stats') %] - -[% IF show_count %] -<p> -<strong>[% tprintf( unconfirmed ? loc( 'All reports between %s and %s' ) : loc( 'Confirmed reports between %s and %s' ), start_date.ymd, end_date.ymd ) | html %]</strong> -</p> -[% IF bymonth %] -<table> - <thead> - <td style="width: 8em"><strong>[% loc('Year') %]</strong></td> - <td style="width: 8em"><strong>[% loc('Month') %]</strong></td> - <td><strong>[% loc('Count') %]</strong></td> - </thead> - [% total = 0 %] - [% WHILE ( state = states.next ) %] - [% total = total + state.get_column( 'count' ) %] - <tr> - <td>[% state.get_column( 'c_year') | html %]</td> - <td>[% state.get_column( 'c_month') | html %]</td> - <td>[% state.get_column( 'count' ) %]</td> - </tr> - [% END %] - <tr> - <td colspan="2"><strong>[% loc( 'Total' ) %]</strong></td> - <td><strong>[% total %]</strong></td> - </tr> -</table> -[% ELSE %] -<table> - <thead> - <td style="width: 8em"><strong>[% loc('Current state') %]</strong></td> - <td><strong>[% loc('Count') %]</strong></td> - </thead> - [% total = 0 %] - [% WHILE ( state = states.next ) %] - [% total = total + state.get_column( 'count' ) %] - <tr> - <td>[% state.state | html %]</td> - <td>[% state.get_column( 'count' ) %]</td> - </tr> - [% END %] - <tr> - <td><strong>[% loc( 'Total' ) %]</strong></td> - <td><strong>[% total %]</strong></td> - </tr> -</table> -[% END %] - -[% IF unconfirmed %] - <p> - <small>[% loc( 'Note that when including unconfirmed reports we use the date the report was created which may not be in the same month the report was confirmed so the numbers may jump about a little' ) %]</small> - </p> -[% END %] -[% ELSE %] -<ul> -<li><a href="stats/questionnaire">[% loc('Survey Results') %]</a></li> -<li><a href="stats/state">[% loc('Problem breakdown by state') %]</a></li> -<li><a href="stats/fix-rate">[% loc('Category fix rate for problems > 4 weeks old') %]</a></li> -</ul> - -[% END %] - -[% IF errors %] - [% FOREACH error IN errors %] - <p class="error">[% error %]</p> - [% END %] -[% END %] - -<form method="post" action="[% c.uri_for('stats') %]" enctype="application/x-www-form-urlencoded" accept-charset="utf-8"> - <p> - <label for="start_date">[% loc('Start Date:') %]</label><input type="text" class="form-control" - placeholder="[% loc('Click here or enter as dd/mm/yyyy') %]" name="start_date" id="start_date" - value="[% start_date ? start_date.strftime( '%d/%m/%Y') : '' | html %]" /> - </p> - - <p> - <label for="end_date">[% loc('End Date:') %]</label><input type="text" class="form-control" - placeholder="[% loc('Click here or enter as dd/mm/yyyy') %]" name="end_date" id="end_date" size="5" - value="[% end_date ? end_date.strftime( '%d/%m/%Y') : '' | html %]" /> - </p> - - <p> - <input type="checkbox" name="unconfirmed" id="unconfirmed"[% unconfirmed ? ' checked' : '' %] /><label class="inline" for="unconfirmed">[% loc('Include unconfirmed reports') %]</label> - </p> - - <p> - <input type="checkbox" name="bymonth" id="bymonth"[% bymonth ? ' checked' : '' %] /><label class="inline" for="bymonth">[% loc('By Date') %]</label> - </p> - - [% IF c.user.is_superuser %] - <p> - [% loc('Council:') %] <select class="form-control" id='body' name='body'> - <option value=''>[% loc('No council') %]</option> - [% FOR body IN bodies %] - <option value="[% body.id %]"[% ' selected' IF body.id == selected_body %]>[% body.name %]</option> - [% END %] - </select> - </p> - [% END %] - - <p> - <input type="submit" class="btn" name="getcounts" size="30" id="getcounts" value="[% loc('Get Count') %]" /> - </p> -</form> - -[% INCLUDE 'admin/footer.html' %] diff --git a/templates/web/base/admin/stats_fix_rate.html b/templates/web/base/admin/stats/fix_rate.html index fb88a1c06..fb88a1c06 100644 --- a/templates/web/base/admin/stats_fix_rate.html +++ b/templates/web/base/admin/stats/fix_rate.html diff --git a/templates/web/base/admin/stats/index.html b/templates/web/base/admin/stats/index.html new file mode 100644 index 000000000..6ea1ae403 --- /dev/null +++ b/templates/web/base/admin/stats/index.html @@ -0,0 +1,10 @@ +[% INCLUDE 'admin/header.html' title=loc('Stats') %] + +<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> +</ul> + +[% INCLUDE 'admin/footer.html' %] diff --git a/templates/web/base/admin/questionnaire.html b/templates/web/base/admin/stats/questionnaire.html index 680e0d214..680e0d214 100644 --- a/templates/web/base/admin/questionnaire.html +++ b/templates/web/base/admin/stats/questionnaire.html diff --git a/templates/web/base/admin/stats_by_state.html b/templates/web/base/admin/stats/state.html index 6bcd35f88..6bcd35f88 100644 --- a/templates/web/base/admin/stats_by_state.html +++ b/templates/web/base/admin/stats/state.html diff --git a/templates/web/base/admin/template_edit.html b/templates/web/base/admin/template_edit.html index 76de70dcc..3e436dbf9 100644 --- a/templates/web/base/admin/template_edit.html +++ b/templates/web/base/admin/template_edit.html @@ -9,20 +9,30 @@ accept-charset="utf-8" class="validate"> + [% IF errors %] + <p class="error">[% loc('Please correct the errors below') %]</p> + [% 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.') %] + </p> + </div> <p> <strong>[% loc('Title:') %] </strong> <input type="text" name="title" class="required form-control" size="30" value="[% rt.title| html %]"> </p> + + <div class="admin-hint"> + <p> + [% loc('This is the <strong>public</strong> text that will be shown on the site.') %] + </p> + </div> <p> <strong>[% loc('Text:') %] </strong> <textarea class="form-control" name="text" class="required">[% rt.text |html %]</textarea> </p> - <p> - <label> - <strong>[% loc('Auto-response:') %]</strong> - <input type="checkbox" name="auto_response" [% 'checked' IF rt.auto_response %] /> - </label> - </p> <div class="admin-hint"> <p> @@ -41,13 +51,28 @@ [% INCLUDE 'admin/state_groups_select.html' current_state=rt.state include_empty=1 %] </p> + [% IF errors.auto_response %] + <div class="form-error">[% errors.auto_response %]</div> + [% END %] + <div class="admin-hint"> + <p> + [% loc('If ticked, this template will be used for Open311 updates that put problems in this state.') %] + </p> + </div> + <p> + <label> + <strong>[% loc('Auto-response:') %]</strong> + <input type="checkbox" name="auto_response" [% 'checked' IF rt.auto_response %] /> + </label> + </p> + <p> <input type="hidden" name="token" value="[% csrf_token %]" > <input type="submit" class="btn" name="Edit templates" value="[% rt.id ? loc('Save changes') : loc('Create template') %]" > </p> [% IF rt.id %] <p> - <input class="delete btn-danger" type="submit" name="delete_template" value="[% loc('Delete template') %]"> + <input class="delete btn-danger" type="submit" name="delete_template" value="[% loc('Delete template') %]" data-confirm="[% loc('Are you sure?') %]"> </p> [% END %] </form> diff --git a/templates/web/base/admin/templates.html b/templates/web/base/admin/templates.html index f9dda7a4c..444f2734d 100644 --- a/templates/web/base/admin/templates.html +++ b/templates/web/base/admin/templates.html @@ -1,24 +1,30 @@ [% INCLUDE 'admin/header.html' title=tprintf(loc('Response Templates for %s'), body.name) -%] -[% IF c.cobrand.moniker == 'zurich' %] - <h2> [% tprintf(loc('Response Templates for %s'), body.name) %] </h2> -[% END %] - <table> <thead> <tr> <th> [% loc('Title') %] </th> - <th> [% loc('Text') %] </th> - <th> [% loc('Created') %] </th> + <th> [% loc('Categories') %] </th> + <th> [% loc('State') %] </th> + <th> [% loc('Auto Response') %] </th> <th> </th> </tr> </thead> <tbody> [% FOR t IN response_templates %] <tr> - <td> [% t.title %] </td> - <td> [% t.text %] </td> - <td> [% t.created %] </td> + <td> [% t.title | html %] </td> + <td> + [% UNLESS t.contacts.size %] + <em>[% loc('All categories') %]</em> + [% ELSE %] + [% FOR contact IN t.contacts %] + [% contact.category_display %][% ',' UNLESS loop.last %] + [% END %] + [% END %] + </td> + <td> [% t.state | html %] </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> </tr> [% END %] diff --git a/templates/web/base/admin/update_edit.html b/templates/web/base/admin/update_edit.html index 2b20c50b3..34e64310f 100644 --- a/templates/web/base/admin/update_edit.html +++ b/templates/web/base/admin/update_edit.html @@ -31,8 +31,10 @@ <option [% 'selected ' IF state.0 == update.state %] value="[% state.0 %]">[% state.1 %]</option> [% END %] </select></li> -<li>[% loc('Name:') %] <input type='text' class="form-control" name='name' id='name' value='[% update.name | html %]'></li> -<li>[% loc('Email:') %] <input type='text' class="form-control" id='email' name='email' value='[% update.user.email | html %]'> +<li><label for="name">[% loc('Name:') %]</label> + <input type='text' class="form-control" name='name' id='name' value='[% update.name | html %]'></li> +<li><label for="username">[% loc('User:') %]</label> + <input type='text' class="form-control" id='username' name='username' value='[% update.user.username | html %]'> [%- IF update.user.from_body && update.user.from_body.id == update.problem.bodies_str %] [% ' (' _ tprintf(loc('user is from same council as problem - %d'), update.user.from_body.id ) _')' %] [% END -%] diff --git a/templates/web/base/admin/user-form.html b/templates/web/base/admin/user-form.html index dbd554b1e..9a2c0b9e2 100644 --- a/templates/web/base/admin/user-form.html +++ b/templates/web/base/admin/user-form.html @@ -18,8 +18,26 @@ </li> <li><label for="email">[% loc('Email:') %]</label> <input type='text' class="form-control" id='email' name='email' value='[% user.email | html %]'></li> + [% IF c.config.SMS_AUTHENTICATION %] + <li><label class="inline" for="email_verified">[% loc('Email verified:') %]</label> + <input type="checkbox" id="email_verified" name="email_verified" value="1" [% user.email_verified ? ' checked' : '' %]> + [% ELSE %] + <input type="hidden" name="email_verified" value="1"> + [% END %] <li><label for="phone">[% loc('Phone:') %]</label> <input type='text' class="form-control" id='phone' name='phone' value='[% user.phone | html %]'></li> + [% IF c.config.SMS_AUTHENTICATION %] + <li><label class="inline" for="phone_verified">[% loc('Phone verified:') %]</label> + <input type="checkbox" id="phone_verified" name="phone_verified" value="1" [% user.phone_verified ? ' checked' : '' %]> + [% ELSE %] + <input type="hidden" name="phone_verified" value="0"> + [% END %] + + [% IF username_in_abuse %] + <li> + <p class="error">[% loc('User in abuse table') %] <input name="unban" type="submit" value="[% loc('Unban') %]"></p> + </li> + [% END %] [% IF c.user.is_superuser || c.cobrand.moniker == 'zurich' %] <li> @@ -109,7 +127,7 @@ </div> [% IF c.user.is_superuser %] [% loc('Trusted by bodies:') %]<br /> - <select class="form-control" id='body' name='trusted_bodies' multiple> + <select class="form-control js-multiple" id='body' 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 %] diff --git a/templates/web/base/admin/users.html b/templates/web/base/admin/users.html index 8e35e1c31..6dfcf4204 100644 --- a/templates/web/base/admin/users.html +++ b/templates/web/base/admin/users.html @@ -29,7 +29,7 @@ [% IF user.is_superuser %] * [% END %] </td> [% IF c.cobrand.moniker != 'zurich' %] - <td>[% user.flagged == 2 ? loc('(Email in abuse table)') : user.flagged ? loc('Yes') : ' ' %]</td> + <td>[% user.flagged == 2 ? loc('User in abuse table') : user.flagged ? loc('Yes') : ' ' %]</td> [% END %] <td>[% IF user.id %]<a href="[% c.uri_for( 'user_edit', user.id ) %]">[% loc('Edit') %]</a>[% END %]</td> </tr> diff --git a/templates/web/base/alert/choose.html b/templates/web/base/alert/choose.html index 312b9f520..50835e90c 100644 --- a/templates/web/base/alert/choose.html +++ b/templates/web/base/alert/choose.html @@ -3,12 +3,13 @@ <h1>[% loc('Local RSS feeds and email alerts') %]</h1> [% IF possible_location_matches %] - <p>[% loc('We found more than one match for that location. We show up to ten matches, please try a different search if yours is not here.') %]</p> - <ul class="pc_alternatives plain-list"> + <p>[% loc('We found more than one match for that location.') %]</p> + <ul class="pc_alternatives"> [% FOREACH match IN possible_location_matches %] <li><a href="[% choose_target_uri %]?latitude=[% match.latitude | uri %];longitude=[% match.longitude | uri %]">[% match.address | html %]</a></li> [% END %] </ul> + <p>[% loc('We show up to ten matches, please try a different search if yours is not here.') %]</p> [% END %] [% INCLUDE 'footer.html' %] diff --git a/templates/web/base/alert/index.html b/templates/web/base/alert/index.html index acef89a78..1442e6bdc 100644 --- a/templates/web/base/alert/index.html +++ b/templates/web/base/alert/index.html @@ -1,4 +1,5 @@ -[% INCLUDE 'header.html', title = loc('Local RSS feeds and email alerts'), bodyclass = 'fullwidthpage' %] +[% SET bodyclass = 'alertpage fullwidthpage' %] +[% INCLUDE 'header.html', title = loc('Local RSS feeds and email alerts') %] <h1>[% loc('Local RSS feeds and email alerts') %]</h1> @@ -34,6 +35,7 @@ within a certain distance of a particular location.', "%s is the site name"), si <input class="green-btn" type="submit" value="[% loc('Go') %]"> </div> </fieldset> + <a href="/alert/list" id="geolocate_link">… [% loc('or locate me automatically') %]</a> </form> [% IF photos.size %] diff --git a/templates/web/base/around/_error_multiple.html b/templates/web/base/around/_error_multiple.html index b47a91ca9..751d81173 100644 --- a/templates/web/base/around/_error_multiple.html +++ b/templates/web/base/around/_error_multiple.html @@ -3,12 +3,13 @@ [% END %] [% IF possible_location_matches %] - <p>[% loc('We found more than one match for that location. We show up to ten matches, please try a different search if yours is not here.') %]</p> + <p>[% loc('We found more than one match for that location.') %]</p> <ul class="pc_alternatives"> [% FOREACH match IN possible_location_matches %] - <li><a href="/around?latitude=[% match.latitude | uri %];longitude=[% match.longitude | uri %]">[% match.address | html %]</a></li> + <li><a href="/around?latitude=[% match.latitude | uri %];longitude=[% match.longitude | uri %][% IF c.req.params.category %];category=[% c.req.params.category | uri %][% END %]">[% match.address | html %]</a></li> [% END %] </ul> + <p>[% loc('We show up to ten matches, please try a different search if yours is not here.') %]</p> [% END %] [% IF partial_token %] diff --git a/templates/web/base/around/_updates.html b/templates/web/base/around/_updates.html index 458983e8f..6121b218b 100755 --- a/templates/web/base/around/_updates.html +++ b/templates/web/base/around/_updates.html @@ -1,5 +1,5 @@ <div class="shadow-wrap"> - <ul id="key-tools" class="singleton"> + <ul id="key-tools"> <li><a class="feed" id="key-tool-around-updates" href="[% email_url | html %]">[% loc("Get updates") %]</a></li> </ul> </div> diff --git a/templates/web/base/around/display_location.html b/templates/web/base/around/display_location.html index 3ed16d3d3..029435cf2 100755 --- a/templates/web/base/around/display_location.html +++ b/templates/web/base/around/display_location.html @@ -54,6 +54,12 @@ [% map_html %] + [% 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> + [% ELSE %] + <a class="big-hide-pins-link" rel='nofollow' href="[% c.uri_with( { no_pins => 1 } ) %]">[% loc('Hide pins') %]</a> + [% END %] + <p id='sub_map_links'> [% map_sub_links %] [% IF c.req.params.no_pins %] @@ -61,14 +67,6 @@ [% ELSE %] <a id='hide_pins_link' rel='nofollow' href="[% c.uri_with( { no_pins => 1 } ) %]">[% loc('Hide pins') %]</a> [% END %] - [% IF c.cobrand.country == 'GB' || c.cobrand.country == 'NO' %] - <span class="hidden">|</span> - [% IF c.req.params.all_pins %] - <a id='all_pins_link' rel='nofollow' href="[% c.uri_with( { no_pins => undef, all_pins => undef } ) %]">[% loc('Hide old') %]</a> - [% ELSE %] - <a id='all_pins_link' rel='nofollow' href="[% c.uri_with( { no_pins => undef, all_pins => 1 } ) %]">[% loc('Show old') %]</a> - [% END %] - [% END %] </p> <div class="mobile-map-banner"> diff --git a/templates/web/base/around/index.html b/templates/web/base/around/index.html index f2be5575c..8f6af6225 100644 --- a/templates/web/base/around/index.html +++ b/templates/web/base/around/index.html @@ -1,5 +1,6 @@ [% pre_container_extra = INCLUDE 'around/postcode_form.html' %] -[% INCLUDE 'header.html', title = loc('Reporting a problem'), bodyclass = 'frontpage fullwidthpage' %] +[% SET bodyclass = 'frontpage fullwidthpage' ~%] +[% INCLUDE 'header.html', title = loc('Reporting a problem') %] [% # NOTE ON PARTIAL REPORTS: diff --git a/templates/web/base/around/lookup_by_ref.html b/templates/web/base/around/lookup_by_ref.html index aded05638..747354c1e 100644 --- a/templates/web/base/around/lookup_by_ref.html +++ b/templates/web/base/around/lookup_by_ref.html @@ -1,7 +1,8 @@ [% pre_container_extra = INCLUDE 'around/postcode_form.html', pc = ref %] -[% INCLUDE 'header.html', title = loc('Reporting a problem'), bodyclass = 'frontpage fullwidthpage' %] +[% SET bodyclass = 'frontpage fullwidthpage' ~%] +[% INCLUDE 'header.html', title = loc('Reporting a problem') %] -<div class="tablewrapper"> +[% IF matching_reports %] <p>[% loc('We found more than one match for that problem reference:') %]</p> <ul class="pc_alternatives"> [% FOREACH report IN matching_reports %] @@ -13,6 +14,8 @@ </li> [% END %] </ul> -</div> + [% ELSE %] + <p>[% loc('Searching found no reports.') %]</p> +[% END %] [% INCLUDE 'footer.html' %] diff --git a/templates/web/base/around/on_map_list_items.html b/templates/web/base/around/on_map_list_items.html index b7257030d..fafe7f433 100644 --- a/templates/web/base/around/on_map_list_items.html +++ b/templates/web/base/around/on_map_list_items.html @@ -1,14 +1,31 @@ -[% all_reports = on_map.merge(around_map) %] -[% IF all_reports.size %] - [% FOREACH problem IN all_reports %] - [% UNLESS problem.title; - dist = tprintf("%.1f", (problem.distance || 0) ); - problem = problem.problem; - END %] +<ul class="item-list item-list--reports"> +[% IF on_map.size %] + [% FOREACH problem IN on_map %] [% INCLUDE 'reports/_list-entry.html' %] [% END %] + [% IF around_map.size %] + <li class="item-list__item item-list__item--empty"> + <p>[% loc('Here are some other nearby reports:') %]</p> + </li> + [% END %] +[% ELSIF around_map.size %] + <li class="item-list__item item-list__item--empty"> + <p>[% loc('No reports to show on map, here are some nearby:') %]</p> + </li> [% ELSE %] <li class="item-list__item item-list__item--empty"> <p>[% loc('There are no reports to show.') %]</p> </li> [% END %] +</ul> + +[% IF around_map.size %] +<ul class="item-list item-list--reports"> + [% FOREACH problem IN around_map %] + [% dist = tprintf("%.1f", (problem.distance || 0) ); + problem = problem.problem; + %] + [% INCLUDE 'reports/_list-entry.html' %] + [% END %] +</ul> +[% END %] diff --git a/templates/web/base/around/postcode_form.html b/templates/web/base/around/postcode_form.html index 69c95d311..efb639eda 100644 --- a/templates/web/base/around/postcode_form.html +++ b/templates/web/base/around/postcode_form.html @@ -1,6 +1,8 @@ <div id="front-main"> <div id="front-main-container"> - [% INCLUDE 'around/intro.html' %] + [% UNLESS possible_location_matches %] + [% INCLUDE 'around/intro.html' %] + [% END %] [% question = c.cobrand.enter_postcode_text || loc('Enter a nearby street name and area'); @@ -21,5 +23,6 @@ <input type="hidden" name="filter_category" value="[% c.user.categories.join(",") | html %]"> [% END %] </form> + <a href="[% c.uri_for('/around') %]" id="geolocate_link">… [% loc('or locate me automatically') %]</a> </div> </div> diff --git a/templates/web/base/around/tabbed_lists.html b/templates/web/base/around/tabbed_lists.html index 5418ef914..f135684b9 100755 --- a/templates/web/base/around/tabbed_lists.html +++ b/templates/web/base/around/tabbed_lists.html @@ -1,5 +1,13 @@ [% INCLUDE "reports/_list-filters.html" %] -<ul id="js-reports-list" class="item-list item-list--reports"> +<div class="js-pagination"> +[% INCLUDE 'pagination.html' param = 'p' %] +</div> + +<div id="js-reports-list"> [% INCLUDE "around/on_map_list_items.html" %] -</ul> +</div> + +<div class="js-pagination"> +[% INCLUDE 'pagination.html' param = 'p' %] +</div> diff --git a/templates/web/base/auth/_username_error.html b/templates/web/base/auth/_username_error.html new file mode 100644 index 000000000..c0ddc135a --- /dev/null +++ b/templates/web/base/auth/_username_error.html @@ -0,0 +1,13 @@ +[% IF username_error; + # other keys include fqdn, mxcheck if you'd like to write a custom error message + errors = { + nonmobile = loc('Please enter a mobile number'), + sms_failed = tprintf(loc('Sending a confirmation text failed: "%s"'), sms_error), + missing_phone = loc('Please enter your phone number'), + other_phone = loc('Please check your phone number is correct'), + missing_email = loc('Please enter your email'), + other_email = loc('Please check your email address is correct') + }; + default = "other_$default"; + errors.$username_error || errors.$default; +END ~%] diff --git a/templates/web/base/auth/change_email.html b/templates/web/base/auth/change_email.html index a444b8c31..b3bec6b3e 100644 --- a/templates/web/base/auth/change_email.html +++ b/templates/web/base/auth/change_email.html @@ -1,33 +1,48 @@ -[% INCLUDE 'header.html', title = loc('Change email address'), bodyclass = 'authpage' %] - -<h1>[% loc('Change email address') %]</h1> - -[% IF c.req.args.0 == 'success' %] - <p class="form-success">[% loc('You have successfully confirmed your email address.') %]</p> -[% END %] - +[% +IF c.user.email_verified OR (c.user.email AND NOT verifying); + SET title = loc('Change email address'); +ELSIF c.user.email; + SET title = loc('Verify email address'); +ELSE; + SET title = loc('Add email address'); +END +-%] +[% INCLUDE 'header.html' bodyclass = 'authpage' %] + +<h1>[% title %]</h1> + +[% IF c.user.email_verified OR (c.user.email AND NOT verifying) %] [% loc('Your email address') %]: [% c.user.email %] +[% ELSIF c.user.email %] +[% DEFAULT username = c.user.email %] +[% END %] -<form action="[% c.uri_for('change_email') %]" method="post" name="change_email"> +<form method="post" name="change_email"> <input type="hidden" name="token" value="[% csrf_token %]"> <fieldset> - [% IF email_error; + [% IF username_error; errors = { - missing = loc('Please enter your email'), - other = loc('Please check your email address is correct') + missing_email = loc('Please enter your email'), + other_email = loc('Please check your email address is correct') }; - loc_email_error = errors.$email_error || errors.other; + loc_username_error = errors.$username_error || errors.other_email; %] - <div class="form-error">[% loc_email_error %]</div> + <div class="form-error">[% loc_username_error %]</div> [% END %] <div class="form-field"> - <label for="email">[% loc('New email address:') %]</label> - <input class="form-control" type="email" name="email" id="email" value="[% email | html %]"> + <label for="email"> + [% IF NOT c.user.email_verified AND c.user.email AND verifying %] + [% loc('Email address') %]: + [% ELSE %] + [% loc('New email address:') %] + [% END %] + </label> + <input class="form-control" type="email" name="email" id="email" value="[% username | html %]"> </div> <div class="final-submit"> - <input type="submit" class="btn" value="[% loc('Change email address') %]"> + <input type="submit" class="btn" value="[% title %]"> </div> </fieldset> diff --git a/templates/web/base/auth/change_password.html b/templates/web/base/auth/change_password.html index 094d131eb..a32dbaf9c 100644 --- a/templates/web/base/auth/change_password.html +++ b/templates/web/base/auth/change_password.html @@ -15,7 +15,7 @@ INCLUDE 'header.html', title = loc('Change password'), bodyclass = bclass <h1>[% loc('Change password') %]</h1> -<form action="[% c.uri_for('change_password') %]" method="post" name="change_password" class="fieldset"> +<form action="[% c.uri_for_action('/auth/profile/change_password') %]" method="post" name="change_password" class="fieldset"> <input type="hidden" name="token" value="[% csrf_token %]"> <fieldset> diff --git a/templates/web/base/auth/change_phone.html b/templates/web/base/auth/change_phone.html new file mode 100644 index 000000000..27a2f63dd --- /dev/null +++ b/templates/web/base/auth/change_phone.html @@ -0,0 +1,51 @@ +[% +IF c.user.phone_verified OR (c.user.phone AND NOT verifying); + SET title = loc('Change phone number'); +ELSIF c.user.phone; + SET title = loc('Verify phone number'); +ELSE; + SET title = loc('Add phone number'); +END +-%] +[% INCLUDE 'header.html' bodyclass = 'authpage' %] + +<h1>[% title %]</h1> + +[% IF c.req.args.0 == 'success' %] + <p class="form-success">[% loc('You have successfully confirmed your phone number.') %]</p> +[% END %] + +[% IF c.user.phone_verified OR (c.user.phone AND NOT verifying) %] +[% loc('Your phone number') %]: [% c.user.phone_display %] +[% ELSIF c.user.phone %] +[% DEFAULT username = c.user.phone %] +[% END %] + +<form method="post" name="change_phone"> + <input type="hidden" name="token" value="[% csrf_token %]"> + + <fieldset> + [% loc_username_error = INCLUDE 'auth/_username_error.html' default='phone' %] + [% IF loc_username_error %] + <div class="form-error">[% loc_username_error %]</div> + [% END %] + + <div class="form-field"> + <label for="phone"> + [% IF NOT c.user.phone_verified AND c.user.phone AND verifying %] + [% loc('Phone number') %]: + [% ELSE %] + [% loc('New phone number:') %] + [% END %] + </label> + <input class="form-control" type="tel" name="username" id="phone" value="[% username | html %]"> + </div> + <div class="final-submit"> + <input type="submit" class="btn" value="[% title %]"> + </div> + + </fieldset> +</form> + + +[% INCLUDE 'footer.html' %] diff --git a/templates/web/base/auth/general.html b/templates/web/base/auth/general.html index 2a8bea402..8fc5578c1 100644 --- a/templates/web/base/auth/general.html +++ b/templates/web/base/auth/general.html @@ -11,12 +11,12 @@ <p class="form-error">[% loc('Sorry, we could not log you in. Please fill in the form below.') %]</p> [% END %] -<form action="[% c.uri_for() %]" method="post" name="general_auth" class="validate"> +<form action="/auth" method="post" name="general_auth" class="validate"> <fieldset> <input type="hidden" name="r" value="[% c.req.params.r | html %]"> -[% IF NOT oauth_need_email AND (c.config.FACEBOOK_APP_ID OR c.config.TWITTER_KEY) %] +[% 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"> @@ -36,25 +36,22 @@ <div id="js-social-email-hide"> [% END %] - [% IF email_error; + [% loc_username_error = INCLUDE 'auth/_username_error.html' default='email' %] - # other keys include fqdn, mxcheck if you'd like to write a custom error message - - errors = { - missing => loc('Please enter your email'), - other => loc('Please check your email address is correct') - }; - - loc_email_error = errors.$email_error || errors.other; - 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="email">[% loc('Email') %]</label> - [% IF loc_email_error %] - <div class="form-error">[% loc_email_error %]</div> + <label class="n" for="username">[% username_label %]</label> + [% IF loc_username_error %] + <div class="form-error">[% loc_username_error %]</div> [% ELSIF sign_in_error %] - <div class="form-error">[% loc('There was a problem with your email/password combination. If you cannot remember your password, or do not have one, please fill in the ‘sign in by email’ section of the form.') %]</div> + <div class="form-error">[% loc('There was a problem with your login information. If you cannot remember your password, or do not have one, please fill in the ‘No’ section of the form.') %]</div> [% END %] - <input type="email" class="form-control required email" id="email" name="email" value="[% email | html %]" placeholder="[% loc('Your email address') %]" autofocus> + <input type="text" class="form-control required" id="username" name="username" value="[% username | html %]" + [%~ IF c.cobrand.moniker != 'borsetshire' %] autofocus[% END %]> <div id="form_sign_in"> <h3>[% tprintf(loc("Do you have a %s password?", "%s is the site name"), site_name) %]</h3> @@ -68,7 +65,7 @@ [% END %] </div> -[% IF NOT oauth_need_email AND (c.config.FACEBOOK_APP_ID OR c.config.TWITTER_KEY) %] +[% IF NOT oauth_need_email AND c.cobrand.social_auth_enabled %] </div> [% END %] @@ -85,7 +82,7 @@ <div class="form-txt-submit-box"> <input type="password" name="password_sign_in" class="form-control" id="password_sign_in" value="" placeholder="[% loc('Your password') %]"> - <input class="green-btn" type="submit" name="sign_in" value="[% loc('Sign in') %]"> + <input class="green-btn" type="submit" name="sign_in_by_password" value="[% loc('Sign in') %]"> </div> <div class="checkbox-group"> @@ -95,7 +92,11 @@ <div class="general-notes"> <p><strong>[% loc('Forgotten your password?') %]</strong> + [% 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> + [% END %] </div> </div> @@ -103,7 +104,11 @@ [% BLOCK form_sign_in_no %] <div id="form_sign_in_no" class="form-box"> + [% IF c.config.SMS_AUTHENTICATION %] + <h5>[% loc('<strong>No</strong> let me sign in by email or text') %]</h5> + [% ELSE %] <h5>[% loc('<strong>No</strong> let me sign in by email') %]</h5> + [% END %] <label for="name">[% loc('Name') %]</label> <input class="form-control" type="text" name="name" value="" placeholder="[% loc('Your name') %]"> @@ -116,7 +121,7 @@ <div class="form-txt-submit-box"> <input class="form-control" type="password" name="password_register" id="password_register" value="" placeholder="[% loc('Enter a password') %]"> - <input class="green-btn" type="submit" name="email_sign_in" value="[% loc('Sign in') %]"> + <input class="green-btn" type="submit" name="sign_in_by_code" value="[% loc('Sign in') %]"> </div> </div> [% END %] diff --git a/templates/web/base/auth/generate_token.html b/templates/web/base/auth/generate_token.html new file mode 100644 index 000000000..157335047 --- /dev/null +++ b/templates/web/base/auth/generate_token.html @@ -0,0 +1,44 @@ +[% +INCLUDE 'header.html', title = loc('Generate token'), bodyclass = 'fullwidthpage' +%] + +[% IF token_generated %] + + <div class="confirmation-header"> + <h1>[% loc('Your token has been generated') %]</h1> + + <p> + <strong>[% loc('Token:') %]</strong> + <span>[% existing_token | html %]</span> + </p> + + <p><a href="/my">[% loc('Your account') %]</a></p> + </div> + +[% ELSE %] + +<h1>[% loc('Generate token') %]</h1> + +<form action="[% c.uri_for_action('/auth/profile/generate_token') %]" method="post" name="generate_token"> + <input type="hidden" name="token" value="[% csrf_token %]"> + + [% IF existing_token %] + <p> + <strong>[% loc('Current token:') %]</strong> + <span>[% existing_token | html %]</span> + </p> + [% END %] + + <p> + <input name="generate_token" type="submit" class="btn" value="[% existing_token ? loc('Replace token') : loc('Generate token') %]"> + </p> +</form> + +[% IF existing_token %] + <p> + [% loc('If you generate a new token the existing token will no longer work.') %] + </p> +[% END %] +[% END %] + +[% INCLUDE 'footer.html' %] diff --git a/templates/web/base/auth/smsform.html b/templates/web/base/auth/smsform.html new file mode 100644 index 000000000..a475dd2f6 --- /dev/null +++ b/templates/web/base/auth/smsform.html @@ -0,0 +1,34 @@ +[% INCLUDE 'header.html', bodyclass = 'fullwidthpage', title = loc('Confirm account') %] + +[% IF token_not_found %] + + <div class="confirmation-header confirmation-header--failure"> + <h1>[% loc('Sorry, that wasn’t a valid link') %]</h1> + <p>[% loc('The link might have expired, or maybe you didn’t quite copy and paste it correctly.') %]</p> + </div> + +[% ELSE %] + +[% DEFAULT submit_url = '/auth/phone' %] + + <div class="confirmation-header confirmation-header--phone"> + [% IF incorrect_code %] + <h1>[% loc('Sorry, that wasn’t the correct code') %]</h1> + <p>[% loc('Try again') %]:</p> + [% ELSE %] + <h1>[% loc("Nearly done! Now check your phone…") %]</h1> + <p>[% loc("We have sent a confirmation code to your phone. Please enter it below:") %]</p> + [% END %] + <form action="[% submit_url %]" method="post"> + <input type="hidden" name="token" value="[% token | html %]"> + <label for="code">[% loc('Code') %]</label> + <div class="form-txt-submit-box"> + <input class="form-control" type="number" id="code" name="code" value="" required> + <input type="submit" value="[% loc('Submit') %]" class="btn-primary"> + </div> + </form> + </div> + +[% END %] + +[% INCLUDE 'footer.html' %] diff --git a/templates/web/base/common_footer_tags.html b/templates/web/base/common_footer_tags.html index 915751802..a5be06df5 100644 --- a/templates/web/base/common_footer_tags.html +++ b/templates/web/base/common_footer_tags.html @@ -5,8 +5,13 @@ <!--[if lte IE 9]> <script src="[% version('/vendor/history.polyfill.min.js') %]"></script> <![endif]--> -[% FOR script IN scripts ~%] - [% script = script.0 ? script : [ script ] ~%] +[% +scripts_seen = {}; +FOR script IN scripts; + script = script.0 ? script : [ script ]; + NEXT IF scripts_seen.${script.0}; + scripts_seen.${script.0} = 1; + ~%] <script src="[% script.0 %]" [%~ FOR attr IN script.1 %] [% attr.key %]="[% attr.value %]"[% END ~%] ></script> diff --git a/templates/web/base/common_header_tags.html b/templates/web/base/common_header_tags.html index e5a4d25f2..749a4f740 100644 --- a/templates/web/base/common_header_tags.html +++ b/templates/web/base/common_header_tags.html @@ -1,7 +1,5 @@ [% SET start = c.config.ADMIN_BASE_URL IF admin %] -<link rel="stylesheet" href="[% version('/vendor/OpenLayers/theme/default/style.css') %]"> - <meta http-equiv="content-type" content="text/html; charset=utf-8" id="js-meta-data" data-page="[% page %]" data-cobrand="[% c.cobrand.moniker %]"> @@ -19,10 +17,6 @@ (function(b){var a=b.documentElement;a.className=a.className.replace(/\bno-js\b/,"js");var c=-1<a.className.indexOf("iel8"),c=Modernizr.mq("(min-width: 48em)")||c?"desktop":"mobile";b=b.getElementById("js-meta-data");fixmystreet.page=b.getAttribute("data-page");fixmystreet.cobrand=b.getAttribute("data-cobrand");"mobile"==c&&(a.className+=" mobile","around"==fixmystreet.page&&(a.className+=" map-fullscreen only-map map-reporting"))})(document); </script> -[% IF admin %] - <link rel="stylesheet" href="[% version('/vendor/jquery-ui/css/smoothness/jquery-ui-1.10.3.custom.min.css') %]"> -[% END %] - [% IF robots %] <meta name="robots" content="[% robots %]"> [% ELSIF c.config.STAGING_SITE %] @@ -35,3 +29,21 @@ [% "$title :: " | html IF title %] [% site_name -%] </title> + +[% IF bodyclass.match('frontpage') %] + <link rel="prefetch" href="[% version('/js/validation_rules.js') %]"> + [%~ IF NOT c.user_exists OR NOT (c.user.from_body OR c.user.is_superuser) %] + <link rel="prefetch" href="[% version('/jslib/jquery-1.7.2.min.js') %]"> + [%~ END %] + <link rel="prefetch" href="[% version('/vendor/jquery.multi-select.min.js') %]"> + <link rel="prefetch" href="[% version('/vendor/jquery.validate.min.js') %]"> + <link rel="prefetch" href="[% version('/cobrands/fixmystreet/fixmystreet.js') %]"> +[% END %] +[% IF NOT bodyclass.match('mappage') %] + [% FOR script IN map_js %] + <link rel="prefetch" href="[% IF script.match('^/'); version(script); ELSE; script; END %]"> + [% END %] + <link rel="prefetch" href="[% version('/cobrands/fixmystreet/map.js') %]"> + <link rel="prefetch" href="[% version('/vendor/dropzone.min.js') %]"> + <link rel="prefetch" href="[% version('/vendor/fancybox/jquery.fancybox-1.3.4.pack.js') %]"> +[% END %] diff --git a/templates/web/base/common_scripts.html b/templates/web/base/common_scripts.html index 474edc46e..cf9692128 100644 --- a/templates/web/base/common_scripts.html +++ b/templates/web/base/common_scripts.html @@ -7,39 +7,67 @@ scripts = []; scripts.push( start _ "/js/translation_strings." _ lang_code _ ".js?" _ Math.int( date.now / 3600 ), - version('/jslib/jquery-1.7.2.min.js'), - version('/js/validation_rules.js'), - version('/vendor/jquery.validate.min.js'), - version('/vendor/dropzone.min.js'), - version('/js/jquery.multi-select.js'), - version('/vendor/geo.min.js'), - version('/cobrands/fixmystreet/fixmystreet.js'), ); -IF c.user_exists AND (c.user.from_body OR c.user.is_superuser); +IF bodyclass.match('frontpage'); scripts.push( - version('/cobrands/fixmystreet/staff.js') + version('/js/front.js'), + version('/js/geolocation.js'), + ); +ELSIF bodyclass.match('alertpage'); + scripts.push( + version('/js/geolocation.js'), + ); +ELSE; + scripts.push( + version('/js/validation_rules.js'), + version('/jslib/jquery-1.7.2.min.js'), + version('/vendor/jquery.multi-select.min.js'), + version('/vendor/jquery.validate.min.js'), + version('/cobrands/fixmystreet/fixmystreet.js'), ); END; -FOR script IN map_js; +FOR script IN extra_js; scripts.push(script); END; -scripts.push( - version('/cobrands/fixmystreet/map.js'), - version('/cobrands/fixmystreet/offline.js'), -); +IF c.user_exists AND (c.user.from_body OR c.user.is_superuser); + scripts.push( + version('/js/geolocation.js'), + version('/jslib/jquery-1.7.2.min.js'), + version('/cobrands/fixmystreet/staff.js') + ); + IF c.user.has_body_permission_to('planned_reports'); + scripts.push( + version('/cobrands/fixmystreet/offline.js'), + ); + END; +END; -IF admin; +IF bodyclass.match('mappage'); + FOR script IN map_js; + IF script.match('^/'); + scripts.push(version(script)); + ELSE; + scripts.push(script); + END; + END; scripts.push( - version('/vendor/jquery-ui/js/jquery-ui-1.10.3.custom.min.js'), - version('/cobrands/fixmystreet/admin.js'), + version('/cobrands/fixmystreet/map.js'), + version('/vendor/dropzone.min.js'), + version('/vendor/fancybox/jquery.fancybox-1.3.4.pack.js'), + ); +ELSE; + scripts.push( + version('/cobrands/fixmystreet/prefetch-polyfill.js'), ); END; -FOR script IN extra_js; - scripts.push(script); +IF admin; + scripts.push( + version('/cobrands/fixmystreet/admin.js'), + ); END; TRY; diff --git a/templates/web/base/dashboard/index.html b/templates/web/base/dashboard/index.html index e47798573..c6902556a 100644 --- a/templates/web/base/dashboard/index.html +++ b/templates/web/base/dashboard/index.html @@ -1,3 +1,5 @@ +[% USE Number.Format %] + [% extra_css = BLOCK %] <link rel="stylesheet" href="[% version('/cobrands/fixmystreet/dashboard.css') %]"> [% END %] @@ -11,160 +13,155 @@ <form> +[% IF body %] <hgroup> - [% tprintf(loc('<h2>Reports, Statistics and Actions for</h2> <h1>%s</h1>'), council.name) %] + [% tprintf(loc('<h2>Reports, Statistics and Actions for</h2> <h1>%s</h1>'), body_name) %] </hgroup> +[% ELSE %] +<h1>[% loc('Summary statistics') %]</h1> +[% END %] <div class="filters"> + [% IF body %] + <input type="hidden" name="body" value="[% body.id | html %]"> + [% IF NOT c.user.area_id %] <p> <label for="ward">[% loc('Ward:') %]</label> - <select class="form-control" name="ward"><option value=''>[% loc('All') %]</option> + <select class="form-control" name="ward" id="ward"><option value=''>[% loc('All') %]</option> [% FOR w IN children.values.sort('name') %] <option value="[% w.id %]"[% ' selected' IF w.id == ward %]>[% w.name %]</option> [% END %] </select> </p> + [% END %] <p> <label for="category">[% loc('Category:') %]</label> - <select class="form-control" name="category"><option value=''>[% loc('All') %]</option> - [% FOR cat_op IN category_options %] - <option value='[% cat_op.name | html %]'[% ' selected' IF category == cat_op.name %]>[% cat_op.value | html %]</option> + <select class="form-control" name="category" id="category"><option value=''>[% loc('All') %]</option> + [% FOR cat IN contacts %] + <option value='[% cat.category | html %]'[% ' selected' IF category == cat.category %]>[% cat.category_display | html %]</option> [% END %] </select> </p> + [% ELSE %] + <p> - <input type="submit" class="btn" value="[% loc('Look up') %]"> + <label for="ward">[% loc('Council:') %]</label> + <select class="form-control" name="body" id="body"><option value=''>[% loc('All') %]</option> + [% FOR b IN bodies %] + <option value="[% b.id %]">[% b.name %]</option> + [% END %] + </select> </p> - <br clear="all" /> -</div> - + [% END %] -<table width="100%" id="overview"> - <tr> - <th> </th> - <th scope="col"><abbr title="[% loc('Week To Date') %]">[% loc('WTD', "Week to date") %]</abbr></th> - <th scope="col">[% loc('Last 7 days') %]</th> - <th scope="col">[% loc('Last 4 weeks') %]</th> - <th scope="col">[% loc('YTD', "Year to date") %]</th> - </tr> - - [% - rows = { - '0' => [ "total", loc("Total reports received") ] - '1' => [ "fixed - council", loc("Council has marked as fixed") ] - '2' => [ "fixed_user", loc("User has marked as fixed") ] - }; - FOR row IN rows %] - <tr id="[% row.value.0.replace('[^\w]+', '_' ) %]"> - <th scope="row">[% row.value.1 %]</th> - <td>[% problems.wtd.${row.value.0} %]</td> - <td>[% problems.week.${row.value.0} %]</td> - <td>[% problems.weeks.${row.value.0} %]</td> - <td>[% problems.ytd.${row.value.0} %]</td> - </tr> - [% END %] - - <tr class='subtotal' id="total_fixed"> - <th scope="row">[% loc('Total marked as fixed') %]</th> - <td>[% problems.wtd.${"fixed - council"} + problems.wtd.fixed_user %]</td> - <td>[% problems.week.${"fixed - council"} + problems.week.fixed_user %]</td> - <td>[% problems.weeks.${"fixed - council"} + problems.weeks.fixed_user %]</td> - <td>[% problems.ytd.${"fixed - council"} + problems.ytd.fixed_user %]</td> - </tr> - - [% - rows = { - '0' => [ "in progress", loc("Council has marked as in progress") ] - '1' => [ "action scheduled", loc("Council has marked as planned") ] - '2' => [ "investigating", loc("Council has marked as investigating") ] - '3' => [ "closed", loc("Council has marked as closed") ] - }; - wtd = 0, week = 0, weeks = 0, ytd = 0; - FOR row IN rows %] - <tr id="[% row.value.0.replace('[^\w]+', '_' ) %]"> - <th scope="row">[% row.value.1 %]</th> - <td>[% problems.wtd.${row.value.0} %]</td> - <td>[% problems.week.${row.value.0} %]</td> - <td>[% problems.weeks.${row.value.0} %]</td> - <td>[% problems.ytd.${row.value.0} %]</td> - </tr> - [% END %] - - <tr class='subtotal' id="marked"> - <th scope="row">[% loc('Total marked') %]</th> - <td>[% problems.wtd.${"in progress"} + problems.wtd.${"action scheduled"} + - problems.wtd.investigating + problems.wtd.closed %]</td> - <td>[% problems.week.${"in progress"} + problems.week.${"action scheduled"} + - problems.week.investigating + problems.wtd.closed %]</td> - <td>[% problems.weeks.${"in progress"} + problems.weeks.${"action scheduled"} + - problems.weeks.investigating + problems.wtd.closed %]</td> - <td>[% problems.ytd.${"in progress"} + problems.ytd.${"action scheduled"} + - problems.ytd.investigating + problems.wtd.closed %]</td> - </tr> - - <tr id="avg_fixed"> - <th scope="row">[% loc('Average time to council marking fixed (days)') %]</th> - <td>[% problems.wtd.time_to_fix %]</td> - <td>[% problems.week.time_to_fix %]</td> - <td>[% problems.weeks.time_to_fix %]</td> - <td>[% problems.ytd.time_to_fix %]</td> - </tr> - - <tr id="avg_marked"> - <th scope="row">[% loc('Average time to first council state change (days)') %]</th> - <td>[% problems.wtd.time_to_mark %]</td> - <td>[% problems.week.time_to_mark %]</td> - <td>[% problems.weeks.time_to_mark %]</td> - <td>[% problems.ytd.time_to_mark %]</td> - </tr> + <p> + <label for="state">[% loc('Report state:') %]</label> + <select class="form-control" name="state" id="state"> + <option value=''>[% loc('All') %]</option> + [% FOR group IN filter_states %] + [% FOR state IN group.1 %] + [% NEXT IF state == 'hidden' %] + <option [% 'selected ' IF state == q_state %] value="[% state %]">[% prettify_state(state, 1) %]</option> + [% END %] + [% END %] + </select> + </p> + <p> + <label for="start_date">[% loc('Start Date') %]</label> + <input name="start_date" id="start_date" type="date" value="[% start_date | html %]" class="form-control"> + </p> + <p> + <label for="end_date">[% loc('End Date') %]</label> + <input name="end_date" id="end_date" type="date" value="[% end_date | html %]" class="form-control"> + </p> + <p class="no-label"> + <input type="submit" class="btn" value="[% loc('Look up') %]"> + </p> +</div> - <tr class='subtotal' id="not_marked"> - <th scope="row">[% loc('Total not marked') %]</th> - <td>[% problems.wtd.not_marked %]</td> - <td>[% problems.week.not_marked %]</td> - <td>[% problems.weeks.not_marked %]</td> - <td>[% problems.ytd.not_marked %]</td> - </tr> +<input type="hidden" name="group_by" value="[% group_by | html %]"> -</table> +</form> -<h2>[% loc('Reports') %]</h2> +[% BLOCK gb %] + [% IF group_by == new_gb %] + <strong title="[% tprintf(loc('Currently grouped by %s'), text) %]">[% text %]</strong> + [% ELSE %] + <a href="[% c.uri_with({ group_by => new_gb }) %]" title="[% tprintf(loc('Group by %s'), text) %]">[% text %]</a> + [% END %] +[% END %] - </select> -<p>[% loc('Report state:') %] <select class="form-control" name="state"> -<option value=''>[% loc('All') %]</option> - [% FOR group IN filter_states %] - [% FOR state IN group.1 %] - [% NEXT IF state == 'hidden' %] - <option [% 'selected ' IF state == q_state %] value="[% state %]">[% prettify_state(state, 1) %]</option> - [% END %] - [% END %] -</select> -<input type="submit" class="btn" value="[% loc('Look up') %]"> -<a class="export_as_csv" href="[% c.req.uri_with({ export => 1 }) %]">[% loc('Export as CSV') %]</a> +<ul class="dashboard-options-tabs"> + <li role="presentation"><span>[% loc('Group by:') %]</span><li> + <li>[% INCLUDE gb new_gb='category' text=loc('Category') %]</li> + <li>[% INCLUDE gb new_gb='state' text=loc('State') %]</li> + <li>[% INCLUDE gb new_gb='month' text=loc('Month') %]</li> + <li>[% INCLUDE gb new_gb='category+state' text=loc('Category and State') %]</li> + <li>[% INCLUDE gb new_gb='device+site' text=loc('Device and Site') %]</li> + <li class="pull-right"><a href="[% c.uri_with({ csv => 1 }) %]">[% loc('Export as CSV') %]</a></li> +</ul> -<table width="100%" id="reports"> +<table width="100%" id="overview"> <tr> - <th scope="col">[% loc('Less than 7 days old') %]</th> - <th scope="col">[% loc('7-14 days old') %]</th> - <th scope="col">[% loc('14-30 days old') %]</th> + <th></th> + [% IF group_by == 'category+state' %] + <th scope="col">[% loc('Open') %]</th> + <th scope="col">[% loc('Closed') %]</th> + <th scope="col">[% loc('Fixed') %]</th> + <th scope="col">[% loc('Total') %]</th> + [% ELSE %] + [% FOR k2 IN columns.sort %] + <th scope="col">[% k2 or loc('Website') %]</td> + [% END %] + <th scope="col">[% loc('Total') %]</th> + [% END %] </tr> + [% FOR k IN rows %] <tr> - <td width="34%"><ul>[% INCLUDE list, list = lists.1 %]</ul></td> - <td width="33%"><ul>[% INCLUDE list, list = lists.2 %]</ul></td> - <td width="33%"><ul>[% INCLUDE list, list = lists.3 %]</ul></td> + [% IF group_by == 'state' %] + <th scope="row">[% prettify_state(k) %]</th> + [% ELSE %] + <th scope="row">[% k %]</th> + [% END %] + [% IF group_by == 'category+state' %] + <td>[% grouped.$k.open OR 0 %]</td> + <td>[% grouped.$k.closed OR 0 %]</td> + <td>[% grouped.$k.fixed OR 0 %]</td> + <td>[% grouped.$k.total OR 0 %]</td> + [% ELSE %] + [% FOR k2 IN columns.sort %] + <td>[% grouped.$k.$k2 OR 0 %]</td> + [% END %] + <td>[% grouped.$k.total OR 0 %]</td> + [% END %] + </tr> + [% END %] + <tr class="subtotal"> + <th scope="row">[% loc('Total') %]</th> + [% IF group_by == 'category+state' %] + <td>[% totals.open OR 0 %]</td> + <td>[% totals.closed OR 0 %]</td> + <td>[% totals.fixed OR 0 %]</td> + [% ELSE %] + [% FOR k2 IN columns.sort %] + <td>[% totals.$k2 OR 0 %]</td> + [% END %] + [% END %] + <td>[% totals.total OR 0 %]</td> </tr> </table> -</form> +<p> +[% loc('Within the specified timeframe:') %] +[% +summary_open = summary_open | format_number; +summary_closed = summary_closed | format_number; +summary_fixed = summary_fixed | format_number; +tprintf( loc('%s opened, %s closed, %s fixed'), + decode(summary_open), decode(summary_closed), decode(summary_fixed) ) %] +</p> [% INCLUDE 'footer.html' %] - -[% BLOCK list %] -[% FOR p IN list %] -<li><a href="/report/[% p.id %]">[% p.title | html %]</a> <date>[% p.confirmed.dmy('/') %]</date></li> -[% END %] -[% END %] diff --git a/templates/web/base/front/javascript.html b/templates/web/base/front/javascript.html deleted file mode 100644 index 69eb626f7..000000000 --- a/templates/web/base/front/javascript.html +++ /dev/null @@ -1,12 +0,0 @@ -[% -# Assume using OpenStreetMap maps -map_js = [ - version('/vendor/yepnope.js'), - [ version('/cobrands/fixmystreet/front.js'), { - id = 'script_front', - 'data-scripts' = version('/vendor/OpenLayers/OpenLayers.fixmystreet.js') _ ',' _ - version('/js/map-OpenLayers.js') _ ',' _ - version('/js/map-OpenStreetMap.js') - } ], -] -%] diff --git a/templates/web/base/header.html b/templates/web/base/header.html index 4e537a7ec..3cc166a32 100644 --- a/templates/web/base/header.html +++ b/templates/web/base/header.html @@ -19,25 +19,16 @@ <meta name="mobileoptimized" content="0"> [% INCLUDE 'header_opengraph.html' %] - <link rel="stylesheet" href="[% version('/cobrands/' _ c.cobrand.asset_moniker _ '/base.css') %]"> - <link rel="stylesheet" href="[% version('/cobrands/' _ c.cobrand.asset_moniker _ '/layout.css') %]" media="(min-width:48em)"> - [% extra_css %] - <!--[if (lt IE 9) & (!IEMobile)]> - <link rel="stylesheet" href="[% version('/cobrands/' _ c.cobrand.asset_moniker _ '/layout.css') %]"> - <![endif]--> - + [% INCLUDE 'header/css.html' %] [% INCLUDE 'common_header_tags.html' %] - - [% IF c.req.uri.host == 'osm.fixmystreet.com' %] - <link rel="canonical" href="https://www.fixmystreet.com[% c.req.uri.path_query %]"> - [% END %] - [% TRY %][% PROCESS 'header_extra.html' %][% CATCH file %][% END %] </head> [% TRY %][% PROCESS 'set_body_class.html' %][% CATCH file %][% END %] <body class="[% bodyclass | html IF bodyclass %]"> + [% TRY %][% PROCESS 'before_wrapper.html' %][% CATCH file %][% END %] + <div class="wrapper"> <div class="table-cell"> [% INCLUDE 'header_site.html' %] diff --git a/templates/web/base/header/css.html b/templates/web/base/header/css.html new file mode 100644 index 000000000..219369465 --- /dev/null +++ b/templates/web/base/header/css.html @@ -0,0 +1,11 @@ +[% SET base_css = version('/cobrands/' _ c.cobrand.asset_moniker _ '/base.css') %] +[% SET layout_css = version('/cobrands/' _ c.cobrand.asset_moniker _ '/layout.css') %] + +<link rel="stylesheet" href="[% base_css %]"> +<link rel="stylesheet" href="[% layout_css %]" media="screen and (min-width:48em)"> +<!--[if (lt IE 9) & (!IEMobile)]> + <link rel="stylesheet" href="[% layout_css %]"> +<![endif]--> +<link rel="stylesheet" href="[% version('/vendor/OpenLayers/theme/default/style.css') %]"> + +[% extra_css %] diff --git a/templates/web/base/index.html b/templates/web/base/index.html index 8cb127e6a..620c1a2be 100644 --- a/templates/web/base/index.html +++ b/templates/web/base/index.html @@ -1,7 +1,6 @@ -[% PROCESS 'front/javascript.html' %] - [% pre_container_extra = PROCESS 'around/postcode_form.html' %] -[% INCLUDE 'header.html', title = '', bodyclass = 'frontpage fullwidthpage' %] +[% SET bodyclass = 'frontpage fullwidthpage' %] +[% INCLUDE 'header.html', title = '', inline_css = 1 %] [% IF error %] <p class="form-error">[% error %]</p> diff --git a/templates/web/base/js/translation_strings.html b/templates/web/base/js/translation_strings.html index bc2f013ff..ed95335a6 100644 --- a/templates/web/base/js/translation_strings.html +++ b/templates/web/base/js/translation_strings.html @@ -1,3 +1,4 @@ +[% FILTER collapse %] translation_strings = { update: '[% loc('Please enter a message') | replace("'", "\\'") %]', title: '[% loc('Please enter a subject') | replace("'", "\\'") %]', @@ -24,7 +25,6 @@ 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("'", "\\'") %]', - geolocate: '[% loc('or locate me automatically') | replace("'", "\\'") %]', right_place: '[% loc('Right place?') | replace("'", "\\'") %]', try_again: '[% loc('Try again') | replace("'", "\\'") %]', place_pin_on_map: '[% loc('Place pin on map') | replace("'", "\\'") %]', @@ -59,7 +59,11 @@ 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("'", "\\'") %]', + [% IF c.config.SMS_AUTHENTICATION ~%] + login_with_email: '[% loc('Log in with email/text') | replace("'", "\\'") %]', + [% ELSE ~%] login_with_email: '[% loc('Log in with email') | replace("'", "\\'") %]', + [% END ~%] offline: { your_reports: '[% loc('Your offline reports') | replace("'", "\\'") %]', @@ -77,3 +81,4 @@ update_plural: '[% loc('updates') | replace("'", "\\'") %]' } }; +[% END %] diff --git a/templates/web/base/main_nav.html b/templates/web/base/main_nav.html index b8a3165a4..9736697e3 100644 --- a/templates/web/base/main_nav.html +++ b/templates/web/base/main_nav.html @@ -8,7 +8,7 @@ %] [% BLOCK navitem ~%] <li [% liattrs %]> - [%~ IF c.req.uri.path == uri ~%] + [%~ IF c.req.uri.path == uri AND NOT always_url ~%] <span [% attrs %]>[% label %]</span> [%~ ELSE ~%] <a href="[% base %][% uri %][% suffix IF suffix %]" [% attrs %]>[% label %]</a> diff --git a/templates/web/base/main_nav_items.html b/templates/web/base/main_nav_items.html index 845ef7c65..84657444e 100644 --- a/templates/web/base/main_nav_items.html +++ b/templates/web/base/main_nav_items.html @@ -7,7 +7,7 @@ [%~ END ~%] [%~ IF c.user_exists AND c.user.has_body_permission_to('planned_reports') ~%] - [%~ INCLUDE navitem uri='/my/planned' label=loc('Shortlist') ~%] + [%~ INCLUDE navitem always_url=1 uri='/my/planned' label=loc('Shortlist') ~%] [%~ END ~%] diff --git a/templates/web/base/maps/bing.html b/templates/web/base/maps/bing.html deleted file mode 100644 index df45eced5..000000000 --- a/templates/web/base/maps/bing.html +++ /dev/null @@ -1,8 +0,0 @@ -[% -map_js = [ - version('/vendor/OpenLayers/OpenLayers.fixmystreet.js'), - version('/js/map-OpenLayers.js'), - version('/js/map-bing-ol.js'), -]; -map_html = INCLUDE maps/openlayers.html -%] diff --git a/templates/web/base/maps/fms.html b/templates/web/base/maps/fms.html index ff5b4eab6..286ecc8ff 100644 --- a/templates/web/base/maps/fms.html +++ b/templates/web/base/maps/fms.html @@ -1,9 +1,3 @@ [% -map_js = [ - version('/vendor/OpenLayers/OpenLayers.fixmystreet.js'), - version('/js/map-OpenLayers.js'), - version('/js/map-bing-ol.js'), - version('/js/map-fms.js'), -]; map_html = INCLUDE maps/openlayers.html include_key = 1 %] diff --git a/templates/web/base/maps/google-ol.html b/templates/web/base/maps/google-ol.html index d88043403..3cd21fab3 100644 --- a/templates/web/base/maps/google-ol.html +++ b/templates/web/base/maps/google-ol.html @@ -1,17 +1,3 @@ -[% -google_maps_url = "https://maps.googleapis.com/maps/api/js?v=3"; -IF c.config.GOOGLE_MAPS_API_KEY; - google_maps_url = google_maps_url _ "&key=" _ c.config.GOOGLE_MAPS_API_KEY; -END; - -map_js = [ - google_maps_url, - version('/vendor/OpenLayers/OpenLayers.google.js'), - version('/js/map-OpenLayers.js'), - version('/js/map-google-ol.js'), -] -%] - [% map_sub_links = BLOCK %] <a class="hidden-nojs" id="map_layer_toggle" href="">[% loc('Satellite') %]</a> [% END %] diff --git a/templates/web/base/maps/google.html b/templates/web/base/maps/google.html index c86c757fb..e8c07b113 100644 --- a/templates/web/base/maps/google.html +++ b/templates/web/base/maps/google.html @@ -6,19 +6,12 @@ color: #000; } </style> -[% -map_js = [ - "http://maps.googleapis.com/maps/api/js?sensor=false", - version('/js/map-google.js'), -] -%] [% map_html = BLOCK %] <script nonce="[% csp_nonce %]"> var fixmystreet = fixmystreet || {}; $.extend(fixmystreet, { 'area': [ [% map.area.join(',') %] ], - 'all_pins': '[% all_pins %]', 'latitude': [% map.latitude %], 'longitude': [% map.longitude %], [% IF map.any_zoom -%] diff --git a/templates/web/base/maps/mapquest-attribution.html b/templates/web/base/maps/mapquest-attribution.html deleted file mode 100644 index 43d6106a5..000000000 --- a/templates/web/base/maps/mapquest-attribution.html +++ /dev/null @@ -1,8 +0,0 @@ -[% -map_js = [ - version('/vendor/OpenLayers/OpenLayers.fixmystreet.js'), - version('/js/map-OpenLayers.js'), - version('/js/map-OpenStreetMap.js'), -]; -map_html = INCLUDE maps/openlayers.html -%] diff --git a/templates/web/base/maps/openlayers.html b/templates/web/base/maps/openlayers.html index 8f8d527e2..12ae88c05 100644 --- a/templates/web/base/maps/openlayers.html +++ b/templates/web/base/maps/openlayers.html @@ -9,7 +9,6 @@ [%- UNLESS c.cobrand.call_hook('hide_areas_on_reports') %] data-area="[% map.area.join(',') %]" [%- END %] - data-all_pins='[% all_pins %]' data-latitude=[% map.latitude %] data-longitude=[% map.longitude %] [% IF map.any_zoom -%] @@ -36,6 +35,4 @@ [% IF map.copyright %] <div class="olControlAttribution" style="position: absolute;">[% map.copyright %]</div> [% END %] - <div id="loading-indicator" class="hidden" aria-hidden="true"> - <img src="/i/loading.svg" alt="Loading..." /> - </div> + <img id="loading-indicator" class="hidden" aria-hidden="true" src="/i/loading.svg" alt="Loading..."> diff --git a/templates/web/base/maps/osm-streetview.html b/templates/web/base/maps/osm-streetview.html deleted file mode 100644 index f68f53039..000000000 --- a/templates/web/base/maps/osm-streetview.html +++ /dev/null @@ -1,8 +0,0 @@ -[% -map_js = [ - version('/vendor/OpenLayers/OpenLayers.fixmystreet.js'), - version('/js/map-OpenLayers.js'), - version('/js/map-streetview.js'), -]; -map_html = INCLUDE maps/openlayers.html -%] diff --git a/templates/web/base/maps/osm-toner-lite.html b/templates/web/base/maps/osm-toner-lite.html deleted file mode 100644 index 22b6636c5..000000000 --- a/templates/web/base/maps/osm-toner-lite.html +++ /dev/null @@ -1,9 +0,0 @@ -[% -map_js = [ - version('/vendor/OpenLayers/OpenLayers.fixmystreet.js'), - "https://stamen-maps.a.ssl.fastly.net/js/tile.stamen.js?v1.3.0", - version('/js/map-OpenLayers.js'), - version('/js/map-toner-lite.js'), -]; -map_html = INCLUDE maps/openlayers.html -%] diff --git a/templates/web/base/maps/osm.html b/templates/web/base/maps/osm.html index 43d6106a5..51c3ad388 100644 --- a/templates/web/base/maps/osm.html +++ b/templates/web/base/maps/osm.html @@ -1,8 +1,3 @@ [% -map_js = [ - version('/vendor/OpenLayers/OpenLayers.fixmystreet.js'), - version('/js/map-OpenLayers.js'), - version('/js/map-OpenStreetMap.js'), -]; map_html = INCLUDE maps/openlayers.html %] diff --git a/templates/web/base/my/my.html b/templates/web/base/my/my.html index 1aaad6dc9..e10dd96c8 100644 --- a/templates/web/base/my/my.html +++ b/templates/web/base/my/my.html @@ -17,11 +17,53 @@ <h1>[% loc('Your account') %]</h1> -<p>[% c.user.name %] [% c.user.email %]</p> +[% IF flash_message %] +<p class="form-success">[% flash_message %]</p> +[% END %] + +<style> +/* TODO XXX */ +li .my-account-buttons { + float: right; + margin: 0; +} +li .my-account-buttons a { + padding: 0 0.5em; +} +</style> +<ul> +<li>[% loc('Name:') %] [% c.user.name %] +<li>[% loc('Email:') %] [% c.user.email OR '-' %] + <p class="my-account-buttons"> + [% IF NOT c.user.email %] + <a href="/auth/change_email">[% loc('Add') %]</a> + [% ELSIF c.user.email_verified %] + <a href="/auth/change_email">[% loc('Change') %]</a> + [% ELSE %] + <a href="/auth/verify/email">[% loc('Verify') %]</a> + <a href="/auth/change_email">[% loc('Change') %]</a> + [% END %] + </p> +<li>[% loc('Phone:') %] [% c.user.phone_display OR '-' %] + <p class="my-account-buttons"> + [% IF NOT c.user.phone %] + <a href="/auth/change_phone">[% loc('Add') %]</a> + [% ELSIF c.user.phone_verified %] + <a href="/auth/change_phone">[% loc('Change') %]</a> + [% ELSE %] + [% IF c.config.SMS_AUTHENTICATION %] + <a href="/auth/verify/phone">[% loc('Verify') %]</a> + [% END %] + <a href="/auth/change_phone">[% loc('Change') %]</a> + [% END %] + </p> +</ul> <p class="my-account-buttons"> <a href="/auth/change_password">[% loc('Change password') %]</a> - <a href="/auth/change_email">[% loc('Change email') %]</a> + [% IF c.user AND (c.user.from_body OR c.user.is_superuser) %] + <a href="/auth/generate_token">[% loc('Generate token') %]</a> + [% END %] <a href="/auth/sign_out">[% loc('Sign out') %]</a> </p> diff --git a/templates/web/base/pagination.html b/templates/web/base/pagination.html index a677b9d58..7c13ec9cb 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"> + <p class="pagination" data-page="[% pager.current_page %]"> [% 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/report/_inspect.html b/templates/web/base/report/_inspect.html index 436c89e4a..5088332ce 100644 --- a/templates/web/base/report/_inspect.html +++ b/templates/web/base/report/_inspect.html @@ -6,7 +6,7 @@ [% INCLUDE 'errors.html' %] - <form id="report_inspect_form" method="post" action="[% c.uri_for( '/report', problem.id ) %]" class="validate"> + <form name="report_inspect_form" id="report_inspect_form" method="post" action="[% c.uri_for( '/report', problem.id ) %]" class="validate"> <input type="hidden" name="js" value=""> <div class="inspect-section"> @@ -34,11 +34,17 @@ <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/Current+Location/[% 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" id="geolocate_link">[% loc('Set to my current location') %]</a> + <a href="#" class="btn btn--block btn--geolocate">[% loc('Set to my current location') %]</a> </p> </div> @@ -141,8 +147,9 @@ </select> </p> <p> - <label for="detailed_information">[% loc('Extra details') %]</label> - <textarea rows="2" name="detailed_information" id="detailed_information" class="form-control">[% problem.get_extra_metadata('detailed_information') | html %]</textarea> + <label for="detailed_information">[% loc('Extra details') %]</label> <span id="detailed_information_length"></span> + <textarea rows="2" name="detailed_information" id="detailed_information" class="form-control" + [% IF max_detailed_info_length %]data-max-length="[% max_detailed_info_length %]" placeholder="[% tprintf(loc('%d characters maximum'), max_detailed_info_length) %]"[% END %]>[% problem.get_extra_metadata('detailed_information') | html %]</textarea> </p> [% END %] diff --git a/templates/web/base/report/_item.html b/templates/web/base/report/_item.html index 9449ca55d..8179139ca 100644 --- a/templates/web/base/report/_item.html +++ b/templates/web/base/report/_item.html @@ -2,7 +2,7 @@ [% PROCESS 'admin/report_blocks.html' ~%] [% END ~%] -[% IF c.user.has_permission_to('planned_reports', problem.bodies_str_ids) ~%] +[% IF c.user.has_permission_to('planned_reports', problem.bodies_str_ids) OR c.user.is_planned_report(problem) ~%] [% item_extra_class = "item-list__item--indented" ~%] [% item_action = BLOCK ~%] <input type="submit" value="1" @@ -121,13 +121,18 @@ </a> -[% IF item_action AND page != 'around' %] +[% IF item_action ~%] + [% IF page == 'report' ~%] + [%# 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) %] + [% 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 %] </form> -[% ELSIF item_action ~%] - [% item_action.replace('("shortlist-[^"]*)', '$1-' _ problem.id) %] -[% END ~%] + [% END ~%] +[% END %] </li> diff --git a/templates/web/base/report/_main.html b/templates/web/base/report/_main.html index 405cb2118..25bbd4c33 100644 --- a/templates/web/base/report/_main.html +++ b/templates/web/base/report/_main.html @@ -1,13 +1,9 @@ -[% IF c.user_exists %] - [% DEFAULT permissions = c.user.permissions(c, problem.bodies_str) %] -[%- END %] - <a href="[% c.uri_for( '/around', { lat => latitude, lon => longitude } ) %]" class="problem-back js-back-to-report-list">[% loc('Back to all reports') %]</a> <div class="problem-header clearfix" data-lastupdate="[% problem.lastupdate %]"> -[% IF c.user.has_permission_to('planned_reports', problem.bodies_str_ids) %] +[% IF permissions.planned_reports %] <form method="post" action="/my/planned/change" id="planned_form" class="hidden-label-target"> <input type="hidden" name="id" value="[% problem.id %]"> <input type="hidden" name="token" value="[% csrf_token %]"> @@ -124,16 +120,12 @@ </form> [% END %] - [% IF - (permissions.moderate) - OR - (c.user.has_permission_to('planned_reports', problem.bodies_str_ids)) - %] + [% IF permissions.moderate OR permissions.planned_reports %] <div class="moderate-display segmented-control" role="menu"> [% IF permissions.moderate %] <a class="js-moderate btn" role="menuitem" aria-label="[% loc('Moderate this report') %]">[% loc('Moderate') %]</a> [% END %] - [% IF c.user.has_permission_to('planned_reports', problem.bodies_str_ids) %] + [% IF permissions.planned_reports %] [%~ IF c.user.is_planned_report(problem) ~%] <label class="btn btn--shortlisted" for="shortlist-report" role="menuitem" aria-label="[% loc('Remove from shortlist') %]">[% loc('Shortlisted') %]</label> [%~ ELSE ~%] diff --git a/templates/web/base/report/display.html b/templates/web/base/report/display.html index 7c26c4938..f9c42b35d 100644 --- a/templates/web/base/report/display.html +++ b/templates/web/base/report/display.html @@ -39,6 +39,9 @@ [% END %] [% INCLUDE 'report/banner.html' %] +[% IF c.user_exists %] + [% DEFAULT permissions = c.user.permissions(c, problem.bodies_str) %] +[%- END %] [% INCLUDE 'report/_main.html' %] [% IF problem.duplicate_of %] @@ -50,11 +53,18 @@ [% TRY %][% INCLUDE 'report/sharing.html' %][% CATCH file %][% END %] [% INCLUDE 'report/updates.html' %] +[% IF two_column_sidebar %] +<button class="btn btn--provide-update js-provide-update hidden-nojs">[% loc('Provide an update') %]</button> +<div class="hidden-js"> +[% END %] [% IF problem.duplicate_of %] [% INCLUDE 'report/duplicate-no-updates.html' %] [% ELSIF NOT shown_form %] [% INCLUDE 'report/update-form.html' %] [% END %] +[% IF two_column_sidebar %] +</div> +[% END %] </div> diff --git a/templates/web/base/report/display_tools.html b/templates/web/base/report/display_tools.html index c477fd8dd..bb76cc388 100644 --- a/templates/web/base/report/display_tools.html +++ b/templates/web/base/report/display_tools.html @@ -3,7 +3,7 @@ [% 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/delete/[% problem.id %]" id="remove-from-site-form"> <input type="hidden" name="token" value="[% csrf_token %]"> - <input type="submit" id="key-tool-report-abuse" class="abuse btn" data-confirm="[% loc('Are you sure?') %]" name="remove_from_site" value="[% loc('Remove from site') %]"> + <button type="submit" id="key-tool-report-abuse" class="abuse" data-confirm="[% loc('Are you sure?') %]" name="remove_from_site">[% loc('Remove from site') %]</button> </form></li> [% ELSIF c.cobrand.moniker != 'zurich' %] <li><a rel="nofollow" id="key-tool-report-abuse" class="abuse" href="[% c.uri_for( '/contact', { id => problem.id } ) %]">[% diff --git a/templates/web/base/report/duplicate-no-updates.html b/templates/web/base/report/duplicate-no-updates.html index c8020a107..7de2ae042 100644 --- a/templates/web/base/report/duplicate-no-updates.html +++ b/templates/web/base/report/duplicate-no-updates.html @@ -1,5 +1,7 @@ <div> - [% UNLESS hide_header %]<h2 class="update-form-heading">[% loc( 'Provide an update') %]</h2>[% END %] + [% UNLESS hide_header %] + <h2[% IF two_column_sidebar %] class="hidden-js"[% END %]>[% loc('Provide an update') %]</h2> + [% END %] <p>[% loc("This report is a duplicate. Please leave updates on the original report:") %]</p> <ul class="item-list"> [% INCLUDE 'report/_item.html' item_extra_class = 'item-list__item--with-pin item-list--reports__item--selected' problem = problem.duplicate_of %] diff --git a/templates/web/base/report/new/category.html b/templates/web/base/report/new/category.html index b8ebf1653..94d5479a6 100644 --- a/templates/web/base/report/new/category.html +++ b/templates/web/base/report/new/category.html @@ -1,15 +1,38 @@ -[% IF category_options.size ~%] +[% IF category_options.size OR category_groups.size ~%] + [%~ BLOCK category_option ~%] + [% cat_op_lc = cat_op.name | lower =%] + <option value='[% cat_op.name | html %]'[% ' selected' IF report.category == cat_op.name || category_lc == cat_op_lc || (category_options.size == 2 AND loop.last) ~%] + >[% IF loop.first %][% cat_op.value %][% ELSE %][% cat_op.value | html %][% END %]</option> + [%~ END ~%] + [% IF category; category_lc = category | lower; END; ~%] <label for='form_category' id="form_category_label"> [%~ loc('Category') ~%] </label>[% =%] - <select class="form-control" name='category' id='form_category' data-role='[% c.user.has_body_permission_to('planned_reports') ? 'inspector' : 'user' %]' data-body='[% c.user.from_body.name %]'> - [%~ FOREACH cat_op IN category_options ~%] - [% cat_op_lc = cat_op.name | lower =%] - <option value='[% cat_op.name | html %]'[% ' selected' IF report.category == cat_op.name || category_lc == cat_op_lc || (category_options.size == 2 AND loop.last) ~%] - >[% IF loop.first %][% cat_op.value %][% ELSE %][% cat_op.value | html %][% END %]</option> - [%~ END =%] + <select class="form-control[% IF category_groups.size %] js-grouped-select[% END %]" name="category" id="form_category" + [%~ IF c.user.from_body =%] + data-role="[% c.user.has_body_permission_to('planned_reports') ? 'inspector' : 'user' %]" data-body="[% c.user.from_body.name %]" data-prefill="[% c.cobrand.prefill_report_fields_for_inspector %]" + [%~ END ~%] + > + [%~ 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 ~%] </select> + [%~ IF category_groups.size ~%] + <label id="form_subcategory_label" class="hidden"> + [%~ loc('Subcategory') ~%] + </label> + [%~ END ~%] [%~ END ~%] diff --git a/templates/web/base/report/new/category_wrapper.html b/templates/web/base/report/new/category_wrapper.html index 291f5e923..abc44d062 100644 --- a/templates/web/base/report/new/category_wrapper.html +++ b/templates/web/base/report/new/category_wrapper.html @@ -1,7 +1,11 @@ <div id="form_category_row"> [% IF js %] <label for="form_category">[% loc('Category') %]</label> - <select class="form-control" name="category" id="form_category" data-role="[% c.user.has_body_permission_to('planned_reports') ? 'inspector' : 'user' %]" data-body="[% c.user.from_body.name %]" required><option>[% loc('Loading...') %]</option></select> + <select class="form-control" name="category" id="form_category" + [%~ IF c.user.from_body =%] + data-role="[% c.user.has_body_permission_to('planned_reports') ? 'inspector' : 'user' %]" data-body="[% c.user.from_body.name %]" data-prefill="[% c.cobrand.prefill_report_fields_for_inspector %]" + [%~ END =%] + required><option>[% loc('Loading...') %]</option></select> [% ELSE %] [% IF category_options.size %] [% IF field_errors.category %] diff --git a/templates/web/base/report/new/form_user_loggedin.html b/templates/web/base/report/new/form_user_loggedin.html index e841845bf..bd4ce1cf7 100644 --- a/templates/web/base/report/new/form_user_loggedin.html +++ b/templates/web/base/report/new/form_user_loggedin.html @@ -29,12 +29,19 @@ </select> [% END %] - <label for="form_email">[% loc('Email address') %]</label> - <input class="form-control" id="form_email" name="email" +[% IF c.user.phone_verified %] + <label for="form_phone">[% loc('Phone number') %]</label> + <input class="form-control" id="form_phone" name="phone" disabled type="text" value="[% c.user.phone | html %]"> +[% END %] + +[% IF c.user.email_verified %] + <label for="form_username">[% loc('Email address') %]</label> + <input class="form-control" id="form_username" name="username" [%- IF NOT can_contribute_as_another_user -%] disabled [%- END -%] type="text" value="[% c.user.email | html %]"> +[% END %] [% INCLUDE 'report/new/extra_name.html' %] [% PROCESS 'user/_anonymity.html' anonymous = report.anonymous %] @@ -56,8 +63,14 @@ <label class="inline" for="form_may_show_name">[% loc('Show my name publicly') %] </label> </div> +[% IF NOT c.user.phone_verified %] <label for="form_phone">[% loc('Phone number (optional)') %]</label> <input class="form-control" type="text" value="[% report.user.phone | html %]" name="phone" id="form_phone"> +[% END %] +[% IF NOT c.user.email_verified %] + <label for="form_username">[% loc('Email address (optional)') %]</label> + <input class="form-control" type="text" value="[% report.user.email | html %]" name="email" id="form_email"> +[% END %] <div class="form-txt-submit-box"> <input class="green-btn js-submit_register" type="submit" name="submit_register" value="[% loc('Submit') %]"> diff --git a/templates/web/base/report/new/form_user_loggedout.html b/templates/web/base/report/new/form_user_loggedout.html index 4142f4582..d7bbbf588 100644 --- a/templates/web/base/report/new/form_user_loggedout.html +++ b/templates/web/base/report/new/form_user_loggedout.html @@ -1,4 +1,4 @@ -[% IF c.config.FACEBOOK_APP_ID OR c.config.TWITTER_KEY %] +[% IF 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"> @@ -27,6 +27,6 @@ [% PROCESS 'report/new/form_user_loggedout_by_email.html' %] </div> -[% IF c.config.FACEBOOK_APP_ID OR c.config.TWITTER_KEY %] +[% IF c.cobrand.social_auth_enabled %] </div> [% END %] diff --git a/templates/web/base/report/new/form_user_loggedout_by_email.html b/templates/web/base/report/new/form_user_loggedout_by_email.html index 409fd4bbf..e9519f573 100644 --- a/templates/web/base/report/new/form_user_loggedout_by_email.html +++ b/templates/web/base/report/new/form_user_loggedout_by_email.html @@ -1,5 +1,9 @@ <div id="form_sign_in_no" class="form-box"> + [% IF c.config.SMS_AUTHENTICATION %] + <h5>[% loc('<strong>No</strong> Let me confirm my report by email/text') %]</h5> + [% ELSE %] <h5>[% loc('<strong>No</strong> Let me confirm my report by email') %]</h5> + [% END %] [% INCLUDE 'report/new/extra_name.html' %] [% PROCESS 'user/_anonymity.html' anonymous = report.anonymous %] @@ -22,8 +26,14 @@ <label class="inline" for="form_may_show_name">[% loc('Show my name publicly') %]</label> </div> - <label class="form-focus-hidden" for="form_phone">[% loc('Phone number (optional)') %]</label> - <input class="form-control form-focus-hidden" type="text" value="[% report.user.phone | html %]" name="phone" id="form_phone" placeholder="[% loc('Your phone number') %]"> + <div id="js-hide-if-username-phone"> + <label class="form-focus-hidden" for="form_phone">[% loc('Phone number (optional)') %]</label> + <input class="form-control form-focus-hidden" type="text" value="[% report.user.phone_display | html %]" name="phone" id="form_phone"> + </div> + <div id="js-hide-if-username-email"> + <label class="form-focus-hidden" for="form_email">[% loc('Email address (optional)') %]</label> + <input class="form-control form-focus-hidden" type="text" value="[% report.user.email | html %]" name="email" id="form_email"> + </div> <label class="form-focus-hidden" for="password_register">[% loc('Password (optional)') %]</label> diff --git a/templates/web/base/report/new/form_user_loggedout_email.html b/templates/web/base/report/new/form_user_loggedout_email.html index 39e9fd779..734eb6f35 100644 --- a/templates/web/base/report/new/form_user_loggedout_email.html +++ b/templates/web/base/report/new/form_user_loggedout_email.html @@ -1,7 +1,17 @@ -<label for="form_email">[% loc('Your email') %]</label> -[% IF field_errors.email %] - <p class='form-error'>[% field_errors.email %]</p> +[% IF c.config.SMS_AUTHENTICATION %] + [% SET username_label = loc('Your email or mobile') %] + [% SET username_type = 'text' %] + [% SET username_value = report.user.username %] +[% ELSE %] + [% SET username_label = loc('Your email') %] + [% SET username_type = 'email' %] + [% SET username_value = report.user.email %] [% END %] -<input class="form-control" type="email" value="[% report.user.email | html %]" name="email" id="form_email" placeholder="[% loc('Please enter your email address') %]" + +<label for="form_username">[% username_label %]</label> +[% IF field_errors.username %] + <p class='form-error'>[% field_errors.username %]</p> +[% END %] +<input type="[% username_type %]" value="[% username_value | html %]" name="username" id="form_username" [% IF required %]required[% END %] - class="required"> + class="form-control required"> diff --git a/templates/web/base/report/photo-js.html b/templates/web/base/report/photo-js.html index 8c8c91669..6f3dd55d1 100644 --- a/templates/web/base/report/photo-js.html +++ b/templates/web/base/report/photo-js.html @@ -1,6 +1,3 @@ [% extra_css = BLOCK %] <link rel="stylesheet" href="[% version('/vendor/fancybox/jquery.fancybox-1.3.4.css') %]"> [% END %] -[% extra_js = [ - version('/vendor/fancybox/jquery.fancybox-1.3.4.pack.js') -] %] diff --git a/templates/web/base/report/update-form.html b/templates/web/base/report/update-form.html index ea7b14970..912aae2b4 100644 --- a/templates/web/base/report/update-form.html +++ b/templates/web/base/report/update-form.html @@ -3,7 +3,7 @@ <div id="update_form"> [% IF NOT login_success AND NOT oauth_need_email %] - <h2 class="update-form-heading">[% loc( 'Provide an update') %]</h2> + <h2[% IF two_column_sidebar %] class="hidden-js"[% END %]>[% loc( 'Provide an update') %]</h2> [% IF c.cobrand.moniker != 'stevenage' %] <div class="general-notes"> diff --git a/templates/web/base/report/update.html b/templates/web/base/report/update.html index 85624669a..6dca226fe 100644 --- a/templates/web/base/report/update.html +++ b/templates/web/base/report/update.html @@ -1,12 +1,10 @@ -[% moderating = c.user && c.user.has_permission_to('moderate', problem.bodies_str_ids) %] - [% IF loop.first %] <section class="full-width"> <h4 class="static-with-rule">[% loc('Updates') %]</h4> <ul class="item-list item-list--updates"> [% END %] <li class="item-list__item item-list__item--updates"> - [% IF moderating; original_update = update.moderation_original_data %] + [% IF permissions.moderate; original_update = update.moderation_original_data %] <form method="post" action="/moderate/report/[% problem.id %]/update/[% update.id %]"> <input type="hidden" name="token" value="[% csrf_token %]"> <input type="button" class="btn js-moderate moderate-display" value="[% loc('Moderate this update') %]"> @@ -33,7 +31,7 @@ <div class="moderate-display"> [% update.text | add_links | markup(update.user) | html_para %] </div> - [% IF moderating %] + [% IF permissions.moderate %] <div class="moderate-edit"> [% IF update.text != original.detail %] <label><input type="checkbox" name="update_revert_detail" class="revert-textarea"> @@ -43,10 +41,15 @@ </div> [% END %] - [% SET update_state = update.problem_state_display(c) %] - [% IF update_state AND update_state != global.last_state AND NOT (global.last_state == "" AND update.problem_state == 'confirmed') %] - <p class="meta-2">[% loc('State changed to:') %] [% update_state %]</p> + [% # Small chance of duplicates in the case of fixed - user followed by fixed - council %] + [% SET update_state = update.problem_state %] + [% IF ( update_state AND update_state != global.last_state AND NOT (global.last_state == "" AND update.problem_state == 'confirmed') ) OR + update.mark_fixed OR update.mark_open + %] + <p class="meta-2">[% loc('State changed to:') %] [% update.problem_state_display(c) %]</p> [%- global.last_state = update_state %] + [%- IF update_state == "" AND update.mark_fixed %][% global.last_state = 'fixed - user' %][% END %] + [%- IF update_state == "" AND update.mark_open %][% global.last_state = 'confirmed' %][% END %] [% END %] <p class="meta-2"> @@ -61,7 +64,7 @@ </div> [% END %] </div> - [% IF moderating %] + [% IF permissions.moderate %] <div class="moderate-edit"> <label for="moderation_reason">[% loc('Moderation reason:') %]</label> <input type="text" class="form-control" name="moderation_reason" diff --git a/templates/web/base/report/update/form_name.html b/templates/web/base/report/update/form_name.html index e4f7ac60c..f366895a5 100644 --- a/templates/web/base/report/update/form_name.html +++ b/templates/web/base/report/update/form_name.html @@ -20,8 +20,8 @@ <option value="body">[% c.user.from_body.name %]</option> [% END %] </select> - <label for="form_email">[% loc('Email address') %]</label> - <input class="form-control" name="rznvy" id="form_email" type="text" value="[% c.user.email | html %]"> + <label for="form_username">[% loc('Email address') %]</label> + <input class="form-control" name="username" id="form_username" type="text" value="[% c.user.email | html %]"> [% END %] <label for="form_name">[% loc('Name') %]</label> diff --git a/templates/web/base/report/update/form_user_loggedout.html b/templates/web/base/report/update/form_user_loggedout.html index d9f67e06e..19295b94c 100644 --- a/templates/web/base/report/update/form_user_loggedout.html +++ b/templates/web/base/report/update/form_user_loggedout.html @@ -1,4 +1,4 @@ -[% IF c.config.FACEBOOK_APP_ID OR c.config.TWITTER_KEY %] +[% IF c.cobrand.social_auth_enabled %] <h3>[% loc("Now to submit your update…") %]</h3> [% IF c.config.FACEBOOK_APP_ID %] <div class="form-box"> @@ -29,6 +29,6 @@ [% INCLUDE 'report/update/form_user_loggedout_by_email.html' %] </div> -[% IF c.config.FACEBOOK_APP_ID OR c.config.TWITTER_KEY %] +[% IF c.cobrand.social_auth_enabled %] </div> [% END %] diff --git a/templates/web/base/report/update/form_user_loggedout_by_email.html b/templates/web/base/report/update/form_user_loggedout_by_email.html index 04a842bef..7d10fe391 100644 --- a/templates/web/base/report/update/form_user_loggedout_by_email.html +++ b/templates/web/base/report/update/form_user_loggedout_by_email.html @@ -1,5 +1,9 @@ <div id="form_sign_in_no" class="form-box"> + [% IF c.config.SMS_AUTHENTICATION %] + <h5>[% loc('<strong>No</strong> Let me confirm my update by email/text') %]</h5> + [% ELSE %] <h5>[% loc('<strong>No</strong> Let me confirm my update by email') %]</h5> + [% END %] [% INCLUDE 'report/update/form_name.html' %] diff --git a/templates/web/base/report/update/form_user_loggedout_email.html b/templates/web/base/report/update/form_user_loggedout_email.html index ccea2de02..f4228969b 100644 --- a/templates/web/base/report/update/form_user_loggedout_email.html +++ b/templates/web/base/report/update/form_user_loggedout_email.html @@ -1,7 +1,17 @@ -<label for="form_rznvy">[% loc('Your email' ) %]</label> -[% IF field_errors.email %] - <p class='form-error'>[% field_errors.email %]</p> +[% IF c.config.SMS_AUTHENTICATION %] + [% SET username_label = loc('Your email or mobile') %] + [% SET username_type = 'text' %] + [% SET username_value = update.user.username %] +[% ELSE %] + [% SET username_label = loc('Your email') %] + [% SET username_type = 'email' %] + [% SET username_value = update.user.email %] [% END %] -<input type="email" name="rznvy" id="form_rznvy" value="[% update.user.email | html %]" placeholder="[% loc('Your email address' ) %]" + +<label for="form_username">[% username_label %]</label> +[% IF field_errors.username %] + <p class='form-error'>[% field_errors.username %]</p> +[% END %] +<input type="[% username_type %]" name="username" id="form_username" value="[% username_value | html %]" [% IF required %]required[% END %] class="form-control required"> diff --git a/templates/web/base/report/updates.html b/templates/web/base/report/updates.html index 75e94b1d5..e8a2d4bd3 100644 --- a/templates/web/base/report/updates.html +++ b/templates/web/base/report/updates.html @@ -1,5 +1,11 @@ [% global.last_state = '' %] [% FOREACH update IN updates %] +[%- IF global.last_state == 'hidden' OR global.last_state == 'unconfirmed' OR update.problem_state == 'hidden' OR update.problem_state == 'unconfirmed' %] + [%- IF update.problem_state != '' %] + [%- global.last_state = update.problem_state %] + [%- END %] + [%- NEXT %] +[%- END %] [% INCLUDE 'report/update.html' %] [% END %] diff --git a/templates/web/base/reports/_list-filters.html b/templates/web/base/reports/_list-filters.html index 50e88857d..ab8ac06f7 100644 --- a/templates/web/base/reports/_list-filters.html +++ b/templates/web/base/reports/_list-filters.html @@ -1,10 +1,18 @@ [% select_status = BLOCK %] <select class="form-control js-multiple" name="status" id="statuses" multiple - data-all="[% loc('All') %]" data-all-options='["open","closed","fixed"]' - [%~ IF c.cobrand.on_map_default_status == 'open' %] - data-none="[% loc('Unfixed reports') %]" + data-all="[% loc('All') %]" + [% IF c.user_exists AND c.user.is_superuser OR c.user.belongs_to_body(body.id) %] + [% options = []; FOR group IN filter_states; FOR state IN group.1; NEXT IF state == 'hidden'; 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> diff --git a/templates/web/base/reports/_rss.html b/templates/web/base/reports/_rss.html index f2d164bfa..fdb833315 100644 --- a/templates/web/base/reports/_rss.html +++ b/templates/web/base/reports/_rss.html @@ -1,5 +1,5 @@ <div class="shadow-wrap"> - <ul id="key-tools"[% IF NOT children.size %] class="singleton"[% END %]> + <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'; diff --git a/templates/web/base/reports/_status_filter_options.html b/templates/web/base/reports/_status_filter_options.html new file mode 100644 index 000000000..b761222e0 --- /dev/null +++ b/templates/web/base/reports/_status_filter_options.html @@ -0,0 +1,3 @@ + [%~ IF c.cobrand.on_map_default_status == 'open' %] + data-none="[% prettify_state('confirmed') %]" + [%~ END ~%] diff --git a/templates/web/base/reports/body.html b/templates/web/base/reports/body.html index b6e6df73b..7931ae691 100755 --- a/templates/web/base/reports/body.html +++ b/templates/web/base/reports/body.html @@ -42,7 +42,12 @@ [% ward.name %] </h1> <a href="[% body_url %]">[% body.name %]</a> - [% ELSE %] + [% 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> + [% ELSE %] <h1 id="reports_heading"> [% body.name %] </h1> diff --git a/templates/web/base/reports/index.html b/templates/web/base/reports/index.html index a653a2686..70f4b3929 100755 --- a/templates/web/base/reports/index.html +++ b/templates/web/base/reports/index.html @@ -15,7 +15,9 @@ [% INCLUDE 'header.html', title = loc('Dashboard'), bodyclass => 'dashboard fullwidthpage' %] <div class="dashboard-header"> - <h1>[% loc('Dashboard') %]</h1> + <h1>[% loc('Dashboard') %] + [% IF body %] – [% body.name %] [% END %] + </h1> </div> <div class="dashboard-row"> @@ -58,19 +60,31 @@ </div> </div> <div class="dashboard-item dashboard-item--6"> - <form class="dashboard-search" action="/reports"> + <form class="dashboard-search"> <h2>[% loc('Show reports in your area') %]</h2> + [% IF body %] + <label for="ward">[% loc('Pick your ward') %]</label> + <div class="dashboard-search__input"> + <select id="ward" name="ward" class="js-autocomplete"> + <option value="">[% loc('Pick your ward') %]</option> + [% FOR child IN children.values.sort('name') %] + <option>[% child.name | html ~%]</option> + [% END %] + </select> + </div> + [% ELSE %] <label for="body">[% loc('Pick your council') %]</label> <div class="dashboard-search__input"> <select id="body" name="body" class="js-autocomplete"> <option value="">[% loc('Pick your council') %]</option> - [% FOR body IN bodies %] - <option value="[% body.id %]">[% body.name | html ~%] - [% IF NOT body.get_column("area_count") %] [% loc('(no longer exists)') %][% END ~%] + [% FOR b IN bodies # Not body as 'body' may be on stash %] + <option value="[% b.id %]">[% b.name | html ~%] + [% IF NOT b.get_column("area_count") %] [% loc('(no longer exists)') %][% END ~%] </option> [% END %] </select> </div> + [% END %] <div class="dashboard-search__submit"> <input type="submit" value="[% loc('Go') %]"> </div> @@ -80,6 +94,20 @@ <div class="dashboard-row"> <div class="dashboard-item dashboard-item--6"> + [% IF body %] + <h2 class="dashboard-subheading">[% loc('Top 5 wards') %]</h2> + <p>[% loc('Number of problems reported in each ward, in the last 7 days.') %]</p> + <table class="dashboard-ranking-table"> + <tbody> + [% FOR line IN wards %] + <tr><td>[% line.name %]</td><td>[% tprintf(nget("%s report", "%s reports", line.reports), line.reports) %]</td></tr> + [% END %] + </tbody> + <tfoot> + <tr><td>[% loc('Other wards') %]</td><td>[% tprintf(nget("%s report", "%s reports", other_wards), other_wards) %]</td></tr> + </tfoot> + </table> + [% ELSE %] <h2 class="dashboard-subheading">[% loc('Top 5 responsive councils') %]</h2> <p>[% loc('Average time between a problem being reported and being fixed, last 100 reports.') %]</p> <table class="dashboard-ranking-table"> @@ -92,6 +120,7 @@ <tr><td>[% loc('Overall average') %]</td><td>[% tprintf(nget("%s day", "%s days", average), average) %]</td></tr> </tfoot> </table> + [% END %] </div> <div class="dashboard-item dashboard-item--6"> <h2 class="dashboard-subheading">[% loc('Top 5 most used categories') %]</h2> |