Corrections in SchedulesController

- Controler file name pluralized
- Load and authorization fixed and improved
- Consider that save can fail in create action
- Eliminate unnecessary if in update action
- Ability and tests related to the schedules link in the admin sidebar fixed
This commit is contained in:
Ana 2016-08-04 00:56:01 +02:00
parent 2e1cd164a4
commit 29b920d746
9 changed files with 67 additions and 69 deletions

View file

@ -28,5 +28,5 @@
.row
.col-md-12.text-right
= link_to 'Add Schedule', admin_conference_schedule_index_path(@conference.short_title),
= link_to 'Add Schedule', admin_conference_schedules_path(@conference.short_title),
method: :post, class: 'btn btn-primary'

View file

@ -8,8 +8,8 @@
.row
.col-md-2
Selected schedule
= check_box_tag @conference.short_title, @schedule_id, (@schedule_id == @selected_schedule_id),
method: :put, url: (admin_conference_schedule_path(@conference.short_title, @schedule_id) + '?selected_schedule='),
= check_box_tag @conference.short_title, @schedule.id, (@schedule.id == @selected_schedule.try(:id)),
method: :put, url: (admin_conference_schedule_path(@conference.short_title, @schedule) + '?selected_schedule='),
class: 'switch-checkbox', data: { size: 'small',
off_color: 'warning',
on_text: 'Yes',
@ -32,5 +32,5 @@
:javascript
$(document).ready( function() {
Schedule.initialize("#{admin_conference_event_schedule_index_path(@conference)}", "#{@schedule_id}");
Schedule.initialize("#{admin_conference_event_schedule_index_path(@conference)}", "#{@schedule.id}");
});