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

20 lines
561 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|
event.related_city
}.uniq.keep_if { |city| city }
@cities_lug = Lug.all.collect { |lug|
lug.related_city
}.uniq.keep_if { |city| city }
end
end