aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2015-01-16 17:19:17 +0000
committerMatthew Somerville <matthew@mysociety.org>2015-01-19 17:46:29 +0000
commitec470c609e438892c28c69ba07cf81ea17c74f17 (patch)
tree8d91f1e3784fa7d1fb08f1c15438a1b68ff1bbc9
parent21c8fded9bfd34c456f5202bc812408152f3b6cf (diff)
Add Hybrid map toggle option to Google Maps view.
-rwxr-xr-xtemplates/web/base/around/display_location.html6
-rw-r--r--templates/web/base/js/translation_strings.html3
-rw-r--r--templates/web/base/maps/google-ol.html10
-rw-r--r--templates/web/fixmystreet/report/display.html7
-rw-r--r--templates/web/zurich/admin/report_edit-sdm.html3
-rw-r--r--templates/web/zurich/admin/report_edit.html3
-rw-r--r--templates/web/zurich/maps/zurich.html9
-rwxr-xr-xtemplates/web/zurich/reports/index.html3
-rw-r--r--web/js/map-google-ol.js14
9 files changed, 37 insertions, 21 deletions
diff --git a/templates/web/base/around/display_location.html b/templates/web/base/around/display_location.html
index dbe7d9ffd..804be9603 100755
--- a/templates/web/base/around/display_location.html
+++ b/templates/web/base/around/display_location.html
@@ -27,7 +27,7 @@
}
);
- PROCESS "maps/${map.type}.html";
+ PROCESS "maps/${map.type}.html" around_page = 1;
SET bodyclass = 'mappage';
SET rss = [ loc('Recent local problems, FixMyStreet'), rss_url ] IF c.cobrand.moniker != 'emptyhomes';
@@ -53,9 +53,7 @@
[% IF c.cobrand.moniker != 'emptyhomes' %]
<p id='sub_map_links'>
- [% IF c.cobrand.moniker == 'zurich' %]
- <a class="hidden-nojs" id="map_layer_toggle" href="">Stadtplan</a>
- [% END %]
+ [% map_sub_links %]
[% IF c.req.params.no_pins %]
<a id='hide_pins_link' rel='nofollow' href='[% c.uri_with( { no_pins => 0 } ) %]'>[% loc('Show pins') %]</a>
[% ELSE %]
diff --git a/templates/web/base/js/translation_strings.html b/templates/web/base/js/translation_strings.html
index a14443b71..669055a1b 100644
--- a/templates/web/base/js/translation_strings.html
+++ b/templates/web/base/js/translation_strings.html
@@ -42,6 +42,9 @@
ok: '[% loc('OK') | replace("'", "\\'") %]',
map: '[% loc('MAP') | replace("'", "\\'") %]',
+ map_map: '[% loc('Map') | replace("'", "\\'") %]',
+ map_satellite: '[% loc('Satellite') | replace("'", "\\'") %]',
+
permalink: '[% loc('Permalink') | replace("'", "\\'") %]',
report_problem_heading: '[% loc('Click map to report a problem') | replace("'", "\\'") %]'
diff --git a/templates/web/base/maps/google-ol.html b/templates/web/base/maps/google-ol.html
index 35c046b55..919ae073f 100644
--- a/templates/web/base/maps/google-ol.html
+++ b/templates/web/base/maps/google-ol.html
@@ -9,7 +9,15 @@
<![endif]-->
[% END %]
+[% map_sub_links = BLOCK %]
+<a class="hidden-nojs" id="map_layer_toggle" href="">[% loc('Satellite') %]</a>
+[% END %]
+
[% map_html = BLOCK %]
[% INCLUDE maps/openlayers.html %]
+[% UNLESS around_page %]
+<p id="sub_map_links">
+ [% map_sub_links %]
+</p>
+[% END %]
[% END %]
-
diff --git a/templates/web/fixmystreet/report/display.html b/templates/web/fixmystreet/report/display.html
index 3534572c6..4f4e7a2a6 100644
--- a/templates/web/fixmystreet/report/display.html
+++ b/templates/web/fixmystreet/report/display.html
@@ -11,13 +11,6 @@
%]
[% map_html %]
-
- [% IF c.cobrand.moniker == 'zurich' %]
- <p id='sub_map_links'>
- <a class="hidden-nojs" id="map_layer_toggle" href="">Stadtplan</a>
- </p>
- [% END %]
-
</div>
[% IF login_success %]
diff --git a/templates/web/zurich/admin/report_edit-sdm.html b/templates/web/zurich/admin/report_edit-sdm.html
index 5ff031ce2..82bbeba23 100644
--- a/templates/web/zurich/admin/report_edit-sdm.html
+++ b/templates/web/zurich/admin/report_edit-sdm.html
@@ -7,9 +7,6 @@
-%]
[% map_html %]
- <p id='sub_map_links'>
- <a class="hidden-nojs" id="map_layer_toggle" href="">Stadtplan</a>
- </p>
</div>
[% status_message %]
diff --git a/templates/web/zurich/admin/report_edit.html b/templates/web/zurich/admin/report_edit.html
index 66a51f162..5376d77f4 100644
--- a/templates/web/zurich/admin/report_edit.html
+++ b/templates/web/zurich/admin/report_edit.html
@@ -8,9 +8,6 @@
-%]
[% map_html %]
- <p id='sub_map_links'>
- <a class="hidden-nojs" id="map_layer_toggle" href="">Stadtplan</a>
- </p>
</div>
[% status_message %]
diff --git a/templates/web/zurich/maps/zurich.html b/templates/web/zurich/maps/zurich.html
index 492ccc556..46b003530 100644
--- a/templates/web/zurich/maps/zurich.html
+++ b/templates/web/zurich/maps/zurich.html
@@ -9,6 +9,15 @@
<![endif]-->
[% END %]
+[% map_sub_links = BLOCK %]
+ <a class="hidden-nojs" id="map_layer_toggle" href="">Stadtplan</a>
+[% END %]
+
[% map_html = BLOCK %]
[% INCLUDE maps/openlayers.html %]
+[% UNLESS around_page %]
+<p id="sub_map_links">
+ [% map_sub_links %]
+</p>
+[% END %]
[% END %]
diff --git a/templates/web/zurich/reports/index.html b/templates/web/zurich/reports/index.html
index 670746753..0ece1ca2c 100755
--- a/templates/web/zurich/reports/index.html
+++ b/templates/web/zurich/reports/index.html
@@ -5,9 +5,6 @@
bodyclass = 'mappage';
%]
[% map_html %]
- <p id='sub_map_links'>
- <a class="hidden-nojs" id="map_layer_toggle" href="">Stadtplan</a>
- </p>
</div>
<div id="side">
diff --git a/web/js/map-google-ol.js b/web/js/map-google-ol.js
index 953765068..5d128a7bd 100644
--- a/web/js/map-google-ol.js
+++ b/web/js/map-google-ol.js
@@ -1,3 +1,13 @@
+$(function(){
+ $('#map_layer_toggle').toggle(function(){
+ $(this).text(translation_strings.map_map);
+ fixmystreet.map.setBaseLayer(fixmystreet.map.layers[1]);
+ }, function(){
+ $(this).text(translation_strings.map_satellite);
+ fixmystreet.map.setBaseLayer(fixmystreet.map.layers[0]);
+ });
+});
+
function set_map_config(perm) {
var permalink_id;
if ($('#map_permalink').length) {
@@ -15,5 +25,9 @@ function set_map_config(perm) {
fixmystreet.map_options = {
zoomDuration: 10
};
+ fixmystreet.layer_options = [
+ {},
+ { type: google.maps.MapTypeId.HYBRID }
+ ];
}