aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/Map/Bing.pm
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2011-05-25 18:08:04 +0100
committerMatthew Somerville <matthew@mysociety.org>2011-05-25 18:08:04 +0100
commit2e8794adaa69ea258b568b67b284eb143081b0cd (patch)
tree345a604e471df294c8201ba858446450969297f4 /perllib/FixMyStreet/Map/Bing.pm
parent349dd7c35e2ad5d1cef4c8e4a023ec3b17dd8d80 (diff)
Template the rest of the maps. Some more complete than others.
Diffstat (limited to 'perllib/FixMyStreet/Map/Bing.pm')
-rw-r--r--perllib/FixMyStreet/Map/Bing.pm34
1 files changed, 6 insertions, 28 deletions
diff --git a/perllib/FixMyStreet/Map/Bing.pm b/perllib/FixMyStreet/Map/Bing.pm
index 0db1a51c3..32420a0ec 100644
--- a/perllib/FixMyStreet/Map/Bing.pm
+++ b/perllib/FixMyStreet/Map/Bing.pm
@@ -21,37 +21,15 @@ sub header_js {
# display_map C PARAMS
# PARAMS include:
# latitude, longitude for the centre point of the map
-# TYPE is 1 if the map is clickable, 0 otherwise.
+# CLICKABLE is set if the map is clickable
# PINS is array of pins to show, location and colour
sub display_map {
my ($self, $c, %params) = @_;
- $params{pre} ||= '';
-
- my @pins;
- foreach my $pin (@{$params{pins}}) {
- $pin->[3] ||= '';
- push @pins, "[ $pin->[0], $pin->[1], '$pin->[2]', '$pin->[3]' ]";
- }
- my $pins_js = join(",\n", @pins);
-
- my $out = '';
- my $copyright = _('Map contains Ordnance Survey data &copy; Crown copyright and database right 2010.');
- my $key = mySociety::Config::get('BING_MAPS_API_KEY');
- $out .= <<EOF;
-<script type="text/javascript">
-var fixmystreet = {
- 'key': '$key',
- 'latitude': $params{latitude},
- 'longitude': $params{longitude},
- 'pins': [ $pins_js ]
-}
-</script>
-<div id="map_box">
- $params{pre}
- <div id="map"></div>
- <p id="copyright">$copyright</p>
-EOF
- return $out;
+ $c->stash->{map} = {
+ %params,
+ type => 'bing',
+ key => mySociety::Config::get('BING_MAPS_API_KEY'),
+ };
}
1;