From fcad17cc57e6cc6aafaeae519e3750b0f4cf4c14 Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Wed, 10 Jun 2026 18:44:49 +0100 Subject: [PATCH 1/3] Maintain old reports toggle in redirect to /around --- perllib/FixMyStreet/App/Controller/Report/New.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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($_); } From 9bea8d1f3188273ee99d2b99e5c4dcb77345d3aa Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Wed, 10 Jun 2026 18:45:54 +0100 Subject: [PATCH 2/3] Replace non-JS map control links with buttons. This should still work basically the same, albeit with the URL not being updated with the change any longer, and is fundamentally an admission of defeat against the tidal wave of badly written scrapers spiralling round and round our maps continuously; this is the world we find ourselves in. --- perllib/FixMyStreet/App.pm | 11 +++++++++ perllib/FixMyStreet/App/Controller/Root.pm | 14 +++++++++++ perllib/FixMyStreet/TestMech.pm | 4 +++- templates/web/base/common_footer_tags.html | 4 ++++ templates/web/base/maps/_compass.html | 28 +++++++++++----------- templates/web/base/maps/openlayers.html | 8 +++---- web/cobrands/sass/_base.scss | 5 ++++ 7 files changed, 55 insertions(+), 19 deletions(-) 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/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/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; %]
- pan up - pan left - pan right - pan down - zoom in - zoom out + + + + + +
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; From 71ecb2d230d61eea7656ef7c13b499a25ff8ebbb Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Wed, 10 Jun 2026 18:51:11 +0100 Subject: [PATCH 3/3] Provide a way to instantly override to OSM mapping --- perllib/FixMyStreet/Cobrand/Default.pm | 1 + 1 file changed, 1 insertion(+) 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; }