diff --git a/app/assets/javascripts/maps.js.coffee b/app/assets/javascripts/maps.js.coffee index f601a443..91c8f353 100644 --- a/app/assets/javascripts/maps.js.coffee +++ b/app/assets/javascripts/maps.js.coffee @@ -6,7 +6,7 @@ $(document).ready -> attribution: '© OpenStreetMap' ).addTo map - $.getJSON '/maps.json', (json) -> + $.getJSON $(this).data('url') + location.search, (json) -> layer = L.geoJson(json, onEachFeature: (feature, layer) -> # Does this feature have a property named popupContent? @@ -28,7 +28,7 @@ $(document).ready -> attribution: '© OpenStreetMap' ).addTo map - $.getJSON '/maps.json', (json) -> + $.getJSON $(this).data('url') + location.search, (json) -> layer = L.geoJson(json, onEachFeature: (feature, layer) -> # Does this feature have a property named popupContent? diff --git a/app/views/events/show.html.haml b/app/views/events/show.html.haml index 11c51962..e33610d9 100644 --- a/app/views/events/show.html.haml +++ b/app/views/events/show.html.haml @@ -50,7 +50,7 @@ "http://fr.wikipedia.org/wiki/#{url_encode @event.related_region.try(:name)}" - if @event.latitude && @event.longitude - #map(latitude="#{@event.latitude}" longitude="#{@event.longitude}") + #map(data-url="#{maps_path format: :json}" latitude="#{@event.latitude}" longitude="#{@event.longitude}") - elsif controller.action_name != 'show' %em.fa.fa-compress diff --git a/app/views/maps/index.html.haml b/app/views/maps/index.html.haml index 1a94c5d5..f46fa723 100644 --- a/app/views/maps/index.html.haml +++ b/app/views/maps/index.html.haml @@ -2,4 +2,4 @@ %em.fa.fa-map-marker =title t '.title' -#map +#map(data-url="#{maps_path format: :json}")