Skip to content
Extraits de code Groupes Projets
Valider 8ee752a3 rédigé par echarp's avatar echarp
Parcourir les fichiers

N'affiche la carte que pour les evt géocodés

parent dadb6cd5
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -7,15 +7,12 @@ $(document).ready ->
).addTo map
$.getJSON '/maps.json', (json) ->
points = []
L.geoJson(json,
onEachFeature: (feature, layer) ->
points += [feature.geometry.coordinates[0], feature.geometry.coordinates[1]]
# Does this feature have a property named popupContent?
if (feature.properties && feature.properties.popupContent)
layer.bindPopup(feature.properties.popupContent)
).addTo map
console.log L.bounds(points[0], points[1])
$('.events #map').each ->
......
......@@ -6,7 +6,7 @@ class MapsController < ApplicationController
respond_to do |format|
format.html
format.json do
render json: Event.moderated.future.map { |event| event.to_json }
render json: Event.moderated.future.geo.map { |event| event.to_json }
end
end
end
......
......@@ -48,6 +48,7 @@ class Event < ActiveRecord::Base
end)
scope :region, -> region { where 'region = ? or locality', region }
scope :tag, -> tag { where 'tags like ?', "%#{tag}%" }
scope :geo, -> { where 'latitude is not null and longitude is not null' }
before_validation on: :create do
self.submission_time = DateTime.now
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter