2014-06-14 21:48:43 +05:30
|
|
|
module Admin
|
2014-08-13 14:37:05 +03:00
|
|
|
class LodgingsController < Admin::BaseController
|
2014-08-12 11:51:59 +03:00
|
|
|
load_and_authorize_resource :conference, find_by: :short_title
|
|
|
|
|
load_and_authorize_resource :venue, through: :conference, singleton: true
|
|
|
|
|
authorize_resource :lodging, through: :venue
|
2014-06-14 21:48:43 +05:30
|
|
|
|
|
|
|
|
def index
|
2014-08-12 11:51:59 +03:00
|
|
|
authorize! :update, Lodging.new(venue_id: @venue.id)
|
2014-06-14 21:48:43 +05:30
|
|
|
end
|
|
|
|
|
|
2014-08-12 22:27:02 +03:00
|
|
|
def show; end
|
2014-06-14 21:48:43 +05:30
|
|
|
|
|
|
|
|
def update
|
|
|
|
|
if @venue.update_attributes(params[:venue])
|
|
|
|
|
redirect_to(admin_conference_lodgings_path(conference_id: @conference.short_title),
|
|
|
|
|
notice: 'Lodgings were successfully updated.')
|
|
|
|
|
else
|
|
|
|
|
redirect_to(admin_conference_lodgings_path(conference_id: @conference.short_title),
|
2014-06-16 22:59:21 +05:30
|
|
|
notice: 'Updating lodgings failed!')
|
2014-06-14 21:48:43 +05:30
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|