Do not use JS to initialize the schedule

- Only use JS for the drag&drop functionality and to the set/alter the time and rooms of the EventSchedule object.

- Introduce has_many :events, through: :event_schedules association to get unscheduled event easily
This commit is contained in:
Ana 2016-07-31 18:41:27 +02:00
parent 71dab6b79c
commit a394293500
12 changed files with 66 additions and 125 deletions

View file

@ -21,6 +21,9 @@ module Admin
def show
@schedule_id = params[:id].to_i
schedule = Schedule.find(@schedule_id)
@event_schedules = schedule.event_schedules
@unscheduled_events = @program.events.confirmed - schedule.events
@selected_schedule_id = @conference.program.selected_schedule.try(:id)
@dates = @conference.start_date..@conference.end_date
@rooms = (@venue && @venue.rooms.any?) ? @venue.rooms : [Room.new(name: 'No Rooms!', size: 0)]
@ -44,7 +47,7 @@ module Admin
error_message = "Could not find event GUID: #{params[:event]}"
end
event_schedule = event.event_schedule(params[:schedule])
event_schedule = event.event_schedules.find_by(schedule_id: params[:schedule])
if params[:date] == 'none'
event_schedule.destroy if event_schedule.present?