Parcourir la source

Do not display "null" floor in popup

Jocelyn Delalande il y a 8 ans
Parent
commit
e4d7a4d180
1 fichiers modifiés avec 3 ajouts et 1 suppressions
  1. 3 1
      wifiwithme/static/map.js

+ 3 - 1
wifiwithme/static/map.js

@@ -56,7 +56,9 @@ $( document ).ready(function() {
 
             if (feature.properties.place) {
                 feature.properties.popupContent += '<ul>';
-                if (feature.properties.place.hasOwnProperty('floor')) feature.properties.popupContent += '<li>Étage: '+feature.properties.place.floor+'</li>';
+                if (feature.properties.place && feature.properties.floor) {
+                    feature.properties.popupContent += '<li>Étage: '+feature.properties.place.floor+'</li>';
+                }
                 if (feature.properties.place.orientations && feature.properties.place.orientations[0]) feature.properties.popupContent += '<li>Orientation: '+feature.properties.place.orientations.join(', ')+'</li>';
                 if (feature.properties.place.roof) feature.properties.popupContent += '<li>Accès au toit'+'</li>';
                 feature.properties.popupContent += '</ul>';