Léger nettoyage pour factoriser la recherche de ville
This commit is contained in:
parent
2404ea16b5
commit
3f5759ec87
@ -9,11 +9,11 @@ class MapsController < ApplicationController
|
|||||||
@events = @events.where('start_time > ?', 360.days.ago).order :id
|
@events = @events.where('start_time > ?', 360.days.ago).order :id
|
||||||
|
|
||||||
@cities_event = @events.collect { |event|
|
@cities_event = @events.collect { |event|
|
||||||
City.find_by_majname event.city.gsub('-', ' ').upcase
|
event.related_city
|
||||||
}.uniq.keep_if { |city| city }
|
}.uniq.keep_if { |city| city }
|
||||||
|
|
||||||
@cities_lug = Lug.all.collect { |lug|
|
@cities_lug = Lug.all.collect { |lug|
|
||||||
City.find_by_majname lug.city.gsub('-', ' ').upcase
|
lug.related_city
|
||||||
}.uniq.keep_if { |city| city }
|
}.uniq.keep_if { |city| city }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -32,4 +32,10 @@ class Event < ActiveRecord::Base
|
|||||||
def same_day?
|
def same_day?
|
||||||
start_time.to_date == end_time.to_date
|
start_time.to_date == end_time.to_date
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def related_city
|
||||||
|
if city.present?
|
||||||
|
City.find_by_majname city.gsub('-', ' ').upcase
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
class Lug < ActiveRecord::Base
|
class Lug < ActiveRecord::Base
|
||||||
belongs_to :region, foreign_key: 'region'
|
belongs_to :region, foreign_key: 'region'
|
||||||
|
|
||||||
|
def related_city
|
||||||
|
if city.present?
|
||||||
|
City.find_by_majname city.gsub('-', ' ').upcase
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@ -28,7 +28,7 @@ xml.tag! 'rdf:RDF', 'xmlns:rdf' => "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
|||||||
xml.link event_url event
|
xml.link event_url event
|
||||||
xml.tag! 'dc:identifier', "#{event.id}@agendadulibre.org"
|
xml.tag! 'dc:identifier', "#{event.id}@agendadulibre.org"
|
||||||
xml.tag! 'dc:date', event.start_time
|
xml.tag! 'dc:date', event.start_time
|
||||||
city = City.find_by_majname event.city.gsub('-', ' ').upcase
|
city = event.related_city
|
||||||
xml.tag! 'georss:point', "#{city.latitude} #{city.longitude}" rescue nil
|
xml.tag! 'georss:point', "#{city.latitude} #{city.longitude}" rescue nil
|
||||||
|
|
||||||
@event = event
|
@event = event
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
:coffee
|
:coffee
|
||||||
marker = new OpenLayers.Marker(
|
marker = new OpenLayers.Marker(
|
||||||
new OpenLayers.LonLat(#{city.longitude}, #{city.latitude})
|
new OpenLayers.LonLat(#{city.longitude}, #{city.latitude})
|
||||||
#new OpenLayers.Icon(<<iconURL>>, iconSize, iconOffset)
|
|
||||||
)
|
)
|
||||||
eventsLayer.addMarker marker
|
eventsLayer.addMarker marker
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user