From c3a7e1eb5808d8c2a0df134f77214892c1cdefef Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Sun, 9 Dec 2012 17:41:31 +0000 Subject: Add popups for the catchment areas --- resources/map.js | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/resources/map.js b/resources/map.js index 9c0f009..14875fe 100644 --- a/resources/map.js +++ b/resources/map.js @@ -23,6 +23,23 @@ $(document).ready(function() { \ <% } %> \ <% }); %> \ +'); + + self.catchmentTemplate = _.template('\ +\ +<% _.each(properties, function(val, key) { %> \ +<% if (/\:/.exec(key)) { %> \ + \ + \ + \ + \ +<% } else {%> \ +\ + \ + \ +\ +<% } %> \ +<% }); %> \
KeyValue
<%= key.split(":")[1] %> <%= val %>
<%= key %> <%= val %>
'); self.tileLayer = L.tileLayer('http://{s}.www.toolserver.org/tiles/osm-no-labels/{z}/{x}/{y}.png', { @@ -95,14 +112,8 @@ $(document).ready(function() { mouseout: resetHighlight, click: zoomToFeature }); - /*var center; - if (feature.geometry.type === "Point") { - center = feature.geometry.coordinates; - } else { - center = feature.geometry.coordinates[0]; - } - - layer.bindPopup(self.popupTemplate({ properties: feature.properties, coordinate: center }));*/ + + layer.bindPopup(self.catchmentTemplate({ properties: feature.properties })); }, filter: function(feature, layer) { return _.contains(_.values(feature.properties), "catchment_area"); -- cgit v1.2.3