aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perllib/FixMyStreet/Cobrand/Bristol.pm2
-rw-r--r--perllib/FixMyStreet/Cobrand/Default.pm25
-rw-r--r--perllib/FixMyStreet/Cobrand/FixaMinGata.pm11
-rw-r--r--perllib/FixMyStreet/Cobrand/Zurich.pm9
4 files changed, 17 insertions, 30 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Bristol.pm b/perllib/FixMyStreet/Cobrand/Bristol.pm
index faf2b5f0a..ecb19b867 100644
--- a/perllib/FixMyStreet/Cobrand/Bristol.pm
+++ b/perllib/FixMyStreet/Cobrand/Bristol.pm
@@ -23,6 +23,8 @@ sub map_type {
'Bristol';
}
+sub default_link_zoom { 6 }
+
sub disambiguate_location {
my $self = shift;
my $string = shift;
diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm
index c44842dea..3dd562dc4 100644
--- a/perllib/FixMyStreet/Cobrand/Default.pm
+++ b/perllib/FixMyStreet/Cobrand/Default.pm
@@ -382,22 +382,14 @@ sub cobrand_data_for_generic_problem { '' }
Given a URL ($_[1]), QUERY, EXTRA_DATA, return a URL with any extra params
needed appended to it.
-In the default case, if we're using an OpenLayers map, we need to make
-sure zoom is always present if lat/lon are, to stop OpenLayers defaulting
-to null/0.
+In the default case, we need to make sure zoom is always present if lat/lon
+are, to stop OpenLayers defaulting to null/0.
=cut
sub uri {
my ( $self, $uri ) = @_;
-
- {
- no warnings 'once';
- my $map_class = $FixMyStreet::Map::map_class;
- return $uri unless $map_class && $map_class =~ /FixMyStreet::Map::(OSM|FMS)/;
- }
-
- $uri->query_param( zoom => 3 )
+ $uri->query_param( zoom => $self->default_link_zoom )
if $uri->query_param('lat') && !$uri->query_param('zoom');
return $uri;
@@ -981,7 +973,18 @@ sub tweak_all_reports_map {}
sub can_support_problems { return 0; }
+=head2 default_map_zoom / default_link_zoom
+
+default_map_zoom is used when displaying a map overriding the
+default of max-4 or max-3 depending on population density.
+
+default_link_zoom is used in links that contain a 'lat' and no
+zoom, to stop e.g. OpenLayers defaulting to null/0.
+
+=cut
+
sub default_map_zoom { undef };
+sub default_link_zoom { 3 }
sub users_can_hide { return 0; }
diff --git a/perllib/FixMyStreet/Cobrand/FixaMinGata.pm b/perllib/FixMyStreet/Cobrand/FixaMinGata.pm
index a321d5c7c..5b78b3fa1 100644
--- a/perllib/FixMyStreet/Cobrand/FixaMinGata.pm
+++ b/perllib/FixMyStreet/Cobrand/FixaMinGata.pm
@@ -35,17 +35,6 @@ sub area_types {
[ 'KOM' ];
}
-# If lat/lon are present in the URL, OpenLayers will use that to centre the map.
-# Need to specify a zoom to stop it defaulting to null/0.
-sub uri {
- my ( $self, $uri ) = @_;
-
- $uri->query_param( zoom => 3 )
- if $uri->query_param('lat') && !$uri->query_param('zoom');
-
- return $uri;
-}
-
sub geocode_postcode {
my ( $self, $s ) = @_;
# Most people write Swedish postcodes like this:
diff --git a/perllib/FixMyStreet/Cobrand/Zurich.pm b/perllib/FixMyStreet/Cobrand/Zurich.pm
index b8e2db9d4..dca722224 100644
--- a/perllib/FixMyStreet/Cobrand/Zurich.pm
+++ b/perllib/FixMyStreet/Cobrand/Zurich.pm
@@ -83,14 +83,7 @@ sub example_places {
sub languages { [ 'de-ch,Deutsch,de_CH' ] }
sub language_override { 'de-ch' }
-# If lat/lon are in the URI, we must have zoom as well, otherwise OpenLayers defaults to 0.
-sub uri {
- my ( $self, $uri ) = @_;
-
- $uri->query_param( zoom => 6 )
- if $uri->query_param('lat') && !$uri->query_param('zoom');
- return $uri;
-}
+sub default_link_zoom { 6 }
sub prettify_dt {
my $self = shift;