From 424ab6197ac2f4caa5263717018c243dfd6d0816 Mon Sep 17 00:00:00 2001 From: Josue Kouka Date: Tue, 13 Feb 2018 15:51:12 +0100 Subject: [PATCH] maps: display marker data in popup (#21034) --- combo/apps/maps/static/js/combo.map.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/combo/apps/maps/static/js/combo.map.js b/combo/apps/maps/static/js/combo.map.js index 915b813..a519f35 100644 --- a/combo/apps/maps/static/js/combo.map.js +++ b/combo/apps/maps/static/js/combo.map.js @@ -12,6 +12,23 @@ $(function() { var geo_json = L.geoJson(data, { onEachFeature: function(feature, layer) { $(cell).trigger('combo:map-feature-prepare', {'feature': feature, 'layer': layer}); + var popup = ''; + if (feature.properties.display_fields) { + $.each(feature.properties.display_fields, function(key, value) { + popup += ''; + }); + } else { + $.each(feature.properties, function(key, value){ + console.log(key + '=' + value); + // exclude object type properties + if (typeof(value) !== 'object'){ + popup += ''; + popup += '' + value + '

'; + } + }); + } + layer.bindPopup(popup); }, pointToLayer: function (feature, latlng) { var markerStyles = "background-color: " + feature.properties.layer.colour + ";"; -- 2.11.0