This commit is contained in:
Aditya Chatterjee 2016-02-27 17:03:43 +05:30
parent 28e55f3f50
commit a5a2db4077
156 changed files with 3203 additions and 1206 deletions

View file

@ -3,23 +3,29 @@ module Admin
# By authorizing 'conference' resource, we can ensure there will be no unauthorized access to
# the schedule of a conference, which should not be accessed in the first place
load_and_authorize_resource :conference, find_by: :short_title
load_and_authorize_resource :program, through: :conference, singleton: true
load_resource :venue, through: :conference, singleton: true
skip_before_filter :verify_authenticity_token, only: [:update]
layout 'schedule'
def show
authorize! :update, @conference.events.new
authorize! :update, @program.events.new
if @conference.nil?
redirect_to admin_conference_index_path
return
end
@dates = @conference.start_date..@conference.end_date
@rooms = @conference.rooms
if @venue && @venue.rooms.any?
@rooms = @venue.rooms
else
@rooms = [ Room.new(name: 'No Rooms!', size: 0) ]
end
end
def update
authorize! :update, @conference.events.new
event = Event.where(guid: event_params).first
authorize! :update, @program.events.new
event = Event.where(guid: params[:event]).first
error_message = nil
if event.nil?
error_message = "Could not find event GUID: #{params[:event]}"
@ -63,7 +69,7 @@ module Admin
end
def room_params
params.require(:room).permit(:guid)
params.require(:room)
end
end
end