clarion/app/controllers/management/management_controller.rb

33 lines
745 B
Ruby
Raw Normal View History

2014-09-17 12:43:17 +03:00
module Management
class ManagementController < ::ApplicationController
before_action :authenticate_user!, :authorize_user!
2014-09-17 12:43:17 +03:00
layout 'management'
private
2015-06-09 21:50:23 +03:00
def default_url_options(options = {})
2015-07-12 10:28:24 +03:00
{ current_conference: current_conference.try(:slug) }.merge(options)
2015-06-09 21:50:23 +03:00
end
def current_conference?
current_conference.present?
end
helper_method :current_conference?
def current_conference
2015-06-09 21:50:23 +03:00
@current_conference ||=
begin
if params[:current_conference]
Conference.find_by_slug(params[:current_conference])
2015-06-09 21:50:23 +03:00
end
end
end
helper_method :current_conference
def authorize_user!
head :forbidden unless current_user.admin?
end
2014-09-17 12:43:17 +03:00
end
end