diff --git a/perllib/FixMyStreet/App.pm b/perllib/FixMyStreet/App.pm index 3cb71d3d8d4..0cedfa628ba 100644 --- a/perllib/FixMyStreet/App.pm +++ b/perllib/FixMyStreet/App.pm @@ -439,6 +439,17 @@ sub uri_for_email { return URI->new($email_uri); } +sub uri_map { + my ($c, $params) = @_; + my $map = $c->stash->{map}; + my $lat = $params->{lat} // $map->{latitude}; + my $lon = $params->{lon} // $map->{longitude}; + my $zoom = $params->{zoom} // $map->{zoom}; + my $aerial = $params->{aerial} // $c->get_param('aerial') // ""; + my $no_pins = $params->{no_pins} // $c->get_param('no_pins') // ""; + return "$lat/$lon/$zoom/$aerial/$no_pins"; +} + sub finalize { my $c = shift; $c->next::method(@_); diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm index 56f85083b52..4411a596bbb 100644 --- a/perllib/FixMyStreet/App/Controller/Report/New.pm +++ b/perllib/FixMyStreet/App/Controller/Report/New.pm @@ -2061,7 +2061,7 @@ sub redirect_to_around : Private { lat => $c->stash->{latitude}, lon => $c->stash->{longitude}, }; - foreach (qw(pc zoom)) { + foreach (qw(pc zoom show_old_reports)) { $params->{$_} = $c->get_param($_); } diff --git a/perllib/FixMyStreet/App/Controller/Root.pm b/perllib/FixMyStreet/App/Controller/Root.pm index a9e38c59e25..1f75d76cf6a 100644 --- a/perllib/FixMyStreet/App/Controller/Root.pm +++ b/perllib/FixMyStreet/App/Controller/Root.pm @@ -46,6 +46,7 @@ sub auto : Private { $c->forward('/offline/_stash_manifest_theme', [ $c->cobrand->moniker ]); $c->forward('store_app_platform'); + $c->forward('nojs_map_controls'); return 1; } @@ -248,6 +249,19 @@ sub store_app_platform : Private { } } +sub nojs_map_controls : Private { + my ($self, $c) = @_; + + if (my $nojs = $c->get_param('nojs-map-controls')) { + my ($lat, $lon, $zoom, $aerial, $no_pins) = split /\//, $nojs; + $c->set_param('lat', $lat); + $c->set_param('lon', $lon); + $c->set_param('zoom', $zoom); + $c->set_param('aerial', $aerial); + $c->set_param('no_pins', $no_pins); + } +} + =head2 end Attempt to render a view, if needed. diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm index 468cd894a58..318e3014556 100644 --- a/perllib/FixMyStreet/Cobrand/Default.pm +++ b/perllib/FixMyStreet/Cobrand/Default.pm @@ -549,6 +549,7 @@ Return an override type of map if necessary. sub map_type { my $self = shift; return 'OSM' if $self->{c} && $self->{c}->req->uri->host =~ /^osm\./; + return 'OSM' if -e FixMyStreet->path_to('../data/osm-map-override'); return; } diff --git a/perllib/FixMyStreet/TestMech.pm b/perllib/FixMyStreet/TestMech.pm index db649f82d22..d4939fa6d94 100644 --- a/perllib/FixMyStreet/TestMech.pm +++ b/perllib/FixMyStreet/TestMech.pm @@ -558,8 +558,10 @@ sub visible_form_values { unless $form; } else { + # ignore overrides and no-JS map form my @forms = - grep { ( $_->attr('name') || '' ) ne 'overrides_form' } # ignore overrides + grep { ( $_->attr('name') || '' ) ne 'overrides_form' + && ( $_->attr('id') || '' ) ne 'nojs-map-controls-form' } $mech->forms; croak "Found no forms - can't continue..." diff --git a/templates/web/base/common_footer_tags.html b/templates/web/base/common_footer_tags.html index 37c4b7da2a2..fd56cc12cd4 100644 --- a/templates/web/base/common_footer_tags.html +++ b/templates/web/base/common_footer_tags.html @@ -18,3 +18,7 @@ [%~ FOR attr IN script.1 %] [% attr.key %]="[% attr.value %]"[% END ~%] > [% END %] + +[% IF map %] +
+[% END %] diff --git a/templates/web/base/maps/_compass.html b/templates/web/base/maps/_compass.html index 94f3e3cd967..8e3e972929f 100644 --- a/templates/web/base/maps/_compass.html +++ b/templates/web/base/maps/_compass.html @@ -1,20 +1,20 @@ [% RETURN IF map.no_compass %] [% - north = c.uri_with( { lat = map.compass.north.0, lon = map.compass.north.1, zoom = map.zoom } ) - south = c.uri_with( { lat = map.compass.south.0, lon = map.compass.south.1, zoom = map.zoom } ) - east = c.uri_with( { lat = map.compass.east.0, lon = map.compass.east.1, zoom = map.zoom } ) - west = c.uri_with( { lat = map.compass.west.0, lon = map.compass.west.1, zoom = map.zoom } ); - SET zoom_in = c.uri_with( { lat = map.latitude, lon = map.longitude, zoom = map.zoom + 1 } ) IF map.zoom < map.numZoomLevels - 1; - SET zoom_out = c.uri_with( { lat = map.latitude, lon = map.longitude, zoom = map.zoom - 1 } ) IF map.zoom > 0; - SET zoom_in = '#' IF map.zoom >= map.numZoomLevels - 1; - SET zoom_out = '#' IF map.zoom <= 0; + north = c.uri_map( { lat = map.compass.north.0, lon = map.compass.north.1, zoom = map.zoom } ) + south = c.uri_map( { lat = map.compass.south.0, lon = map.compass.south.1, zoom = map.zoom } ) + east = c.uri_map( { lat = map.compass.east.0, lon = map.compass.east.1, zoom = map.zoom } ) + west = c.uri_map( { lat = map.compass.west.0, lon = map.compass.west.1, zoom = map.zoom } ); + SET zoom_in = c.uri_map( { lat = map.latitude, lon = map.longitude, zoom = map.zoom + 1 } ) IF map.zoom < map.numZoomLevels - 1; + SET zoom_out = c.uri_map( { lat = map.latitude, lon = map.longitude, zoom = map.zoom - 1 } ) IF map.zoom > 0; + SET zoom_in = '' IF map.zoom >= map.numZoomLevels - 1; + SET zoom_out = '' IF map.zoom <= 0; %] diff --git a/templates/web/base/maps/openlayers.html b/templates/web/base/maps/openlayers.html index 29d3138894b..5b17dc91196 100644 --- a/templates/web/base/maps/openlayers.html +++ b/templates/web/base/maps/openlayers.html @@ -59,17 +59,17 @@ [% aerial = c.req.params.aerial %] [% SET aerial = 1 IF c.cobrand.moniker == 'zurich' AND NOT c.req.params.aerial.defined %] [% IF aerial %] - [% loc('Road map') %] + [% ELSE %] - [% loc('Aerial map') %] + [% END %] [% END %] [% IF page == "around" %] [% IF c.req.params.no_pins %] - [% loc('Show pins') %] + [% ELSE %] - [% loc('Hide pins') %] + [% END %] [% loc('Re-centre map') %] diff --git a/web/cobrands/sass/_base.scss b/web/cobrands/sass/_base.scss index 3e361188479..af122ed017f 100644 --- a/web/cobrands/sass/_base.scss +++ b/web/cobrands/sass/_base.scss @@ -2002,6 +2002,10 @@ html.js #map .noscript { } } +#ns_fms_pan_zoom .olButton { + border: none; +} + #ns_fms_pan_zoom_panup, #ns_fms_pan_zoom_pandown, #ns_fms_pan_zoom_panleft, @@ -2167,6 +2171,7 @@ html.js #map .noscript { background-repeat: no-repeat; background-size: $maplink-button-height $maplink-button-height; border-radius: 5px; + border: none; margin-top: $panzoom-gutter; // vertical space between links text-decoration: none !important;