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

25 lines
706 B
Ruby

# Geocoding
#
# Access to OSM controls
class MapsController < ApplicationController
has_scope :region, :locality, :tag, :daylimit
has_scope :future, type: :boolean, default: true
has_scope :period, type: :hash, using: [:year, :week]
has_scope :near, type: :hash, using: [:location, :distance]
def index
respond_to do |format|
format.html { render layout: 'iframe' if params[:iframe] }
format.json { render json: apply_scopes(Event.moderated.geo) }
end
end
def show
kind = Kind.find_by_name params[:id]
orgas = apply_scopes(Orga.moderated.geo).joins(:kind).find_by(kind: kind)
respond_to do |format|
format.json { render json: orgas }
end
end
end