Une carte sans événement est maintenant supprimée

This commit is contained in:
echarp 2014-10-28 00:47:37 +01:00
parent 0e18d2119e
commit 8f39cbe0d2

View File

@ -7,17 +7,19 @@ $(document).ready ->
).addTo map
$.getJSON $(this).data('url') + location.search, (json) ->
layer = L.geoJson(json,
layer = L.geoJson json,
onEachFeature: (feature, layer) ->
# Does this feature have a property named popupContent?
if (feature.properties && feature.properties.popupContent)
layer.bindPopup feature.properties.popupContent
)
map.addLayer L.markerClusterGroup().addLayer layer
if (layer.getBounds()._northEast && layer.getBounds()._southWest)
# Automatic focus to all displayed events
map.fitBounds layer.getBounds()
else
$('#map.events').remove()
$('#map.event').each ->
coord = [$(this).data('latitude'), $(this).data('longitude')]
@ -29,12 +31,11 @@ $(document).ready ->
).addTo map
$.getJSON $(this).data('url') + location.search, (json) ->
layer = L.geoJson(json,
layer = L.geoJson json,
onEachFeature: (feature, layer) ->
# Does this feature have a property named popupContent?
if (feature.properties && feature.properties.popupContent)
layer.bindPopup(feature.properties.popupContent)
)
map.addLayer L.markerClusterGroup().addLayer layer