Several schedules in the backend && routes changed
- Introduce plural resources for Schedule in routes.rb - Introduce #index and #create actions for ScheduleController - Make it possible to set a schedule as selected_schedule
This commit is contained in:
parent
3897ec79ca
commit
42848f929b
8 changed files with 90 additions and 36 deletions
13
app/views/admin/schedule/_day_tab.html.haml
Normal file
13
app/views/admin/schedule/_day_tab.html.haml
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
.row
|
||||
- @rooms.each do |room|
|
||||
.col-md-2.col-xs-6
|
||||
.room-name
|
||||
= room.name
|
||||
- (9*4..18*4).each do |slot|
|
||||
- hour = slot / 4
|
||||
- time = (15 * (slot % 4) == 0) ? '00' : 15 * (slot % 4)
|
||||
.schedule-room-slot{ id: "schedule-room-#{room.guid}-#{hour}-#{time}", |
|
||||
"room-guid" => room.guid, |
|
||||
hour: "#{hour}:#{time}", |
|
||||
date: date}
|
||||
= "#{hour}:#{time}"
|
||||
32
app/views/admin/schedule/index.html.haml
Normal file
32
app/views/admin/schedule/index.html.haml
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
.row
|
||||
.col-md-12
|
||||
.page-header
|
||||
%h1 Schedules
|
||||
%p.text-muted
|
||||
The schedules for your conference
|
||||
.row
|
||||
.col-md-12
|
||||
%table.table.table-hover#event_types
|
||||
%thead
|
||||
%th Schedule
|
||||
%th Selected
|
||||
%th Actions
|
||||
%tbody
|
||||
- @schedules.each do |schedule|
|
||||
%tr
|
||||
%td
|
||||
Schedule
|
||||
= schedule.id
|
||||
%td
|
||||
= (schedule == @selected_schedule) ? 'Yes' : 'No'
|
||||
%td
|
||||
.btn-group{role: "group"}
|
||||
= link_to 'Show', admin_conference_schedule_path(@conference.short_title, schedule.id),
|
||||
method: :get, class: 'btn btn-primary'
|
||||
= link_to 'Delete', admin_conference_schedule_path(@conference.short_title, schedule.id),
|
||||
method: :delete, class: 'btn btn-danger', data: { confirm: "Do you really want to delete Schedule #{schedule.id}?" }
|
||||
|
||||
.row
|
||||
.col-md-12.text-right
|
||||
= link_to 'Add Schedule', admin_conference_schedule_index_path(@conference.short_title),
|
||||
method: :post, class: 'btn btn-primary'
|
||||
34
app/views/admin/schedule/show.html.haml
Normal file
34
app/views/admin/schedule/show.html.haml
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
.row
|
||||
.col-md-12
|
||||
.page-header
|
||||
%h1 Schedule
|
||||
%p.text-muted
|
||||
Create the schedules for the conference
|
||||
|
||||
.row
|
||||
.col-md-2
|
||||
Selected schedule
|
||||
= check_box_tag @conference.short_title, @schedule_id, (@schedule_id == @selected_schedule_id),
|
||||
method: :put, url: "/admin/conference/#{@conference.short_title}/schedule/#{@schedule_id}?selected_schedule=",
|
||||
class: 'switch-checkbox', data: { size: 'small',
|
||||
off_color: 'warning',
|
||||
on_text: 'Yes',
|
||||
off_text: 'No' }
|
||||
.h4
|
||||
Unscheduled events
|
||||
.unscheduled-events
|
||||
.col-md-10
|
||||
%ul.nav.nav-tabs
|
||||
- @dates.each do |date|
|
||||
%li{ class: "#{ (@dates.first == date) ? 'active' : '' }"}
|
||||
%a{ href: "##{date}" }
|
||||
= date
|
||||
.tab-content
|
||||
- @dates.each do |date|
|
||||
.tab-pane{ class: "#{ (@dates.first == date) ? 'active' : '' }", id: "#{date}" }
|
||||
= render partial: 'day_tab', locals: { date: date }
|
||||
|
||||
:javascript
|
||||
$(document).ready( function() {
|
||||
Schedule.loadEvents("#{@conference.short_title}", "#{@schedule_id}");
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue