agenda-libre-ruby/app/controllers/lugs_controller.rb
2014-07-27 01:50:22 +02:00

31 lines
751 B
Ruby

class LugsController < ApplicationController
before_action :set_lug, only: [:show]
def index
@search = Lug.search params[:q]
@search.sorts = 'name' if @search.sorts.empty?
@lugs = @search.result().page params[:page]
end
def show
@search = Lug.search params[:q]
end
private
# Use callbacks to share common setup or constraints between actions.
def set_lug
@lug = Lug.find params[:id]
set_meta_tags title: @lug.name,
description: @lug.url,
DC: {
title: @lug.name
},
geo: {
region: @lug.related_region,
placename: @lug.city,
position: "#{@lug.related_city.try :latitude};#{@lug.related_city.try :longitude}"
}
end
end