update
This commit is contained in:
parent
28e55f3f50
commit
a5a2db4077
156 changed files with 3203 additions and 1206 deletions
32
app/controllers/admin/programs_controller.rb
Normal file
32
app/controllers/admin/programs_controller.rb
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
module Admin
|
||||
class ProgramsController < Admin::BaseController
|
||||
load_and_authorize_resource :conference, find_by: :short_title
|
||||
load_and_authorize_resource through: :conference, singleton: true
|
||||
|
||||
def show; end
|
||||
|
||||
def edit; end
|
||||
|
||||
def update
|
||||
authorize! :update, @conference.program
|
||||
@program = @conference.program
|
||||
@program.assign_attributes(program_params)
|
||||
# send_mail_on_schedule_public = @program.notify_on_schedule_public?
|
||||
|
||||
if @program.update_attributes(program_params)
|
||||
# Mailbot.delay.send_on_schedule_public(@conference) if send_mail_on_schedule_public
|
||||
redirect_to(admin_conference_program_path(@conference.short_title),
|
||||
notice: 'The program was successfully updated.')
|
||||
else
|
||||
flash[:error] = "Updating program failed. #{@program.errors.to_a.join('. ')}."
|
||||
render :new
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def program_params
|
||||
params.require(:program).permit(:rating, :schedule_public, :schedule_fluid)
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue