2014-08-06 21:14:00 +03:00
|
|
|
module Admin
|
|
|
|
|
class RoomsController < ApplicationController
|
2014-08-12 11:51:59 +03:00
|
|
|
load_and_authorize_resource :conference, find_by: :short_title
|
|
|
|
|
authorize_resource through: :conference
|
|
|
|
|
|
|
|
|
|
def index
|
|
|
|
|
authorize! :index, Room.new(conference_id: @conference.id)
|
|
|
|
|
end
|
2013-01-07 09:04:09 +01:00
|
|
|
|
2014-08-06 21:14:00 +03:00
|
|
|
def show
|
|
|
|
|
render :rooms_list
|
|
|
|
|
end
|
2013-01-07 09:04:09 +01:00
|
|
|
|
2014-08-06 21:14:00 +03:00
|
|
|
def update
|
|
|
|
|
if @conference.update_attributes(params[:conference])
|
|
|
|
|
redirect_to(admin_conference_rooms_path(
|
|
|
|
|
conference_id: @conference.short_title),
|
|
|
|
|
notice: 'Rooms were successfully updated.')
|
|
|
|
|
else
|
|
|
|
|
redirect_to(admin_conference_rooms_path(
|
|
|
|
|
conference_id: @conference.short_title),
|
|
|
|
|
notice: 'Room update failed.')
|
|
|
|
|
end
|
2013-01-07 09:04:09 +01:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|