aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2020-03-03 15:35:03 +0000
committerMatthew Somerville <matthew@mysociety.org>2020-03-03 15:35:03 +0000
commit931f47cc021b9e6101c8dfc29fb67f23a1603200 (patch)
treef3f3491f2a26b866afc08943594c0878aec6d0f3
parent45cef7ace903bdda255a211fdc55bf432f1dfea7 (diff)
parenta8080fad5eabd1ffef484e6979bea3c1eebd8978 (diff)
Merge branch 'staging-js'
-rw-r--r--perllib/FixMyStreet/Map/MasterMap.pm3
-rw-r--r--t/map/mastermap.t2
-rw-r--r--templates/web/base/maps/openlayers.html3
-rw-r--r--web/cobrands/bexley/assets.js2
-rw-r--r--web/cobrands/fixmystreet/map.js2
-rw-r--r--web/cobrands/isleofwight/assets.js7
-rw-r--r--web/cobrands/northamptonshire/assets.js5
-rw-r--r--web/cobrands/peterborough/assets.js7
-rw-r--r--web/js/map-mastermap.js3
9 files changed, 14 insertions, 20 deletions
diff --git a/perllib/FixMyStreet/Map/MasterMap.pm b/perllib/FixMyStreet/Map/MasterMap.pm
index a2e0acd54..d66234bbf 100644
--- a/perllib/FixMyStreet/Map/MasterMap.pm
+++ b/perllib/FixMyStreet/Map/MasterMap.pm
@@ -23,7 +23,8 @@ sub map_tiles {
my ( $self, %params ) = @_;
my ( $x, $y, $z ) = ( $params{x_tile}, $params{y_tile}, $params{zoom_act} );
if ($z >= 17) {
- my $base = "//%stilma.mysociety.org/mastermap/%d/%d/%d.png";
+ my $layer = FixMyStreet->config('STAGING_SITE') ? 'mastermap-staging' : 'mastermap';
+ my $base = "//%stilma.mysociety.org/$layer/%d/%d/%d.png";
return [
sprintf($base, 'a.', $z, $x-1, $y-1),
sprintf($base, 'b.', $z, $x, $y-1),
diff --git a/t/map/mastermap.t b/t/map/mastermap.t
index 109142379..79522cdea 100644
--- a/t/map/mastermap.t
+++ b/t/map/mastermap.t
@@ -5,7 +5,7 @@ use FixMyStreet::Map::MasterMap;
subtest 'correct map tiles used' => sub {
my %test = (
16 => [ '-', 'oml' ],
- 20 => [ '.', 'mastermap' ]
+ 20 => [ '.', 'mastermap-staging' ]
);
foreach my $zoom (qw(16 20)) {
my $tiles = FixMyStreet::Map::MasterMap->map_tiles(x_tile => 123, y_tile => 456, zoom_act => $zoom);
diff --git a/templates/web/base/maps/openlayers.html b/templates/web/base/maps/openlayers.html
index 48a2f0890..f4c78767c 100644
--- a/templates/web/base/maps/openlayers.html
+++ b/templates/web/base/maps/openlayers.html
@@ -6,6 +6,9 @@
<input type="hidden" name="zoom" value="[% map.zoom %]">
<div id="js-map-data"
+[%- IF c.config.STAGING_SITE %]
+ data-staging=1
+[%- END %]
[%- UNLESS c.cobrand.call_hook('hide_areas_on_reports') %]
data-area="[% map.area.join(',') %]"
[%- END %]
diff --git a/web/cobrands/bexley/assets.js b/web/cobrands/bexley/assets.js
index f81c7f62e..541d47ea4 100644
--- a/web/cobrands/bexley/assets.js
+++ b/web/cobrands/bexley/assets.js
@@ -91,7 +91,7 @@ fixmystreet.assets.add(road_defaults, {
fixmystreet.assets.add(defaults, {
http_options: {
- url: "https://tilma.staging.mysociety.org/mapserver/bexley",
+ url: "https://tilma.mysociety.org/mapserver/bexley",
params: {
TYPENAME: "Trees"
}
diff --git a/web/cobrands/fixmystreet/map.js b/web/cobrands/fixmystreet/map.js
index 048e180b6..b88dc5c36 100644
--- a/web/cobrands/fixmystreet/map.js
+++ b/web/cobrands/fixmystreet/map.js
@@ -3,7 +3,7 @@ var fixmystreet = fixmystreet || {};
(function(){
var map_data = document.getElementById('js-map-data'),
- map_keys = [ 'area', 'latitude', 'longitude', 'zoomToBounds', 'zoom', 'pin_prefix', 'pin_new_report_colour', 'numZoomLevels', 'zoomOffset', 'map_type', 'key', 'bodies' ],
+ map_keys = [ 'area', 'latitude', 'longitude', 'zoomToBounds', 'zoom', 'pin_prefix', 'pin_new_report_colour', 'numZoomLevels', 'zoomOffset', 'map_type', 'key', 'bodies', 'staging' ],
numeric = { zoom: 1, numZoomLevels: 1, zoomOffset: 1, id: 1 },
bool = { draggable: 1 },
pin_keys = [ 'lat', 'lon', 'colour', 'id', 'title', 'type', 'draggable' ];
diff --git a/web/cobrands/isleofwight/assets.js b/web/cobrands/isleofwight/assets.js
index e8d30e596..2710a9de7 100644
--- a/web/cobrands/isleofwight/assets.js
+++ b/web/cobrands/isleofwight/assets.js
@@ -4,14 +4,9 @@ if (!fixmystreet.maps) {
return;
}
-var is_live = false;
-if ( location.hostname === 'www.fixmystreet.com' || location.hostname === 'fms.islandroads.com' ) {
- is_live = true;
-}
-
var defaults = {
http_options: {
- url: is_live ? "https://tilma.mysociety.org/mapserver/iow": "https://staging.tilma.mysociety.org/mapserver/iow",
+ url: fixmystreet.staging ? "https://tilma.staging.mysociety.org/mapserver/iow": "https://tilma.mysociety.org/mapserver/iow",
params: {
SERVICE: "WFS",
VERSION: "1.1.0",
diff --git a/web/cobrands/northamptonshire/assets.js b/web/cobrands/northamptonshire/assets.js
index b6f8f07f3..2b6cdeb69 100644
--- a/web/cobrands/northamptonshire/assets.js
+++ b/web/cobrands/northamptonshire/assets.js
@@ -4,10 +4,7 @@ if (!fixmystreet.maps) {
return;
}
-var is_live = false;
-if ( location.hostname === 'www.fixmystreet.com' || location.hostname == 'fixmystreet.northamptonshire.gov.uk' ) {
- is_live = true;
-}
+var is_live = !fixmystreet.staging;
var layers = [
/*
diff --git a/web/cobrands/peterborough/assets.js b/web/cobrands/peterborough/assets.js
index 2fb9075c8..b3cac5f6c 100644
--- a/web/cobrands/peterborough/assets.js
+++ b/web/cobrands/peterborough/assets.js
@@ -4,9 +4,10 @@ if (!fixmystreet.maps) {
return;
}
+
var defaults = {
http_options: {
- url: "https://tilma.mysociety.org/mapserver/peterborough",
+ url: fixmystreet.staging ? "https://tilma.staging.mysociety.org/mapserver/peterborough" : "https://tilma.mysociety.org/mapserver/peterborough",
params: {
SERVICE: "WFS",
VERSION: "1.1.0",
@@ -58,9 +59,6 @@ var trees_defaults = $.extend(true, {}, defaults, {
asset_found: fixmystreet.message_controller.asset_found,
asset_not_found: fixmystreet.message_controller.asset_not_found
},
- http_options: {
- url: "https://tilma.mysociety.org/mapserver/peterborough"
- },
attributes: {
tree_code: 'TREE_CODE'
},
@@ -96,7 +94,6 @@ fixmystreet.assets.add(trees_defaults, {
// The new tree request category is disabled in the other tree point layer.
fixmystreet.assets.add(defaults, {
http_options: {
- url: "https://tilma.mysociety.org/mapserver/peterborough",
params: {
TYPENAME: "tree_points"
}
diff --git a/web/js/map-mastermap.js b/web/js/map-mastermap.js
index d12a79bd0..bb9adf532 100644
--- a/web/js/map-mastermap.js
+++ b/web/js/map-mastermap.js
@@ -13,7 +13,8 @@ OpenLayers.Layer.MasterMap = OpenLayers.Class(OpenLayers.Layer.BingUK, {
var urls = [];
var servers = [ '', 'a.', 'b.', 'c.' ];
- var base = "//{S}tilma.mysociety.org/mastermap/${z}/${x}/${y}.png";
+ var layer = fixmystreet.staging ? 'mastermap-staging' : 'mastermap';
+ var base = "//{S}tilma.mysociety.org/" + layer + "/${z}/${x}/${y}.png";
for (var i=0; i < servers.length; i++) {
urls.push( base.replace('{S}', servers[i]) );
}