diff options
36 files changed, 216 insertions, 58 deletions
diff --git a/bin/update-schema b/bin/update-schema index bb0360fb2..500e771f1 100755 --- a/bin/update-schema +++ b/bin/update-schema @@ -194,6 +194,7 @@ else { # By querying the database schema, we can see where we're currently at # (assuming schema change files are never half-applied, which should be the case) sub get_db_version { + return '0046' if column_exists('users', 'extra'); return '0045' if table_exists('response_priorities'); return '0044' if table_exists('contact_response_templates'); return '0043' if column_exists('users', 'area_id'); diff --git a/db/downgrade_0046---0045.sql b/db/downgrade_0046---0045.sql new file mode 100644 index 000000000..c0cc566af --- /dev/null +++ b/db/downgrade_0046---0045.sql @@ -0,0 +1,6 @@ +BEGIN; + +ALTER TABLE users + DROP COLUMN extra; + +COMMIT; diff --git a/db/schema.sql b/db/schema.sql index 27f4bad13..fe45fb4aa 100644 --- a/db/schema.sql +++ b/db/schema.sql @@ -31,7 +31,8 @@ create table users ( title text, twitter_id bigint unique, facebook_id bigint unique, - area_id integer + area_id integer, + extra text ); -- Record details of reporting bodies, including open311 configuration details diff --git a/db/schema_0046-user-add-extra.sql b/db/schema_0046-user-add-extra.sql new file mode 100644 index 000000000..06937237c --- /dev/null +++ b/db/schema_0046-user-add-extra.sql @@ -0,0 +1,6 @@ +BEGIN; + +ALTER TABLE users + ADD COLUMN extra TEXT; + +COMMIT; diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm index 46ac10d36..8ec9eeaab 100644 --- a/perllib/FixMyStreet/App/Controller/Admin.pm +++ b/perllib/FixMyStreet/App/Controller/Admin.pm @@ -385,6 +385,9 @@ sub update_contacts : Private { else { $contact->unset_extra_metadata( 'inspection_required' ); } + if ( $c->get_param('reputation_threshold') ) { + $contact->set_extra_metadata( reputation_threshold => int($c->get_param('reputation_threshold')) ); + } if ( %errors ) { $c->stash->{updated} = _('Please correct the errors below'); diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm index 355a3f2a9..db3b16dcd 100644 --- a/perllib/FixMyStreet/App/Controller/Report.pm +++ b/perllib/FixMyStreet/App/Controller/Report.pm @@ -270,6 +270,8 @@ sub delete :Local :Args(1) { $p->lastupdate( \'current_timestamp' ); $p->update; + $p->user->update_reputation(-1); + $c->model('DB::AdminLog')->create( { admin_user => $c->user->email, object_type => 'problem', @@ -316,6 +318,7 @@ sub inspect : Private { my $valid = 1; my $update_text; + my $reputation_change = 0; if ($permissions->{report_inspect}) { foreach (qw/detailed_information traffic_information/) { @@ -326,6 +329,7 @@ sub inspect : Private { $update_text = Utils::cleanup_text( $c->get_param('public_update'), { allow_multiline => 1 } ); if ($update_text) { $problem->set_extra_metadata( inspected => 1 ); + $reputation_change = 1; } else { $valid = 0; $c->stash->{errors} ||= []; @@ -371,6 +375,9 @@ sub inspect : Private { } if ($valid) { + if ( $reputation_change != 0 ) { + $problem->user->update_reputation($reputation_change); + } $problem->update; if ( defined($update_text) ) { $problem->add_to_comments( { diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm index 7766e08a1..75f54facf 100644 --- a/perllib/FixMyStreet/App/Controller/Report/New.pm +++ b/perllib/FixMyStreet/App/Controller/Report/New.pm @@ -86,7 +86,7 @@ sub report_new : Path : Args(0) { # work out the location for this report and do some checks # Also show map if we're just updating the filters return $c->forward('redirect_to_around') - if $c->get_param('filter_update') || !$c->forward('determine_location'); + if !$c->forward('determine_location') || $c->get_param('filter_update'); # create a problem from the submitted details $c->stash->{template} = "report/new/fill_in_details.html"; diff --git a/perllib/FixMyStreet/App/Controller/Reports.pm b/perllib/FixMyStreet/App/Controller/Reports.pm index ddc75163a..49f477fec 100644 --- a/perllib/FixMyStreet/App/Controller/Reports.pm +++ b/perllib/FixMyStreet/App/Controller/Reports.pm @@ -55,7 +55,9 @@ sub index : Path : Args(0) { } # Fetch all bodies - my @bodies = $c->model('DB::Body')->search({}, { + my @bodies = $c->model('DB::Body')->search({ + deleted => 0, + }, { '+select' => [ { count => 'area_id' } ], '+as' => [ 'area_count' ], join => 'body_areas', diff --git a/perllib/FixMyStreet/App/Controller/Rss.pm b/perllib/FixMyStreet/App/Controller/Rss.pm index 183b233a8..28f1aba43 100755 --- a/perllib/FixMyStreet/App/Controller/Rss.pm +++ b/perllib/FixMyStreet/App/Controller/Rss.pm @@ -207,6 +207,7 @@ sub generate : Private { $out =~ s{(<link>.*?</link>)}{$1<uri>$uri</uri>}; $c->response->header('Content-Type' => 'application/xml; charset=utf-8'); + $c->response->header('Access-Control-Allow-Origin' => '*'); $c->response->body( $out ); } diff --git a/perllib/FixMyStreet/DB/Result/User.pm b/perllib/FixMyStreet/DB/Result/User.pm index 2a2d0d5e3..8d42d5926 100644 --- a/perllib/FixMyStreet/DB/Result/User.pm +++ b/perllib/FixMyStreet/DB/Result/User.pm @@ -26,20 +26,22 @@ __PACKAGE__->add_columns( { data_type => "text", is_nullable => 1 }, "password", { data_type => "text", default_value => "", is_nullable => 0 }, - "flagged", - { data_type => "boolean", default_value => \"false", is_nullable => 0 }, "from_body", { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, + "flagged", + { data_type => "boolean", default_value => \"false", is_nullable => 0 }, "title", { data_type => "text", is_nullable => 1 }, - "facebook_id", - { data_type => "bigint", is_nullable => 1 }, "twitter_id", { data_type => "bigint", is_nullable => 1 }, + "facebook_id", + { data_type => "bigint", is_nullable => 1 }, "is_superuser", { data_type => "boolean", default_value => \"false", is_nullable => 0 }, "area_id", { data_type => "integer", is_nullable => 1 }, + "extra", + { data_type => "text", is_nullable => 1 }, ); __PACKAGE__->set_primary_key("id"); __PACKAGE__->add_unique_constraint("users_email_key", ["email"]); @@ -100,11 +102,17 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07035 @ 2016-08-03 13:52:28 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:SX8BS91mWHoOm2oWdNth1w +# Created by DBIx::Class::Schema::Loader v0.07035 @ 2016-09-16 14:22:10 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:7wfF1VnZax2QTXCIPXr+vg + +__PACKAGE__->load_components("+FixMyStreet::DB::RABXColumn"); +__PACKAGE__->rabx_column('extra'); use Moo; use mySociety::EmailUtil; +use namespace::clean -except => [ 'meta' ]; + +with 'FixMyStreet::Roles::Extra'; __PACKAGE__->many_to_many( planned_reports => 'user_planned_reports', 'report' ); @@ -370,4 +378,12 @@ sub is_planned_report { return $self->active_planned_reports->find({ id => $problem->id }); } +sub update_reputation { + my ( $self, $change ) = @_; + + my $reputation = $self->get_extra_metadata('reputation') || 0; + $self->set_extra_metadata( reputation => $reputation + $change); + $self->update; +} + 1; diff --git a/perllib/FixMyStreet/Script/Reports.pm b/perllib/FixMyStreet/Script/Reports.pm index 8d3b2ddbc..7d614bc30 100644 --- a/perllib/FixMyStreet/Script/Reports.pm +++ b/perllib/FixMyStreet/Script/Reports.pm @@ -145,9 +145,16 @@ sub send(;$) { my $inspection_required = $sender_info->{contact}->get_extra_metadata('inspection_required') if $sender_info->{contact}; if ( $inspection_required ) { + my $reputation_threshold = $sender_info->{contact}->get_extra_metadata('reputation_threshold') || 0; + my $reputation_threshold_met = 0; + if ( $reputation_threshold > 0 ) { + my $user_reputation = $row->user->get_extra_metadata('reputation') || 0; + $reputation_threshold_met = $user_reputation >= $reputation_threshold; + } unless ( $row->get_extra_metadata('inspected') || - $row->user->has_permission_to( trusted => $row->bodies_str_ids ) + $row->user->has_permission_to( trusted => $row->bodies_str_ids ) || + $reputation_threshold_met ) { $skip = 1; debug_print("skipped because not yet inspected", $row->id) if $debug_mode; diff --git a/t/app/controller/report_inspect.t b/t/app/controller/report_inspect.t index 4caeef501..831959fff 100644 --- a/t/app/controller/report_inspect.t +++ b/t/app/controller/report_inspect.t @@ -6,8 +6,8 @@ use FixMyStreet::TestMech; my $mech = FixMyStreet::TestMech->new; -my $brum = $mech->create_body_ok(2514, 'Birmingham City Council'); -my $oxon = $mech->create_body_ok(2237, 'Oxfordshire County Council'); +my $brum = $mech->create_body_ok(2514, 'Birmingham City Council', id => 2514); +my $oxon = $mech->create_body_ok(2237, 'Oxfordshire County Council', id => 2237); my $contact = $mech->create_contact_ok( body_id => $oxon->id, category => 'Cows', email => 'cows@example.net' ); my $rp = FixMyStreet::DB->resultset("ResponsePriority")->create({ body => $oxon, @@ -55,11 +55,13 @@ FixMyStreet::override_config { subtest "test inspect & instruct submission" => sub { $report->unset_extra_metadata('inspected'); $report->update; + my $reputation = $report->user->get_extra_metadata("reputation"); $mech->get_ok("/report/$report_id/inspect"); $mech->submit_form_ok({ button => 'save', with_fields => { public_update => "This is a public update.", save_inspected => "1" } }); $report->discard_changes; is $report->comments->first->text, "This is a public update.", 'Update was created'; is $report->get_extra_metadata('inspected'), 1, 'report marked as inspected'; + is $report->user->get_extra_metadata('reputation'), $reputation+1, "User reputation was increased"; }; subtest "test update is required when instructing" => sub { @@ -107,6 +109,22 @@ FixMyStreet::override_config { } }; +FixMyStreet::override_config { + MAPIT_URL => 'http://mapit.mysociety.org/', + ALLOWED_COBRANDS => 'oxfordshire', +}, sub { + subtest "test negative reputation" => sub { + my $reputation = $report->user->get_extra_metadata("reputation"); + + $mech->get_ok("/report/$report_id"); + $mech->submit_form( button => 'remove_from_site' ); + + $report->discard_changes; + is $report->user->get_extra_metadata('reputation'), $reputation-1, "User reputation was decreased"; + }; +}; + + END { $mech->delete_body($oxon); $mech->delete_body($brum); diff --git a/t/app/controller/rss.t b/t/app/controller/rss.t index 8b39219fa..4f737dda7 100644 --- a/t/app/controller/rss.t +++ b/t/app/controller/rss.t @@ -50,6 +50,7 @@ FixMyStreet::override_config { }; $mech->content_contains( "Testing, 10th October" ); $mech->content_lacks( 'Nearest road to the pin' ); +is $mech->response->header('Access-Control-Allow-Origin'), '*'; $report->geocode( { diff --git a/t/app/sendreport/inspection_required.t b/t/app/sendreport/inspection_required.t index 88a48e991..f9d40d39f 100644 --- a/t/app/sendreport/inspection_required.t +++ b/t/app/sendreport/inspection_required.t @@ -69,6 +69,38 @@ subtest 'Uninspected report is sent when made by trusted user' => sub { $report->discard_changes; $mech->email_count_is( 1 ); ok $report->whensent, 'Report marked as sent'; + is $report->get_extra_metadata('inspected'), undef, 'Report not marked as inspected'; +}; + +subtest 'Uninspected report isn’t sent when user rep is too low' => sub { + $mech->clear_emails_ok; + $report->whensent( undef ); + $report->update; + + $user->user_body_permissions->delete; + $user->set_extra_metadata(reputation => 15); + $user->update; + + $contact->set_extra_metadata(reputation_threshold => 20); + $contact->update; + + FixMyStreet::DB->resultset('Problem')->send_reports(); + + $report->discard_changes; + $mech->email_count_is( 0 ); + is $report->whensent, undef, 'Report hasn’t been sent'; +}; + +subtest 'Uninspected report is sent when user rep is high enough' => sub { + $user->set_extra_metadata(reputation => 21); + $user->update; + + FixMyStreet::DB->resultset('Problem')->send_reports(); + + $report->discard_changes; + $mech->email_count_is( 1 ); + ok $report->whensent, 'Report marked as sent'; + is $report->get_extra_metadata('inspected'), undef, 'Report not marked as inspected'; }; done_testing(); diff --git a/templates/web/base/admin/body-form.html b/templates/web/base/admin/body-form.html index 303afb682..6dd8a9547 100644 --- a/templates/web/base/admin/body-form.html +++ b/templates/web/base/admin/body-form.html @@ -189,7 +189,7 @@ </div> <p> <label for"comment_user_id">User ID to attribute fetched comments to</label> - <input type="text" name="comment_user_id" value="[% body.comment_user_id %]"> + <input type="text" class="form-control" name="comment_user_id" value="[% body.comment_user_id %]"> [% IF body.comment_user_id %] <a href="[% c.uri_for('user_edit', body.comment_user_id) %]">[% loc('edit user') %]</a> [% END %] diff --git a/templates/web/base/admin/body.html b/templates/web/base/admin/body.html index 065cafe2d..52df20c89 100644 --- a/templates/web/base/admin/body.html +++ b/templates/web/base/admin/body.html @@ -185,7 +185,7 @@ </p> </div> <p> - <strong>[% loc('Note:') %] </strong> <textarea name="note" rows="3" cols="40"></textarea> + <strong>[% loc('Note:') %] </strong> <textarea class="form-control" name="note" rows="3" cols="40"></textarea> </p> <div class="admin-hint"> diff --git a/templates/web/base/admin/category_edit.html b/templates/web/base/admin/category_edit.html index 7fe1a10d3..ebaa495db 100644 --- a/templates/web/base/admin/category_edit.html +++ b/templates/web/base/admin/category_edit.html @@ -19,7 +19,7 @@ [% END %] </p> -<form method="post" action="[% c.uri_for('body', body_id ) %]" enctype="application/x-www-form-urlencoded" accept-charset="utf-8"> +<form method="post" action="[% c.uri_for('body', body_id ) %]" enctype="application/x-www-form-urlencoded" accept-charset="utf-8" id="category_edit"> <p><strong>[% loc('Category:') %] </strong>[% contact.category | html %] <input type="hidden" name="category" value="[% contact.category | html %]" > <input type="hidden" name="token" value="[% csrf_token %]" > @@ -47,7 +47,17 @@ [% END %] </p> - <p><strong>[% loc('Note:') %] </strong><textarea name="note" rows="3" cols="40"></textarea> + [% IF c.cobrand.moniker != 'zurich' %] + <p [% 'class=hidden' UNLESS contact.get_extra_metadata('inspection_required') %]> + <label> + [% loc('Reputation threshold:') %] + <input type="text" class="form-control" name="reputation_threshold" id="reputation_threshold" + value="[% contact.get_extra_metadata('reputation_threshold') | html %]" size="30"> + </label> + </p> + [% END %] + + <p><strong>[% loc('Note:') %] </strong><textarea class="form-control" name="note" rows="3" cols="40"></textarea> [% IF body.can_be_devolved %] <h2>[% loc('Configure Endpoint') %]</h2> diff --git a/templates/web/base/admin/reports.html b/templates/web/base/admin/reports.html index 071c5f5a5..7d8fe9561 100644 --- a/templates/web/base/admin/reports.html +++ b/templates/web/base/admin/reports.html @@ -2,7 +2,8 @@ [% PROCESS 'admin/report_blocks.html' %] <form method="get" action="[% c.uri_for('reports') %]" enctype="application/x-www-form-urlencoded" accept-charset="utf-8"> - <p><label for="search">[% loc('Search:') %]</label> <input type="text" name="search" size="30" id="search" value="[% searched | html %]"> + <p><label for="search">[% loc('Search:') %]</label> + <input class="form-control" type="text" name="search" size="30" id="search" value="[% searched | html %]"> </form> [% IF problems.size %] diff --git a/templates/web/base/admin/user-form.html b/templates/web/base/admin/user-form.html index 1dfd35cee..5adc200a1 100644 --- a/templates/web/base/admin/user-form.html +++ b/templates/web/base/admin/user-form.html @@ -110,6 +110,14 @@ </label> [% END %] </li> + <li> + <div class="admin-hint"> + <p> + [% loc("Reports from users with high enough reputation will be sent immediately without requiring inspection. Each category's threshold can be managed on its edit page. Users earn reputation when a report they have made is marked as inspected by inspectors.") %] + </p> + </div> + [% loc('Reputation:') %] [% user.get_extra_metadata('reputation') %] + </li> [% END %] [% IF c.user.is_superuser %] diff --git a/templates/web/base/admin/users.html b/templates/web/base/admin/users.html index dfff77ee6..757046bcf 100644 --- a/templates/web/base/admin/users.html +++ b/templates/web/base/admin/users.html @@ -5,7 +5,8 @@ [% loc("User search finds matches in users' names and email addresses.") %] </div> <form method="get" action="[% c.uri_for('users') %]" enctype="application/x-www-form-urlencoded" accept-charset="utf-8"> - <p><label for="search">[% loc('Search:') %]</label> <input type="text" name="search" size="30" id="search" value="[% searched | html %]"> + <p><label for="search">[% loc('Search:') %]</label> + <input class="form-control" type="text" name="search" size="30" id="search" value="[% searched | html %]"> </form> [% IF users.size %] diff --git a/templates/web/base/questionnaire/index.html b/templates/web/base/questionnaire/index.html index 5e6cef3b7..8639a436f 100644 --- a/templates/web/base/questionnaire/index.html +++ b/templates/web/base/questionnaire/index.html @@ -50,20 +50,20 @@ <p class="segmented-control segmented-control--radio"> <input type="radio" name="been_fixed" id="been_fixed_yes" value="Yes"[% ' checked' IF been_fixed == 'Yes' %]> - <label for="been_fixed_yes">[% loc('Yes') %]</label> + <label class="btn" for="been_fixed_yes">[% loc('Yes') %]</label> <input type="radio" name="been_fixed" id="been_fixed_no" value="No"[% ' checked' IF been_fixed == 'No' %]> - <label for="been_fixed_no">[% loc('No') %]</label> + <label class="btn" for="been_fixed_no">[% loc('No') %]</label> <input type="radio" name="been_fixed" id="been_fixed_unknown" value="Unknown"[% ' checked' IF been_fixed == 'Unknown' %]> - <label for="been_fixed_unknown">[% loc('Don’t know') %]</label> + <label class="btn" for="been_fixed_unknown">[% loc('Don’t know') %]</label> </p> [% UNLESS answered_ever_reported %] <p>[% loc('Have you ever reported a problem to a council before, or is this your first time?') %]</p> <p class="segmented-control segmented-control--radio"> <input type="radio" name="reported" id="reported_yes" value="Yes"[% ' checked' IF reported == 'Yes' %]> - <label for="reported_yes">[% loc('Reported before') %]</label> + <label class="btn" for="reported_yes">[% loc('Reported before') %]</label> <input type="radio" name="reported" id="reported_no" value="No"[% ' checked' IF reported == 'No' %]> - <label for="reported_no">[% loc('First time') %]</label> + <label class="btn" for="reported_no">[% loc('First time') %]</label> </p> [% END %] diff --git a/templates/web/base/report/_main.html b/templates/web/base/report/_main.html index 20982c30c..469ee5bc5 100644 --- a/templates/web/base/report/_main.html +++ b/templates/web/base/report/_main.html @@ -126,7 +126,7 @@ %] <div class="moderate-display segmented-control" role="menu"> [% IF permissions.moderate %] - <a class="btn" id="moderate-report" role="menuitem" aria-label="[% loc('Moderate this report') %]">[% loc('Moderate') %]</a> + <a class="js-moderate btn" role="menuitem" aria-label="[% loc('Moderate this report') %]">[% loc('Moderate') %]</a> [% END %] [% IF !hide_inspect_button AND permissions.keys.grep('report_inspect|report_edit_category|report_edit_priority').size %] <a class="btn" href="/report/[% problem.id %]/inspect#side-inspect" role="menuitem"> diff --git a/templates/web/base/report/display_tools.html b/templates/web/base/report/display_tools.html index 5279829e9..f27ed8da5 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?') %]" value="[% loc('Remove from site') %]"> + <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') %]"> </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 } ) %]">[% loc('Report abuse' ) %]</a></li> @@ -43,7 +43,9 @@ <fieldset> <label class="hidden n" for="alert_rznvy">[% loc('Your email') %]</label> <div class="form-txt-submit-box"> + [% IF NOT c.user_exists %] <input type="email" class="form-control" name="rznvy" id="alert_rznvy" value="[% email | html %]" size="30" placeholder="[% loc('Your email') %]"> + [% END %] <input class="green-btn" type="submit" value="[% loc('Subscribe') %]"> </div> <input type="hidden" name="token" value="[% csrf_token %]"> diff --git a/templates/web/base/report/update.html b/templates/web/base/report/update.html index 0c85c132b..7c2c39eb2 100644 --- a/templates/web/base/report/update.html +++ b/templates/web/base/report/update.html @@ -9,7 +9,7 @@ [% IF moderating; original_update = update.moderation_original_data %] <form method="post" action="/moderate/report/[% problem.id %]/update/[% update.id %]"> <input type="hidden" name="token" value="[% csrf_token %]"> - <input type="button" class="btn moderate moderate-display" value="Moderate this update"> + <input type="button" class="btn js-moderate moderate-display" value="Moderate this update"> <div class="moderate-edit"> <label><input type="checkbox" class="hide-document" name="update_hide"> Hide update completely?</label> 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 38f172148..ccea2de02 100644 --- a/templates/web/base/report/update/form_user_loggedout_email.html +++ b/templates/web/base/report/update/form_user_loggedout_email.html @@ -4,4 +4,4 @@ [% END %] <input type="email" name="rznvy" id="form_rznvy" value="[% update.user.email | html %]" placeholder="[% loc('Your email address' ) %]" [% IF required %]required[% END %] - class="required"> + class="form-control required"> diff --git a/templates/web/bristol/footer_extra_js.html b/templates/web/bristol/footer_extra_js.html deleted file mode 100644 index cf8fa7301..000000000 --- a/templates/web/bristol/footer_extra_js.html +++ /dev/null @@ -1 +0,0 @@ -<script src="[% version('/cobrands/fixmystreet-uk-councils/js.js') %]"></script> diff --git a/templates/web/bristol/maps/bristol.html b/templates/web/bristol/maps/bristol.html index 42cb86bf2..7a4a5fbcf 100644 --- a/templates/web/bristol/maps/bristol.html +++ b/templates/web/bristol/maps/bristol.html @@ -1,6 +1,5 @@ [% map_js = BLOCK %] <script type="text/javascript" src="[% version('/js/OpenLayers.2.11.zurich.js') %]"></script> -<script type="text/javascript" src="[% version('/js/OpenLayers.Projection.OrdnanceSurvey.js') %]"></script> <script type="text/javascript" src="[% version('/js/map-OpenLayers.js') %]"></script> <script type="text/javascript" src="[% version('/js/map-wmts-base.js') %]"></script> <script type="text/javascript" src="[% version('/js/map-wmts-bristol.js') %]"></script> diff --git a/templates/web/bromley/report/display.html b/templates/web/bromley/report/display.html index e556098bf..4d3b68f96 100644 --- a/templates/web/bromley/report/display.html +++ b/templates/web/bromley/report/display.html @@ -64,7 +64,7 @@ [% IF field_errors.update %] <div class='form-error'>[% field_errors.update %]</div> [% END %] - <textarea rows="7" cols="30" name="update" id="form_update" placeholder="[% loc('Please write your update here') %]" required>[% update.text | html %]</textarea> + <textarea class="form-control" rows="7" cols="30" name="update" id="form_update" placeholder="[% loc('Please write your update here') %]" required>[% update.text | html %]</textarea> <div class="general-notes"> <p>Please note this comments box can only be used for this report. @@ -114,7 +114,7 @@ [% IF field_errors.email %] <p class='form-error'>[% field_errors.email %]</p> [% END %] - <input type="email" name="rznvy" id="form_rznvy" value="[% update.user.email | html %]" placeholder="[% loc('Your email address' ) %]" required> + <input class="form-control" type="email" name="rznvy" id="form_rznvy" value="[% update.user.email | html %]" placeholder="[% loc('Your email address' ) %]" required> <div id="form_sign_in"> <p>To submit your update you now need to confirm it either by email or by using a FixMyStreet password.</p> @@ -131,7 +131,7 @@ </div> <div class="form-txt-submit-box"> - <input type="password" name="password_register" id="password_register" value="" placeholder="[% loc('Enter a password') %]"> + <input type="password" class="form-control" name="password_register" id="password_register" value="" placeholder="[% loc('Enter a password') %]"> <input class="green-btn js-submit_register" type="submit" name="submit_register" value="[% loc('Post') %]"> </div> </div> @@ -143,7 +143,7 @@ <p class='form-error'>[% field_errors.password %]</p> [% END %] <div class="form-txt-submit-box"> - <input type="password" name="password_sign_in" id="password_sign_in" value="" placeholder="[% loc('Your password') %]"> + <input type="password" class="form-control" name="password_sign_in" id="password_sign_in" value="" placeholder="[% loc('Your password') %]"> <input class="green-btn js-submit_sign_in" type="submit" name="submit_sign_in" value="[% loc('Post') %]"> </div> @@ -176,13 +176,13 @@ [% IF field_errors.first_name %] <p class='form-error'>[% field_errors.first_name %]</p> [% END %] - <input class="js-form-name" type="text" value="[% names.first || first_name | html %]" name="first_name" id="form_first_name" placeholder="[% loc('Your first name') %]"> + <input class="js-form-name form-control" type="text" value="[% names.first || first_name | html %]" name="first_name" id="form_first_name" placeholder="[% loc('Your first name') %]"> <label for="form_last_name">[% loc('Last Name') %]</label> [% IF field_errors.last_name %] <p class='form-error'>[% field_errors.last_name %]</p> [% END %] - <input class="js-form-name" type="text" value="[% names.last || last_name | html %]" name="last_name" id="form_last_name" placeholder="[% loc('Your last name') %]"> + <input class="js-form-name form-control" type="text" value="[% names.last || last_name | html %]" name="last_name" id="form_last_name" placeholder="[% loc('Your last name') %]"> <div class="checkbox-group"> <input type="checkbox" name="may_show_name" id="form_may_show_name" value="1"[% ' checked' IF update AND NOT update.anonymous %]> diff --git a/templates/web/bromley/report/new/form_user.html b/templates/web/bromley/report/new/form_user.html index 71dedc600..634e18c10 100644 --- a/templates/web/bromley/report/new/form_user.html +++ b/templates/web/bromley/report/new/form_user.html @@ -111,7 +111,7 @@ [% IF field_errors.password %] <p class='form-error'>[% field_errors.password %]</p> [% END %] - <input type="password" name="password_sign_in" id="password_sign_in" placeholder="[% loc('Your password') %]" value=""> + <input class="form-control" type="password" name="password_sign_in" id="password_sign_in" placeholder="[% loc('Your password') %]" value=""> <input class="green-btn js-submit_sign_in" type="submit" name="submit_sign_in" value="[% loc('Submit') %]"> </div> diff --git a/templates/web/fixamingata/report/new/form_user_loggedout.html b/templates/web/fixamingata/report/new/form_user_loggedout.html index 7d5b0bf39..24834454c 100644 --- a/templates/web/fixamingata/report/new/form_user_loggedout.html +++ b/templates/web/fixamingata/report/new/form_user_loggedout.html @@ -2,7 +2,7 @@ [% IF field_errors.email %] <p class='form-error'>[% field_errors.email %]</p> [% END %] -<input type="email" value="[% report.user.email | html %]" name="email" id="form_email" placeholder="[% loc('Please enter your email address') %]" required> +<input type="email" class="form-control" value="[% report.user.email | html %]" name="email" id="form_email" placeholder="[% loc('Please enter your email address') %]" required> <div id="form_sign_in"> <h3>[% loc("Now to submit your report…") %]</h3> diff --git a/templates/web/fixmystreet.com/about/privacy.html b/templates/web/fixmystreet.com/about/privacy.html index 2492eee89..8b06d8726 100755 --- a/templates/web/fixmystreet.com/about/privacy.html +++ b/templates/web/fixmystreet.com/about/privacy.html @@ -75,7 +75,9 @@ the cookies and services that this site can use. <p>We use Google Analytics to collect information about how people use this site. We do this to make sure it’s meeting its users’ needs and to understand -how we could do it better. Google Analytics stores information such as what +how we could do it better. + +<p>Google Analytics stores information such as what pages you visit, how long you are on the site, how you got here, what you click on, and information about your web browser. IP addresses are masked (only a portion is stored) and personal information is only reported in aggregate. We @@ -83,18 +85,25 @@ do not allow Google to use or share our analytics data for any purpose besides providing us with analytics information, and we recommend that any user of Google Analytics does the same. -<p>If you’re unhappy with data about your visit to be used in this way, you can -install the <a href="http://tools.google.com/dlpage/gaoptout">official browser -plugin for blocking Google Analytics</a>. - -<p>The cookies set by Google Analytics are as follows: - -<table cellpadding=5> -<tr align="left"><th scope="col">Name</th><th scope="col">Typical Content</th><th scope="col">Expires</th></tr> -<tr><td>_ga</td><td>Used to distinguish users</td><td>2 years</td></tr> -<tr><td>_gat</td><d>Used to throtle request rate</td><td>10 minutes</td></tr> -<tr><td>__utmx / __utmxx</td><td>Which variation of a page you are seeing if we are testing different versions to see which is best</td><td>2 years</td></tr> -</table> +<p>We have also enabled the Advertising Features of Google +Analytics. In particular, we use <b>Demographics and Interest +reporting</b> to identify trends in the types of users visiting our +site, which may be used for internal reporting and improvement of +the site content. + +<p>In technical speak, this allows Google to collect data about your +traffic via Google +<a href="https://www.google.com/policies/technologies/types/">advertising +cookies</a> and +<a href="https://www.google.com/policies/privacy/key-terms/#toc-terms-identifier">anonymous +identifiers</a>, in addition to data collected through a standard +Google Analytics implementation. Regardless of the source of the +data, we strictly adhere to +<a href="https://support.google.com/analytics/answer/2700409">Google’s +policy requirements</a> in our treatment of your data. We do not +facilitate the merging of personally-identifiable information with +non-personally identifiable information collected through any Google +advertising product or feature. <h4>Google’s Official Statement about Analytics Data</h4> @@ -115,8 +124,22 @@ this you may not be able to use the full functionality of this website. By using this website, you consent to the processing of data about you by Google in the manner and for the purposes set out above.”</p> -<p><a href="https://www.mysociety.org/privacy-online/">More general information -on how third party services work</a></p> +<h3>Opting out</h3> +<p>If you’re unhappy with the idea of sharing the fact you +visited our site (and any other sites) with Google, you can +<a href="https://tools.google.com/dlpage/gaoptout/">install the +official browser plugin for blocking Google Analytics</a>. + +<p>If you want to disable advertising-based tracking, you can +<a href="https://www.google.com/settings/ads">adjust your Google Ads +Settings</a>, or opt out of advertising-based tracking across a +number of providers in one go using the +<a href="http://www.networkadvertising.org/choices/">Network +Advertising Initiative’s opt-out form</a>. + +<p>Rest assured, we only track usage data for one reason: to help us +understand how we can make the site work better for you, our +users. <h2>Credits</h2> diff --git a/templates/web/fixmystreet.com/header_extra.html b/templates/web/fixmystreet.com/header_extra.html index 1bccf08d1..4ea87a5e1 100644 --- a/templates/web/fixmystreet.com/header_extra.html +++ b/templates/web/fixmystreet.com/header_extra.html @@ -20,7 +20,7 @@ [% IF c.config.BASE_URL == "https://www.fixmystreet.com" AND not admin AND NOT c.req.header('User-Agent').match('Google Page Speed') %] <script src="//www.google-analytics.com/cx/api.js?experiment=ZwMlZkAhSbK_tP_QG64QrQ"></script> <script nonce="[% csp_nonce %]"> -var variation = cxApi.chooseVariation(), +var variation = typeof cxApi !== "undefined" ? cxApi.chooseVariation() : 0, docElement = document.documentElement, className = docElement.className; if (!/about\/council/.test(location.pathname)) { diff --git a/templates/web/fixmystreet.com/report/new/extra_name.html b/templates/web/fixmystreet.com/report/new/extra_name.html index f329541c3..91f70dd8d 100644 --- a/templates/web/fixmystreet.com/report/new/extra_name.html +++ b/templates/web/fixmystreet.com/report/new/extra_name.html @@ -10,13 +10,13 @@ shared with the council or displayed publicly.</em> [% SET gender = report.get_extra_metadata('gender') %] <p class="segmented-control segmented-control--radio" style="font-size: 80%"> <input type="radio" name="gender" id="gender_female" value="female"[% ' checked' IF gender == 'female' %]> - <label for="gender_female">Female</label> + <label class="btn" for="gender_female">Female</label> <input type="radio" name="gender" id="gender_male" value="male"[% ' checked' IF gender == 'male' %]> - <label for="gender_male">Male</label> + <label class="btn" for="gender_male">Male</label> <input type="radio" name="gender" id="gender_other" value="other"[% ' checked' IF gender == 'other' %]> - <label for="gender_other">Other</label> + <label class="btn" for="gender_other">Other</label> <input type="radio" name="gender" id="gender_unknown" value="unknown"[% ' checked' IF gender == 'unknown' %]> - <label for="gender_unknown">Prefer not to say</label> + <label class="btn" for="gender_unknown">Prefer not to say</label> </p> [% END %] diff --git a/web/cobrands/fixmystreet/fixmystreet.js b/web/cobrands/fixmystreet/fixmystreet.js index 4d222dc24..4aeb14d88 100644 --- a/web/cobrands/fixmystreet/fixmystreet.js +++ b/web/cobrands/fixmystreet/fixmystreet.js @@ -833,7 +833,7 @@ $.extend(fixmystreet.set_up, { function add_handlers (elem, word) { elem.each( function () { var $elem = $(this); - $elem.find('#moderate-report').on('click', function () { + $elem.find('.js-moderate').on('click', function () { $elem.find('.moderate-display').hide(); $elem.find('.moderate-edit').show(); }); diff --git a/web/js/OpenLayers.Projection.OrdnanceSurvey.js b/web/js/OpenLayers.Projection.OrdnanceSurvey.js index bb596d3bf..85574d8e0 100644 --- a/web/js/OpenLayers.Projection.OrdnanceSurvey.js +++ b/web/js/OpenLayers.Projection.OrdnanceSurvey.js @@ -39,6 +39,8 @@ * */ +if (typeof OpenLayers !== "undefined") { + OpenLayers.Projection.OS = { /** @@ -487,3 +489,5 @@ OpenLayers.Projection.addTransform("EPSG:900913", "EPSG:27700", OpenLayers.Projection.OS.goog2osgb); OpenLayers.Projection.addTransform("EPSG:27700", "EPSG:900913", OpenLayers.Projection.OS.osgb2goog); + +} diff --git a/web/js/fixmystreet-admin.js b/web/js/fixmystreet-admin.js index aa79a9b46..6f4580feb 100644 --- a/web/js/fixmystreet-admin.js +++ b/web/js/fixmystreet-admin.js @@ -79,5 +79,15 @@ $(function(){ var show_area = $(this).val() == $(this).find("[data-originally-selected]").val(); $("form#user_edit select#area_id").closest("li").toggle(show_area); }); + + // On category edit page, hide the reputation input if inspection isn't required + $("form#category_edit #inspection_required").change(function() { + var $p = $("form#category_edit #reputation_threshold").closest("p"); + if (this.checked) { + $p.removeClass("hidden"); + } else { + $p.addClass("hidden"); + } + }); }); |