2014-06-05 20:05:20 +05:30
|
|
|
module Admin
|
2014-08-13 14:37:05 +03:00
|
|
|
class SponsorsController < Admin::BaseController
|
2014-08-12 11:51:59 +03:00
|
|
|
load_and_authorize_resource :conference, find_by: :short_title
|
|
|
|
|
authorize_resource :sponsor, through: :conference
|
|
|
|
|
|
|
|
|
|
def index
|
|
|
|
|
authorize! :index, Sponsor.new(conference_id: @conference.id)
|
|
|
|
|
end
|
2014-06-05 20:05:20 +05:30
|
|
|
|
|
|
|
|
def update
|
|
|
|
|
if @conference.update_attributes(params[:conference])
|
|
|
|
|
redirect_to(admin_conference_sponsors_path(
|
|
|
|
|
conference_id: @conference.short_title),
|
|
|
|
|
notice: 'Sponsorships were successfully updated.')
|
|
|
|
|
else
|
|
|
|
|
redirect_to(admin_conference_sponsors_path(
|
|
|
|
|
conference_id: @conference.short_title),
|
2014-07-24 23:30:28 +03:00
|
|
|
alert: 'Sponsorships update failed.')
|
2014-06-05 20:05:20 +05:30
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|