diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2019-05-08 11:22:10 +0100 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2019-05-28 15:36:25 +0100 |
commit | d68c2cf2d1a227c4a5f446e78290f0835a869a25 (patch) | |
tree | c357e4bbf66328fbe480d9bede53f47f6d5d7a64 | |
parent | d41f072a30c4a91925771d38fb224ee271805d8f (diff) |
[Bexley] Initial cobrand.
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Bexley.pm | 54 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/UK.pm | 1 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/UKCouncils.pm | 7 | ||||
-rw-r--r-- | t/cobrand/bexley.t | 32 | ||||
-rw-r--r-- | t/open311/post-service-request-updates.t | 25 | ||||
-rw-r--r-- | templates/email/bexley/_email_color_overrides.html | 19 | ||||
-rw-r--r-- | templates/web/bexley/footer_extra_js.html | 13 | ||||
-rw-r--r-- | templates/web/bexley/header_extra.html | 1 | ||||
-rw-r--r-- | templates/web/bexley/header_logo.html | 2 | ||||
-rw-r--r-- | templates/web/bexley/main_nav_items.html | 55 | ||||
-rw-r--r-- | templates/web/bexley/tracking_code.html | 15 | ||||
-rw-r--r-- | templates/web/fixmystreet.com/footer_extra_js.html | 1 | ||||
-rw-r--r-- | web/cobrands/bexley/_colours.scss | 53 | ||||
-rw-r--r-- | web/cobrands/bexley/base.scss | 125 | ||||
-rw-r--r-- | web/cobrands/bexley/images/logo.png | bin | 0 -> 7250 bytes | |||
-rw-r--r-- | web/cobrands/bexley/js.js | 48 | ||||
-rw-r--r-- | web/cobrands/bexley/layout.scss | 33 |
17 files changed, 484 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Bexley.pm b/perllib/FixMyStreet/Cobrand/Bexley.pm new file mode 100644 index 000000000..6b1573ced --- /dev/null +++ b/perllib/FixMyStreet/Cobrand/Bexley.pm @@ -0,0 +1,54 @@ +package FixMyStreet::Cobrand::Bexley; +use parent 'FixMyStreet::Cobrand::Whitelabel'; + +use strict; +use warnings; + +sub council_area_id { 2494 } +sub council_area { 'Bexley' } +sub council_name { 'London Borough of Bexley' } +sub council_url { 'bexley' } +sub example_places { ( 'DA6 7AT', "Chieveley Road" ) } +sub get_geocoder { 'OSM' } + +sub enable_category_groups { 1 } +sub suggest_duplicates { 1 } + +sub base_url { + my $self = shift; + return $self->next::method() if FixMyStreet->config('STAGING_SITE'); + # uncoverable statement + return 'https://fix.bexley.gov.uk'; +} + +sub disambiguate_location { + my $self = shift; + my $string = shift; + + return { + %{ $self->SUPER::disambiguate_location() }, + centre => '51.46088,0.142359', + bounds => [ 51.408484, 0.074653, 51.515542, 0.2234676 ], + }; +} + +sub on_map_default_status { 'open' } + +sub contact_email { + my $self = shift; + return join( '@', 'customer.services', $self->council_url . '.gov.uk' ); +} + +sub open311_munge_update_params { + my ($self, $params, $comment, $body) = @_; + + $params->{service_request_id_ext} = $comment->problem->id; + + my $contact = $comment->result_source->schema->resultset("Contact")->not_deleted->find({ + body_id => $body->id, + category => $comment->problem->category + }); + $params->{service_code} = $contact->email; +} + +1; diff --git a/perllib/FixMyStreet/Cobrand/UK.pm b/perllib/FixMyStreet/Cobrand/UK.pm index 1c6ebe29a..da0356664 100644 --- a/perllib/FixMyStreet/Cobrand/UK.pm +++ b/perllib/FixMyStreet/Cobrand/UK.pm @@ -107,6 +107,7 @@ sub short_name { return 'Durham+County' if $name eq 'Durham County Council'; return 'Durham+City' if $name eq 'Durham City Council'; + $name =~ s/^London Borough of //; $name =~ s/ (Borough|City|District|County) Council$//; $name =~ s/ Council$//; $name =~ s/ & / and /; diff --git a/perllib/FixMyStreet/Cobrand/UKCouncils.pm b/perllib/FixMyStreet/Cobrand/UKCouncils.pm index 0926dec4a..09ca6c535 100644 --- a/perllib/FixMyStreet/Cobrand/UKCouncils.pm +++ b/perllib/FixMyStreet/Cobrand/UKCouncils.pm @@ -159,6 +159,13 @@ sub all_reports_single_body { sub reports_body_check { my ( $self, $c, $code ) = @_; + # Deal with Bexley name not starting with short name + if ($code =~ /bexley/i) { + my $body = $c->model('DB::Body')->search( { name => { -like => "%$code%" } } )->single; + $c->stash->{body} = $body; + return $body; + } + # We want to make sure we're only on our page. unless ( $self->council_name =~ /^\Q$code\E/ ) { $c->res->redirect( 'https://www.fixmystreet.com' . $c->req->uri->path_query, 301 ); diff --git a/t/cobrand/bexley.t b/t/cobrand/bexley.t new file mode 100644 index 000000000..7f67dc1a4 --- /dev/null +++ b/t/cobrand/bexley.t @@ -0,0 +1,32 @@ +use FixMyStreet::TestMech; + +use_ok 'FixMyStreet::Cobrand::Bexley'; + +my $cobrand = FixMyStreet::Cobrand::Bexley->new; +like $cobrand->contact_email, qr/bexley/; +is $cobrand->on_map_default_status, 'open'; +is_deeply $cobrand->disambiguate_location->{bounds}, [ 51.408484, 0.074653, 51.515542, 0.2234676 ]; + +my $mech = FixMyStreet::TestMech->new; + +$mech->create_body_ok(2494, 'London Borough of Bexley'); + +FixMyStreet::override_config { + ALLOWED_COBRANDS => [ 'bexley' ], + MAPIT_URL => 'http://mapit.uk/', +}, sub { + + subtest 'cobrand displays council name' => sub { + ok $mech->host("bexley.fixmystreet.com"), "change host to bexley"; + $mech->get_ok('/'); + $mech->content_contains('Bexley'); + }; + + subtest 'cobrand displays council name' => sub { + $mech->get_ok('/reports/Bexley'); + $mech->content_contains('Bexley'); + }; + +}; + +done_testing(); diff --git a/t/open311/post-service-request-updates.t b/t/open311/post-service-request-updates.t index 6a7bc6ff2..ac6fb870c 100644 --- a/t/open311/post-service-request-updates.t +++ b/t/open311/post-service-request-updates.t @@ -62,6 +62,7 @@ my $other_user = $mech->create_user_ok('test2@example.com', title => 'MRS'); sub c { my ($p, $user) = @_; my $c = $mech->create_comment_for_problem($p, $user || $p->user, 'Name', 'Update text', 'f', 'confirmed', 'confirmed', { confirmed => \'current_timestamp' }); + $c->discard_changes; return $c; } @@ -96,6 +97,30 @@ subtest 'Send comments' => sub { }; }; +subtest 'Check Bexley munging' => sub { + FixMyStreet::override_config { + ALLOWED_COBRANDS => ['fixmystreet', 'bexley'], + }, sub { + my $bexley = $mech->create_body_ok(2494, 'Bexley', $params); + $mech->create_contact_ok(body_id => $bexley->id, category => 'Other', email => "OTHER"); + + my $test_res = HTTP::Response->new(); + $test_res->code(200); + $test_res->message('OK'); + $test_res->content('<?xml version="1.0" encoding="utf-8"?><service_request_updates><request_update><update_id>248</update_id></request_update></service_request_updates>'); + my $o = Open311->new( + fixmystreet_body => $bexley, + test_mode => 1, + test_get_returns => { 'servicerequestupdates.xml' => $test_res }, + ); + my ($p5, $c5) = p_and_c($bexley); + my $id = $o->post_service_request_update($c5); + is $id, 248, 'correct update ID returned'; + like $o->test_req_used->content, qr/service_code=OTHER/, 'Service code included'; + }; +}; + + subtest 'Oxfordshire gets an ID' => sub { FixMyStreet::override_config { ALLOWED_COBRANDS => ['fixmystreet', 'bromley', 'buckinghamshire', 'lewisham', 'oxfordshire'], diff --git a/templates/email/bexley/_email_color_overrides.html b/templates/email/bexley/_email_color_overrides.html new file mode 100644 index 000000000..5645da3ef --- /dev/null +++ b/templates/email/bexley/_email_color_overrides.html @@ -0,0 +1,19 @@ +[% + +color_fuchsia = '#912B88' +color_spring = '#5DA70E' +color_white = '#fff' + +header_background_color = color_fuchsia +header_text_color = color_white + +secondary_column_background_color = color_white + +button_background_color = color_spring +button_text_color = color_white + +logo_width = "200" # pixel measurement, but without 'px' suffix +logo_height = "80" # pixel measurement, but without 'px' suffix +logo_file = "logo.png" + +%] diff --git a/templates/web/bexley/footer_extra_js.html b/templates/web/bexley/footer_extra_js.html new file mode 100644 index 000000000..f4b5652a1 --- /dev/null +++ b/templates/web/bexley/footer_extra_js.html @@ -0,0 +1,13 @@ +[% scripts.push( + version('/cobrands/fixmystreet-uk-councils/js.js'), +) %] +[%~ +IF bodyclass.match('mappage'); + scripts.push( + version('/vendor/OpenLayers.Projection.OrdnanceSurvey.js'), + version('/cobrands/fixmystreet/assets.js'), + version('/cobrands/bexley/js.js'), + version('/cobrands/highways/assets.js'), + ); +END +%] diff --git a/templates/web/bexley/header_extra.html b/templates/web/bexley/header_extra.html new file mode 100644 index 000000000..c5b1dcc6e --- /dev/null +++ b/templates/web/bexley/header_extra.html @@ -0,0 +1 @@ +<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lato:400,400i,700"> diff --git a/templates/web/bexley/header_logo.html b/templates/web/bexley/header_logo.html new file mode 100644 index 000000000..f0f9b2cc8 --- /dev/null +++ b/templates/web/bexley/header_logo.html @@ -0,0 +1,2 @@ + <a href="https://www.bexley.gov.uk" id="site-logo">London Borough of Bexley</a> + <a href="/" id="report-cta" title="[%- loc('Report a problem') -%]">[%- loc('Report') -%]</a> diff --git a/templates/web/bexley/main_nav_items.html b/templates/web/bexley/main_nav_items.html new file mode 100644 index 000000000..44edd68a8 --- /dev/null +++ b/templates/web/bexley/main_nav_items.html @@ -0,0 +1,55 @@ +[%~ IF problem ~%] + [%~ INCLUDE navitem uri='/report/new?longitude=' _ problem.longitude _ '&latitude=' _ problem.latitude label=loc('Report another problem here') attrs='class="report-a-problem-btn"' ~%] +[%~ ELSIF latitude AND longitude ~%] + [%~ INCLUDE navitem uri='/report/new?longitude=' _ longitude _ '&latitude=' _ latitude label=loc('Report a problem here') attrs='class="report-a-problem-btn"' ~%] +[%~ ELSIF homepage_template ~%] + [%~ INCLUDE navitem uri='/report' label=loc('Report a problem') attrs='class="report-a-problem-btn"' ~%] +[%~ ELSE ~%] + [%~ INCLUDE navitem uri='/' label=loc('Report a problem') attrs='class="report-a-problem-btn"' ~%] +[%~ END ~%] + +[%~ UNLESS hide_all_reports_link ~%] + [%~ + IF c.user_exists AND c.user.categories.size; + categories = c.user.categories_string | uri; + cat_suffix = "?filter_category=" _ categories; + END; + + reports_uri = '/reports'; + IF body_name; + body_name = body_name | uri; + reports_uri = "${reports_uri}/${body_name}"; + END; + + INCLUDE navitem uri=reports_uri label=loc('All reports') suffix=cat_suffix; + ~%] +[%~ END ~%] + +[%~ + IF pc; + pc_uri = pc | uri; + pc_suffix = "/list?pc=" _ pc_uri; + END; + + INCLUDE navitem uri='/alert' label=loc('Local alerts') suffix=pc_suffix; +~%] + +[%~ INCLUDE navitem uri='/faq' label=loc('Help') ~%] + +[%~ UNLESS hide_privacy_link ~%] + [%~ INCLUDE navitem uri='/privacy' label=loc('Privacy') liattrs='class="nav-menu__item--privacy"' ~%] +[%~ END ~%] + +[%~ IF c.user_exists ~%] + [%~ INCLUDE navitem uri='/my' label=loc('Your account') ~%] +[%~ ELSE ~%] + [%~ INCLUDE navitem uri='/auth' label=loc('Sign in') ~%] +[%~ END ~%] + +[%~ IF c.user_exists AND c.user.has_body_permission_to('planned_reports') ~%] + [%~ INCLUDE navitem always_url=1 uri='/my/planned' label=loc('Shortlist') ~%] +[%~ END ~%] + +[%~ IF c.user_exists AND c.cobrand.admin_allow_user(c.user) ~%] + [%~ INCLUDE navitem uri='/admin' label=loc('Admin') ~%] +[%~ END ~%] diff --git a/templates/web/bexley/tracking_code.html b/templates/web/bexley/tracking_code.html new file mode 100644 index 000000000..dff0b4607 --- /dev/null +++ b/templates/web/bexley/tracking_code.html @@ -0,0 +1,15 @@ +[% IF c.config.BASE_URL == "https://www.fixmystreet.com" %] +<script nonce="[% csp_nonce %]"> +(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ +(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), +m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) +})(window,document,'script','//www.google-analytics.com/analytics.js','ga'); + +ga('create', 'UA-96119487-1', 'auto'); +ga('set', 'anonymizeIp', true); +ga('send', 'pageview'); + +</script> +[% ELSE %] +<!-- Tracking code not inserted as "[% c.config.BASE_URL %]" not "https://www.fixmystreet.com" --> +[% END %] diff --git a/templates/web/fixmystreet.com/footer_extra_js.html b/templates/web/fixmystreet.com/footer_extra_js.html index cb570a169..61f260fe8 100644 --- a/templates/web/fixmystreet.com/footer_extra_js.html +++ b/templates/web/fixmystreet.com/footer_extra_js.html @@ -6,6 +6,7 @@ IF bodyclass.match('mappage'); scripts.push( version('/cobrands/fixmystreet/assets.js') ); scripts.push( version('/cobrands/fixmystreet-uk-councils/alloy.js') ); scripts.push( version('/cobrands/bathnes/assets.js') ); + scripts.push( version('/cobrands/bexley/js.js') ); scripts.push( version('/cobrands/bristol/assets.js') ); scripts.push( version('/cobrands/bromley/assets.js') ); scripts.push( version('/cobrands/buckinghamshire/assets.js') ); diff --git a/web/cobrands/bexley/_colours.scss b/web/cobrands/bexley/_colours.scss new file mode 100644 index 000000000..e2c1657bb --- /dev/null +++ b/web/cobrands/bexley/_colours.scss @@ -0,0 +1,53 @@ +/* COLOURS */ + +$menu-image: 'menu-white'; + +$mappage-header-height: 128px; + +$white: #fff; + +$red: #B10E1E; + +$royal: #2E358B; +$fuchsia: #912B88; +$aqua: #00A1B3; +$spring: #5DA70E; + +$royal_lt: #B3B7E6; +$fuchsia_lt: #E9AFE5; +$aqua_lt: #00CCCC; +$sprint_lt: #B8E26A; + +$text_black: #0B0C0C; +$text_grey: #6F777B; + +$link: #005EA5; +$hover: #2B8CC4; +$visited: #4C2C92; +$focus: #FFBF47; + +$grey_border: #BFC1C3; +$grey_panel: #DEE0E2; +$grey_highlight: #F8F8F8; + +$col_button: #00823B; +$col_button_hover: #006435; + +$primary: $grey_highlight; +$primary_b: $royal; +$primary_text: $text_black; + +$base_bg: $white; +$base_fg: $text_black; + +$nav_background_colour: $fuchsia; +$nav_colour: $white; +$nav_hover_background_colour: darken($fuchsia, 10%); + +$col_click_map: $aqua; + +$header-top-border: false; + +$heading-font: Lato, sans-serif; +$body-font: Lato, sans-serif; +$meta-font: $body-font; diff --git a/web/cobrands/bexley/base.scss b/web/cobrands/bexley/base.scss new file mode 100644 index 000000000..bedd5b21b --- /dev/null +++ b/web/cobrands/bexley/base.scss @@ -0,0 +1,125 @@ +@import "../sass/h5bp"; +@import "./_colours"; +@import "../sass/mixins"; +@import "../sass/base"; + +div.form-error, p.form-error { // TODO Add to more, make a variable. + background-color: $red; +} + +/* Font overrides */ + +#front-main h2 { + font-style: normal; +} + +/* .form-control has this already, make sure buttons etc caught too */ +input { + font-family: inherit; +} + +/* Size */ + +body { + font-size: 1.125em; +} + +small { + font-size: 0.89em; +} +.meta-2 { + font-size: 0.89em; +} +#key-tools a,button { + font-size: 0.89em; +} +.btn--small { + font-size: 0.89em; +} +.mobile-map-banner { + font-size: 0.89em; +} +#front-main a#geolocate_link { + font-size: 0.89em; +} +#front_stats div { + font-size: 0.89em; +} +.description_tips ul { + font-size: 0.89em; + line-height: 1.4; +} + +.report-list-filters { + font-size: 0.89em; + .form-control { + font-size: 1em; + } +} +.multi-select-menuitem, .multi-select-button { + font-size: 1em; +} + +/* Colour overrides */ + +.description_tips .do { + color: $col_button_hover; +} +.description_tips .dont { + color: $red; +} + +a, +.fake-link { + text-decoration: none; + color: $link; + + &:visited { + color: $visited; + } + + &:hover, + &:active { + text-decoration: underline; + color: $hover; + } + + &:focus { + color: $focus; + } +} + +.dz-clickable .dz-message u { + color: $link; +} + +.btn-primary, +.green-btn, +.btn--primary { + border: none; + background: $col_button; + + &:focus, + &:hover, + &:active { + background: $col_button_hover; + } +} + +ol.big-numbers > li:before { + color: $fuchsia_lt; +} + +/* Header */ + +#site-logo { + width: 150px; + height: 60px; + padding: 1em 0; + background: url(/cobrands/bexley/images/logo.png) 0 50% no-repeat; + background-size: 150px 60px; +} + +#postcodeForm .form-hint { +// color: $white; +} diff --git a/web/cobrands/bexley/images/logo.png b/web/cobrands/bexley/images/logo.png Binary files differnew file mode 100644 index 000000000..8051ac80d --- /dev/null +++ b/web/cobrands/bexley/images/logo.png diff --git a/web/cobrands/bexley/js.js b/web/cobrands/bexley/js.js new file mode 100644 index 000000000..e55827fbb --- /dev/null +++ b/web/cobrands/bexley/js.js @@ -0,0 +1,48 @@ +(function(){ + +if (!fixmystreet.maps) { + return; +} + +var defaults = { + http_options: { + url: "https://tilma.mysociety.org/mapserver/bexley", + params: { + SERVICE: "WFS", + VERSION: "1.1.0", + REQUEST: "GetFeature", + SRSNAME: "urn:ogc:def:crs:EPSG::3857" + } + }, + format_class: OpenLayers.Format.GML.v3.MultiCurveFix, // Not sure needed any more + max_resolution: 4.777314267158508, + min_resolution: 0.5971642833948135, + geometryName: 'msGeometry', + srsName: "EPSG:3857", + body: "London Borough of Bexley", + strategy_class: OpenLayers.Strategy.FixMyStreet +}; + +fixmystreet.assets.add(defaults, { + http_options: { + params: { + TYPENAME: "Streets", + } + }, + always_visible: true, + non_interactive: true, + nearest_radius: 20, + usrn: { + attribute: 'NSG_REF', + field: 'NSGRef' + }, + stylemap: new OpenLayers.StyleMap({ + 'default': new OpenLayers.Style({ + fill: false, + stroke: false + }) + }) +}); + +})(); + diff --git a/web/cobrands/bexley/layout.scss b/web/cobrands/bexley/layout.scss new file mode 100644 index 000000000..948b01443 --- /dev/null +++ b/web/cobrands/bexley/layout.scss @@ -0,0 +1,33 @@ +@import "_colours"; + +@import "../sass/layout"; + +body.twothirdswidthpage .content .sticky-sidebar aside { + top: 10em; +} + +#site-logo { + width: 208px; + height: 80px; + padding: 24px 0; + background-position: 8px 50%; + background-size: 200px 80px; +} + +#front_stats big { + color: $fuchsia_lt; +} + +.nav-menu--main { + span { + background-color: $nav_hover_background_colour; + } +} + +.general-notes { + font-size: 0.89em; +} + +#key-tools a,button { + font-size: 0.89em; +} |