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
|
||||
|
||||
$.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
|
||||
|
Loading…
Reference in New Issue
Block a user