agenda-libre-ruby/app/controllers/maps_controller.rb

20 lines
631 B
Ruby

class MapsController < ApplicationController
def index
@events = Event
if (params[:region] && params[:region].present? && params[:region] != 'all')
@events = @events.region(params[:region])
end
@events = @events.tag(params[:tag]) if (params[:tag])
@events = @events.where('start_time > ?', 360.days.ago).order :id
@cities_event = @events.collect { |event|
City.find_by_majname event.city.gsub('-', ' ').upcase
}.uniq.keep_if { |city| city }
@cities_lug = Lug.all.collect { |lug|
City.find_by_majname lug.city.gsub('-', ' ').upcase
}.uniq.keep_if { |city| city }
end
end