diff options
26 files changed, 73 insertions, 118 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 9af06e8df..86edec034 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,8 @@ - Upgrade the underlying framework and a number of other packages. - Add feature cobrand helper function. - Add front-end testing support for WSL. + - Allow cobrands to disable admin resending. + - Sass variables for default link colour and decoration. - Open311 improvements: - Support use of 'private' service definition <keywords> to mark reports made in that category private. diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm index e9c9b6174..2de274c61 100644 --- a/perllib/FixMyStreet/App/Controller/Admin.pm +++ b/perllib/FixMyStreet/App/Controller/Admin.pm @@ -460,7 +460,7 @@ sub report_edit : Path('report_edit') : Args(1) { $c->detach('report_edit_display') if $done; } - if ( $c->get_param('resend') ) { + if ( $c->get_param('resend') && !$c->cobrand->call_hook('disable_resend') ) { $c->forward('/auth/check_csrf_token'); $problem->resend; @@ -572,13 +572,14 @@ sub report_edit_category : Private { my ($self, $c, $problem, $no_comment) = @_; if ((my $category = $c->get_param('category')) ne $problem->category) { + my $disable_resend = $c->cobrand->call_hook('disable_resend'); my $category_old = $problem->category; $problem->category($category); my @contacts = grep { $_->category eq $problem->category } @{$c->stash->{contacts}}; my @new_body_ids = map { $_->body_id } @contacts; # If the report has changed bodies (and not to a subset!) we need to resend it my %old_map = map { $_ => 1 } @{$problem->bodies_str_ids}; - if (grep !$old_map{$_}, @new_body_ids) { + if (!$disable_resend && grep !$old_map{$_}, @new_body_ids) { $problem->resend; } # If the send methods of the old/new contacts differ we need to resend the report @@ -589,7 +590,7 @@ sub report_edit_category : Private { : $c->cobrand->_fallback_body_sender()->{method}; } @contacts; my %old_send_methods = map { $_ => 1 } split /,/, ($problem->send_method_used || "Email"); - if (grep !$old_send_methods{$_}, @new_send_methods) { + if (!$disable_resend && grep !$old_send_methods{$_}, @new_send_methods) { $problem->resend; } diff --git a/perllib/FixMyStreet/Cobrand/Bexley.pm b/perllib/FixMyStreet/Cobrand/Bexley.pm index af344e545..1f16b817e 100644 --- a/perllib/FixMyStreet/Cobrand/Bexley.pm +++ b/perllib/FixMyStreet/Cobrand/Bexley.pm @@ -21,6 +21,8 @@ sub disambiguate_location { }; } +sub disable_resend { 1 } + sub on_map_default_status { 'open' } sub open311_munge_update_params { diff --git a/t/cobrand/bexley.t b/t/cobrand/bexley.t index 40908b869..f72b7e7c4 100644 --- a/t/cobrand/bexley.t +++ b/t/cobrand/bexley.t @@ -53,6 +53,7 @@ FixMyStreet::override_config { $mech->content_contains('Bexley'); }; + my $report; foreach my $test ( { category => 'Abandoned and untaxed vehicles', email => 1, code => 'ABAN', extra => { 'name' => 'burnt', description => 'Was it burnt?', 'value' => 'Yes' } }, @@ -79,9 +80,9 @@ FixMyStreet::override_config { { category => 'Lamp post', code => 'LAMP', email => 'p1.*thirdparty', extra => { 'name' => 'dangerous', description => 'Was it dangerous?', 'value' => 'Yes' } }, ) { - my ($report) = $mech->create_problems_for_body(1, $body->id, 'On Road', { + ($report) = $mech->create_problems_for_body(1, $body->id, 'On Road', { category => $test->{category}, cobrand => 'bexley', - latitude => 51.408484, longitude => 0.074653, + latitude => 51.408484, longitude => 0.074653, areas => '2494', }); if ($test->{extra}) { $report->set_extra_fields(ref $test->{extra} eq 'ARRAY' ? @{$test->{extra}} : $test->{extra}); @@ -110,6 +111,14 @@ FixMyStreet::override_config { }; } + subtest 'resend is disabled in admin' => sub { + my $user = $mech->log_in_ok('super@example.org'); + $user->update({ from_body => $body, is_superuser => 1 }); + $mech->get_ok('/admin/report_edit/' . $report->id); + $mech->content_contains('View report on site'); + $mech->content_lacks('Resend report'); + }; + }; subtest 'nearest road returns correct road' => sub { diff --git a/templates/web/base/admin/report_edit.html b/templates/web/base/admin/report_edit.html index e7d126558..da800ff71 100644 --- a/templates/web/base/admin/report_edit.html +++ b/templates/web/base/admin/report_edit.html @@ -81,7 +81,7 @@ class="admin-offsite-link">[% problem.latitude %], [% problem.longitude %]</a> [% IF problem.send_method_used %] ([% problem.send_method_used %]) [% END %] - [% IF problem.state == 'confirmed' AND problem.whensent %] + [% IF problem.state == 'confirmed' AND problem.whensent AND NOT c.cobrand.disable_resend %] <input data-confirm="[% loc('Are you sure?') %]" class="btn" type="submit" name="resend" value="[% loc('Resend report') %]"> [% ELSIF NOT problem.whensent %] <input type="submit" class="btn" name="mark_sent" value="[% loc('Mark as sent') %]"> diff --git a/web/cobrands/bathnes/base.scss b/web/cobrands/bathnes/base.scss index f84323b1c..611f71094 100644 --- a/web/cobrands/bathnes/base.scss +++ b/web/cobrands/bathnes/base.scss @@ -4,10 +4,6 @@ @import "../sass/base"; -a { color: $link-colour; } -a:visited { color: $link-visited-colour; } -a:active, a:hover { color: $link-hover-colour; } - @import "pattern-lib/header"; @import "pattern-lib/navigation"; @import "pattern-lib/footer"; diff --git a/web/cobrands/bexley/_colours.scss b/web/cobrands/bexley/_colours.scss index e2c1657bb..615ef65a4 100644 --- a/web/cobrands/bexley/_colours.scss +++ b/web/cobrands/bexley/_colours.scss @@ -21,10 +21,10 @@ $sprint_lt: #B8E26A; $text_black: #0B0C0C; $text_grey: #6F777B; -$link: #005EA5; -$hover: #2B8CC4; -$visited: #4C2C92; -$focus: #FFBF47; +$link-color: #005EA5; +$link-hover-color: #2B8CC4; +$link-visited-color: #4C2C92; +$link-focus-color: #FFBF47; $grey_border: #BFC1C3; $grey_panel: #DEE0E2; diff --git a/web/cobrands/bexley/base.scss b/web/cobrands/bexley/base.scss index bedd5b21b..7132f33ab 100644 --- a/web/cobrands/bexley/base.scss +++ b/web/cobrands/bexley/base.scss @@ -71,28 +71,11 @@ small { a, .fake-link { - text-decoration: none; - color: $link; - - &:visited { - color: $visited; - } - - &:hover, - &:active { - text-decoration: underline; - color: $hover; - } - &:focus { - color: $focus; + color: $link-focus-color; } } -.dz-clickable .dz-message u { - color: $link; -} - .btn-primary, .green-btn, .btn--primary { diff --git a/web/cobrands/bristol/_colours.scss b/web/cobrands/bristol/_colours.scss index 4e72e90b3..cd87161a8 100644 --- a/web/cobrands/bristol/_colours.scss +++ b/web/cobrands/bristol/_colours.scss @@ -19,6 +19,9 @@ $primary: $bcc_red; $primary_b: $g1; $primary_text: $g1; +$link-color: $b3; +$link-hover-color: $b3; + $base_bg: white; $base_fg: $g1; diff --git a/web/cobrands/bristol/base.scss b/web/cobrands/bristol/base.scss index e0dc1bdb5..dea303f42 100644 --- a/web/cobrands/bristol/base.scss +++ b/web/cobrands/bristol/base.scss @@ -109,12 +109,6 @@ dl dt { } } -p, dd, aside { - a, a:visited, a:hover { - color: $b3; - } -} - a#geolocate_link { color: $b3; } diff --git a/web/cobrands/bromley/_colours.scss b/web/cobrands/bromley/_colours.scss index 1eb0b8bdb..f00922435 100644 --- a/web/cobrands/bromley/_colours.scss +++ b/web/cobrands/bromley/_colours.scss @@ -10,6 +10,10 @@ $primary: $bromley_blue; $primary_b: #ffffff; $primary_text: #ffffff; +$link-color: $bromley_green; +$link-hover-color: $bromley_green; +$link-visited-color: $bromley_dark_green; + $base_bg: #f4f4f4; $base_fg: #1a1a1a; diff --git a/web/cobrands/bromley/base.scss b/web/cobrands/bromley/base.scss index 9435aa35d..b2492d928 100644 --- a/web/cobrands/bromley/base.scss +++ b/web/cobrands/bromley/base.scss @@ -63,17 +63,15 @@ body.frontpage.fullwidthpage { // Override the links to match Bromley's a { - text-decoration:none; - color: $bromley_green; opacity: 1; } + a:hover { opacity: 0.8; - text-decoration:underline; } -a:visited, + a:active { - color: $bromley_dark_green; + color: $link-visited-color; } // The map page header looks a bit high for some reason diff --git a/web/cobrands/buckinghamshire/_colours.scss b/web/cobrands/buckinghamshire/_colours.scss index 1557b790c..9a5f36960 100644 --- a/web/cobrands/buckinghamshire/_colours.scss +++ b/web/cobrands/buckinghamshire/_colours.scss @@ -22,6 +22,9 @@ $primary: $bucks_dark_green; $primary_b: $g1; $primary_text: $g1; +$link-color: $b3; +$link-hover-color: $b3; + $base_bg: white; $base_fg: $g1; diff --git a/web/cobrands/buckinghamshire/base.scss b/web/cobrands/buckinghamshire/base.scss index 0d3e6ec74..1d9edf02f 100644 --- a/web/cobrands/buckinghamshire/base.scss +++ b/web/cobrands/buckinghamshire/base.scss @@ -74,12 +74,6 @@ dl dt { } } -p, dd, aside { - a, a:visited, a:hover { - color: $b3; - } -} - a#geolocate_link { color: $b3; } diff --git a/web/cobrands/hart/_colours.scss b/web/cobrands/hart/_colours.scss index 7a4da5b43..d79126bae 100644 --- a/web/cobrands/hart/_colours.scss +++ b/web/cobrands/hart/_colours.scss @@ -9,6 +9,9 @@ $col_fixed_label: $hart_primary; $primary_b: #000000; $primary_text: #ffffff; +$link-color: #369; +$link-hover-color: #369; + $base_bg: #ffffff; $base_fg: #1a1a1a; diff --git a/web/cobrands/hart/base.scss b/web/cobrands/hart/base.scss index 62a4250f3..ffcf1c256 100644 --- a/web/cobrands/hart/base.scss +++ b/web/cobrands/hart/base.scss @@ -4,13 +4,6 @@ @import "../sass/base"; -a, a:visited { - color: #369; - &:hover, &:active { - color: #369; - } -} - .item-list--reports__item { color: #666; a { diff --git a/web/cobrands/lincolnshire/_colours.scss b/web/cobrands/lincolnshire/_colours.scss index 7adecfdcb..8d8ad2bf4 100644 --- a/web/cobrands/lincolnshire/_colours.scss +++ b/web/cobrands/lincolnshire/_colours.scss @@ -27,6 +27,10 @@ $primary: $lincs-highlight; $primary_b: $lincs-pop; $primary_text: $lincs-text; +$link-color: $lincs-link; +$link-hover-color: $lincs-link-hover; +$link-visited-color: $lincs-link-visited; + $base_bg: $lincs-page; $base_fg: #000; diff --git a/web/cobrands/lincolnshire/base.scss b/web/cobrands/lincolnshire/base.scss index de1e4789f..edae2baec 100644 --- a/web/cobrands/lincolnshire/base.scss +++ b/web/cobrands/lincolnshire/base.scss @@ -14,20 +14,6 @@ h1, h2, h3 { font-weight: bold; } -a { - color: $lincs-link; - - &:visited { - color: $lincs-link-visited; - } - - &:hover, - &:active, - &:focus { - color: $lincs-link-hover; - } -} - #site-header { background-color: $primary; border-top: 0; diff --git a/web/cobrands/northamptonshire/_colours.scss b/web/cobrands/northamptonshire/_colours.scss index 0dfd512a7..17c7822fb 100644 --- a/web/cobrands/northamptonshire/_colours.scss +++ b/web/cobrands/northamptonshire/_colours.scss @@ -12,6 +12,10 @@ $primary: $green; $primary_b: $dark; $primary_text: $white; +$link-color: $blue; +$link-hover-color: $blue; +$link-visited-color: $blue; + $base_bg: $white; $base_fg: $dark; diff --git a/web/cobrands/northamptonshire/base.scss b/web/cobrands/northamptonshire/base.scss index 55a4e6610..9f01a6b6e 100644 --- a/web/cobrands/northamptonshire/base.scss +++ b/web/cobrands/northamptonshire/base.scss @@ -22,26 +22,6 @@ color: $white; } -a, -.fake-link { - text-decoration: none; - color: $blue; - - &:visited { - color: $blue; - } - - &:hover, - &:active { - text-decoration: underline; - color: $blue; - } -} - -.dz-clickable .dz-message u { - color: $blue; -} - .btn-primary, .green-btn, .btn--primary { diff --git a/web/cobrands/oxfordshire/_colours.scss b/web/cobrands/oxfordshire/_colours.scss index a42d96b2b..7ef941660 100644 --- a/web/cobrands/oxfordshire/_colours.scss +++ b/web/cobrands/oxfordshire/_colours.scss @@ -15,6 +15,9 @@ $primary: $color-oxfordshire-bright-green; $primary_b: $color-oxfordshire-dark-green; $primary_text: #fff; +$link-color: $color-oxfordshire-link-blue; +$link-hover-color: $color-oxfordshire-bright-yellow; + $base_bg: #cfcfcf; $base_fg: #333; diff --git a/web/cobrands/oxfordshire/base.scss b/web/cobrands/oxfordshire/base.scss index a14e018b2..989c3b19c 100644 --- a/web/cobrands/oxfordshire/base.scss +++ b/web/cobrands/oxfordshire/base.scss @@ -16,17 +16,9 @@ body { color: #333; } -a { - color: $color-oxfordshire-link-blue; - - &:hover { - color: $color-oxfordshire-bright-yellow; - } - - a:not([class]):focus { - background-color: $color-oxfordshire-bright-yellow; - outline: 2px solid $color-oxfordshire-bright-yellow; - } +a:not([class]):focus { + background-color: $color-oxfordshire-bright-yellow; + outline: 2px solid $color-oxfordshire-bright-yellow; } .form-control, @@ -126,12 +118,12 @@ a { padding: 0; background: transparent; font-size: inherit; - color: $color-oxfordshire-link-blue; + color: $link-color; margin-top: 0.5em; &:hover { background-color: transparent; - color: $color-oxfordshire-bright-yellow; + color: $link-hover-color; } &:focus { diff --git a/web/cobrands/sass/_base.scss b/web/cobrands/sass/_base.scss index b410649a8..ce81a8a08 100644 --- a/web/cobrands/sass/_base.scss +++ b/web/cobrands/sass/_base.scss @@ -5,6 +5,12 @@ $meta-font: Helmet, Freesans, sans-serif !default; $heading-font: 'Museo300-display', MuseoSans, Helmet, Freesans, sans-serif !default; $menu-image: 'menu-white' !default; +$link-color: #005ea5 !default; +$link-hover-color: #2b8cc4 !default; +$link-visited-color: $link-color !default; +$link-text-decoration: none !default; +$link-hover-text-decoration: underline !default; + $itemlist_item_background: #f6f6f6 !default; $itemlist_item_background_hover: #e6e6e6 !default; $col_big_numbers: #ccc !default; @@ -184,17 +190,17 @@ select { a, .fake-link { - text-decoration: none; - color: #0BA7D1; + text-decoration: $link-text-decoration; + color: $link-color; &:visited { - color: #0BA7D1; + color: $link-visited-color; } &:hover, &:active { - text-decoration: underline; - color: #0D7CCE; + text-decoration: $link-hover-text-decoration; + color: $link-hover-color; } } diff --git a/web/cobrands/sass/_dropzone.scss b/web/cobrands/sass/_dropzone.scss index 0d440c85b..0bd616b16 100644 --- a/web/cobrands/sass/_dropzone.scss +++ b/web/cobrands/sass/_dropzone.scss @@ -1,5 +1,5 @@ -$dropzone-link-color: #0BA7D1; // match default `a` styling -$dropzone-link-color--awakened: #0D7CCE; // match default `a:hover` styling +$dropzone-link-color: $link-color; +$dropzone-link-color--awakened: $link-hover-color; $dropzone-border-color--awakened: $dropzone-link-color--awakened; $dropzone-border-color--full: #bf002a; $dropzone-background-color: #fff; diff --git a/web/cobrands/zurich/_colours.scss b/web/cobrands/zurich/_colours.scss index 4b59cfe28..d5b391ba1 100644 --- a/web/cobrands/zurich/_colours.scss +++ b/web/cobrands/zurich/_colours.scss @@ -7,6 +7,9 @@ $primary: $zurich_blue; $primary_b: $dark_blue; $primary_text: #fff; +$link-color: #126094; +$link-hover-color: lighten(#126094, 5%); + $base_bg: #fff; $base_fg: #3c3c3c; diff --git a/web/cobrands/zurich/_zurich.scss b/web/cobrands/zurich/_zurich.scss index e4ff44220..d1f6991c5 100644 --- a/web/cobrands/zurich/_zurich.scss +++ b/web/cobrands/zurich/_zurich.scss @@ -1,13 +1,5 @@ // Some things from the Zurich stylesheet -a { - color: #126094; - text-decoration: none; -} -a:hover { - text-decoration: underline; -} - #zurich-footer { margin: 2em auto; // mySociety font-size: 67.5%; |