12 changed files with 23 additions and 43 deletions
@ -1,3 +1,3 @@
|
||||
#map |
||||
width: 100% |
||||
height: 40em |
||||
height: 60em |
||||
|
@ -1,19 +1,7 @@
|
||||
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]) |
||||
@cities_event = City.joins(:events).where('start_time > ?', 360.days.ago) |
||||
|
||||
@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 } |
||||
@cities_lug = City.joins :lugs |
||||
end |
||||
end |
||||
|
@ -1,2 +1,8 @@
|
||||
# This class is linked to events and lugs |
||||
# |
||||
# It is mainly used to manage coordinates |
||||
# |
||||
class City < ActiveRecord::Base |
||||
has_many :events, foreign_key: :city, primary_key: :name |
||||
has_many :lugs, foreign_key: :city, primary_key: :name |
||||
end |
||||
|
@ -1,9 +1,4 @@
|
||||
class Lug < ActiveRecord::Base |
||||
belongs_to :region, foreign_key: 'region' |
||||
|
||||
def related_city |
||||
if city.present? |
||||
City.find_by_majname city.gsub('-', ' ').upcase |
||||
end |
||||
end |
||||
has_one :related_city, foreign_key: :name, primary_key: :city, class_name: City |
||||
end |
||||
|
Loading…
Reference in new issue