osem-fcy/app/controllers/admin/event_schedules_controller.rb
Ana 5761e0f7a4 Using flash instead of alerts in the schedule
Using flash instead of alerts in the schedule to notify errors.

Also, a message shown when a schedule is successfully created.
2016-08-11 15:11:27 +02:00

35 lines
946 B
Ruby

module Admin
class EventSchedulesController < Admin::BaseController
load_and_authorize_resource :event_schedule
def create
if @event_schedule.save
render json: { 'status' => 'ok', event_schedule_id: @event_schedule.id }
else
render json: { 'status' => "The event couldn't be scheduled" }
end
end
def update
if @event_schedule.update(event_schedule_params)
render json: { 'status' => 'ok', event_schedule_id: @event_schedule.id }
else
render json: { 'status' => "The event couldn't be scheduled" }
end
end
def destroy
if @event_schedule.destroy
render json: { 'status' => 'ok' }
else
render json: { 'status' => "The event couldn't be unscheduled" }
end
end
private
def event_schedule_params
params.require(:event_schedule).permit(:schedule_id, :event_id, :room_id, :start_time)
end
end
end