Schedule update moved to program update

Schedule update updated a program attribute
This commit is contained in:
Ana 2016-08-04 19:20:11 +02:00
parent 310c521790
commit 81108290e5
4 changed files with 41 additions and 22 deletions

View file

@ -9,8 +9,6 @@ module Admin
load_resource :selected_schedule, through: :program, singleton: true
load_resource :venue, through: :conference, singleton: true
skip_before_action :verify_authenticity_token, only: [:update]
def index; end
def create
@ -29,16 +27,6 @@ module Admin
@rooms = (@venue && @venue.rooms.any?) ? @venue.rooms : [Room.new(name: 'No Rooms!', size: 0)]
end
def update
if params[:selected_schedule] == 'true'
@program.selected_schedule_id = params[:id].to_i
elsif params[:selected_schedule] == 'false' && (@selected_schedule.id == params[:id].to_i)
@program.selected_schedule_id = nil
end
@program.save
render json: { 'status' => 'ok' }
end
def destroy
if @schedule.destroy
redirect_to admin_conference_schedules_path(conference_id: @conference.short_title),