N'affiche la carte que pour les evt géocodés
This commit is contained in:
parent
dadb6cd521
commit
8ee752a306
|
@ -7,15 +7,12 @@ $(document).ready ->
|
||||||
).addTo map
|
).addTo map
|
||||||
|
|
||||||
$.getJSON '/maps.json', (json) ->
|
$.getJSON '/maps.json', (json) ->
|
||||||
points = []
|
|
||||||
L.geoJson(json,
|
L.geoJson(json,
|
||||||
onEachFeature: (feature, layer) ->
|
onEachFeature: (feature, layer) ->
|
||||||
points += [feature.geometry.coordinates[0], feature.geometry.coordinates[1]]
|
|
||||||
# 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)
|
||||||
).addTo map
|
).addTo map
|
||||||
console.log L.bounds(points[0], points[1])
|
|
||||||
|
|
||||||
|
|
||||||
$('.events #map').each ->
|
$('.events #map').each ->
|
||||||
|
|
|
@ -6,7 +6,7 @@ class MapsController < ApplicationController
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html
|
format.html
|
||||||
format.json do
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -48,6 +48,7 @@ class Event < ActiveRecord::Base
|
||||||
end)
|
end)
|
||||||
scope :region, -> region { where 'region = ? or locality', region }
|
scope :region, -> region { where 'region = ? or locality', region }
|
||||||
scope :tag, -> tag { where 'tags like ?', "%#{tag}%" }
|
scope :tag, -> tag { where 'tags like ?', "%#{tag}%" }
|
||||||
|
scope :geo, -> { where 'latitude is not null and longitude is not null' }
|
||||||
|
|
||||||
before_validation on: :create do
|
before_validation on: :create do
|
||||||
self.submission_time = DateTime.now
|
self.submission_time = DateTime.now
|
||||||
|
|
Loading…
Reference in New Issue