aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2016-08-17 09:38:20 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2016-08-17 09:38:58 +0100
commit0ce7030998ff93c893d78a04669582423daceaad (patch)
treefb8cbc3d661b68c3909f9c28b18a4ccac02c1cb5
parentddba6e69dc7003c06dad19b994c63b5db711fc2e (diff)
Make sure pin ID is an integer.
This was originally fixed in c36a425b, but lost again in c87f28e.
-rw-r--r--web/cobrands/fixmystreet/map.js18
1 files changed, 11 insertions, 7 deletions
diff --git a/web/cobrands/fixmystreet/map.js b/web/cobrands/fixmystreet/map.js
index b822864f7..ebeed06cf 100644
--- a/web/cobrands/fixmystreet/map.js
+++ b/web/cobrands/fixmystreet/map.js
@@ -4,17 +4,17 @@ var fixmystreet = fixmystreet || {};
var map_data = document.getElementById('js-map-data'),
map_keys = [ 'area', 'all_pins', 'latitude', 'longitude', 'zoomToBounds', 'zoom', 'pin_prefix', 'numZoomLevels', 'zoomOffset', 'map_type', 'key' ],
- numeric = { zoom: 1, numZoomLevels: 1, zoomOffset: 1 },
+ numeric = { zoom: 1, numZoomLevels: 1, zoomOffset: 1, id: 1 },
pin_keys = [ 'lat', 'lon', 'colour', 'id', 'title', 'type' ];
if (!map_data) {
return;
}
- $.each(map_keys, function(i, v) {
- fixmystreet[v] = map_data.getAttribute('data-' + v);
- if (numeric[v]) {
- fixmystreet[v] = +fixmystreet[v];
+ $.each(map_keys, function(i, key) {
+ fixmystreet[key] = map_data.getAttribute('data-' + key);
+ if (numeric[key]) {
+ fixmystreet[key] = +fixmystreet[key];
}
});
@@ -31,8 +31,12 @@ var fixmystreet = fixmystreet || {};
fixmystreet.pins = [];
$('.js-pin').each(function(i, pin) {
var arr = [];
- $.each(pin_keys, function(i, v) {
- arr.push(pin.getAttribute('data-' + v));
+ $.each(pin_keys, function(i, key) {
+ var val = pin.getAttribute('data-' + key);
+ if (numeric[key]) {
+ val = +val;
+ }
+ arr.push(val);
});
fixmystreet.pins.push(arr);
});