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.
This commit is contained in:
Ana 2016-08-05 20:04:26 +02:00
parent 81108290e5
commit 5761e0f7a4
7 changed files with 19 additions and 11 deletions

View file

@ -6,7 +6,7 @@ module Admin
if @event_schedule.save
render json: { 'status' => 'ok', event_schedule_id: @event_schedule.id }
else
render json: { 'status' => 'error' }
render json: { 'status' => "The event couldn't be scheduled" }
end
end
@ -14,7 +14,7 @@ module Admin
if @event_schedule.update(event_schedule_params)
render json: { 'status' => 'ok', event_schedule_id: @event_schedule.id }
else
render json: { 'status' => 'error' }
render json: { 'status' => "The event couldn't be scheduled" }
end
end
@ -22,7 +22,7 @@ module Admin
if @event_schedule.destroy
render json: { 'status' => 'ok' }
else
render json: { 'status' => 'error' }
render json: { 'status' => "The event couldn't be unscheduled" }
end
end

View file

@ -26,7 +26,7 @@ module Admin
flash[:error] = "Updating program failed. #{@program.errors.to_a.join('. ')}."
render :new
end
format.js { render json: { 'status' => 'error' } }
format.js { render json: { 'status' => "The selected schedule couldn't been updated" } }
end
end
end

View file

@ -13,7 +13,8 @@ module Admin
def create
if @schedule.save
redirect_to action: 'show', id: @schedule.id
redirect_to admin_conference_schedule_path(@conference.short_title, @schedule.id),
notice: 'Schedule was successfully created.'
else
redirect_to admin_conference_schedules_path(conference_id: @conference.short_title),
error: 'Could not create schedule'