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