Projet

Général

Profil

0001-maps-display-marker-data-in-popup-21034.patch

Josué Kouka, 13 février 2018 15:54

Télécharger (2,13 ko)

Voir les différences:

Subject: [PATCH] maps: display marker data in popup (#21034)

 combo/apps/maps/static/js/combo.map.js | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
combo/apps/maps/static/js/combo.map.js
12 12
              var geo_json = L.geoJson(data, {
13 13
                  onEachFeature: function(feature, layer) {
14 14
                      $(cell).trigger('combo:map-feature-prepare', {'feature': feature, 'layer': layer});
15
                            var popup = '';
16
                            if (feature.properties.display_fields) {
17
                                $.each(feature.properties.display_fields, function(key, value) {
18
                                    popup += '<p class="popup-field"><span class="field-label">' + value[0] + '</span>';
19
                                    popup += '<span class="field-value">' + value[1] + '</span></p>';
20
                                });
21
                            } else {
22
                                $.each(feature.properties, function(key, value){
23
                                    console.log(key + '=' + value);
24
                                        // exclude object type properties
25
                                    if (typeof(value) !== 'object'){
26
                                        popup += '<p class="popup-field"><span class="field-label">' + key + '</span>' + '</p>';
27
                                        popup += '<span class="field-value">' + value + '</span></p>';
28
                                    }
29
                                });
30
                            }
31
                            layer.bindPopup(popup);
15 32
                  },
16 33
                  pointToLayer: function (feature, latlng) {
17 34
                      var markerStyles = "background-color: " + feature.properties.layer.colour + ";";
18
-