Implement track scheduling
Add track association to schedule Show schedules in admin sidebar to track organizers Allow track organizers to manage the schedules of their tracks Don't allow self-organized track events to be dragged or unscheduled in a conference schedule Make scheduled events of self-organized tracks appear semitransparent in conference schedules Make the rooms of confirmed self_organized tracks appear semitransparent and don't allow events to be scheduled to it in the conference schedules during the dates of its track Create admin/SchedulesController#new action Add a button in admin/Schedules#index to create schedules for tracks Add self_organized scope to Track Modify Schedules#show to handle track schedules and show a unified schedule Allow track organizers to create new schedules for their tracks Correctly identify scheduled and unscheduled events in Schedules#events Fix Event#room and Event#time for when the event is scheduled in a track schedule Modify Program#selected_event_schedules to include the event_schedules of selected track schedules Modify Track#revoke_role_and_cleanup to destroy the track's schedules and revert its events' state to new Add tabs for conference and track schedules in admin/Schedules#index Add button to Create/Show a tracks schedule in Tracks#index and #show Fix concurrent_events in application_helper because of changes in Program#selected_event_schedules Do not take into account cfp_active in Event#valid_track Modify EventsController#get_tracks accordingly Enforce cfp_active of track to be enabled for proposals in ProposalsController#create and #update Add support for multiple schedules per track Add selected_schedule_id to Track Load EventSchedules of selected track schedules for conference schedules in admin/SchedulesController#show Modify SchedulesController#show to take into account only the selected track schedules Create Event#selected_schedule_id and use it in Event#scheduled? and Event#time Validate that an EventSchedule for an event of a self-organized track belongs to one of the track's schedules Add 'Manage' button in Tracks#index, #show that sends you to the admin side of things Add admin/TracksController#update_selected_schedule to update the selected_schedule_id of tracks
This commit is contained in:
parent
af7efdb6fe
commit
7eea930269
37 changed files with 443 additions and 118 deletions
|
|
@ -5,7 +5,9 @@
|
|||
- date_event_schedules = @event_schedules.select{ |e| e.start_time.to_date.eql? date }
|
||||
.row
|
||||
- @rooms.each do |room|
|
||||
.col-md-2.col-xs-6
|
||||
- non_schedulable = room.tracks.self_organized.confirmed.any? do |track|
|
||||
- !track.schedules.include?(@schedule) && (track.start_date..track.end_date).include?(date)
|
||||
.col-md-2.col-xs-6{ class: ('non_schedulable' if non_schedulable) }
|
||||
.room-name
|
||||
- room_date_event_schedules = date_event_schedules.select{ |e| e.room == room }
|
||||
= room.name
|
||||
|
|
|
|||
|
|
@ -7,12 +7,13 @@
|
|||
/ subtracting the padding before calculate the number of lines
|
||||
- lines = (height - 7) / 23
|
||||
- color = event.track.try(:color).present? ? event.track.try(:color) : 'FFFFFF'
|
||||
- non_schedulable = event_schedule_id && (EventSchedule.find(event_schedule_id).schedule != @schedule)
|
||||
.schedule-event{ style: "height: #{height}px; background-color: #{color}; color: #{contrast_color(color)}", |
|
||||
id: "event-#{event.id}", |
|
||||
event_id: event.id, |
|
||||
length: cells_length, |
|
||||
event_schedule_id: event_schedule_id, |
|
||||
class: ('compact' if compact_grid) }
|
||||
class: "#{'compact' if compact_grid} #{'non_schedulable' if non_schedulable}" }
|
||||
.schedule-event-text{ style: "-webkit-line-clamp: #{lines}; height: #{lines * 23}px;"}
|
||||
%span.schedule-event-delete-button{ onclick: "Schedule.remove(\'event-#{event.id}\');" } X
|
||||
= event.title
|
||||
|
|
|
|||
10
app/views/admin/schedules/_form.html.haml
Normal file
10
app/views/admin/schedules/_form.html.haml
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
.row
|
||||
.col-md-12
|
||||
.page-header
|
||||
%h1
|
||||
New Track Schedule
|
||||
.row
|
||||
.col-md-12
|
||||
= semantic_form_for @schedule, url: admin_conference_schedules_path(@conference.short_title) do |f|
|
||||
= f.input :track, collection: Track.accessible_by(current_ability).where(program: @program).self_organized.confirmed.pluck(:name, :id), include_blank: false
|
||||
= f.action :submit, as: :button, button_html: { class: 'btn btn-primary' }
|
||||
|
|
@ -4,42 +4,85 @@
|
|||
%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
|
||||
= selected_scheduled?(schedule)
|
||||
%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
|
||||
- if @venue.try(:rooms).present?
|
||||
.text-right
|
||||
= link_to 'Add Schedule', admin_conference_schedules_path(@conference.short_title),
|
||||
method: :post, class: 'btn btn-primary'
|
||||
- elsif @venue
|
||||
.h3
|
||||
No Rooms!
|
||||
%small
|
||||
= link_to 'Create rooms', admin_conference_venue_rooms_path
|
||||
before creating the schedule.
|
||||
- else
|
||||
.h3
|
||||
No Venue!
|
||||
%small
|
||||
= link_to 'Create a venue with rooms', new_admin_conference_venue_path
|
||||
before creating the schedule.
|
||||
.tabbable
|
||||
%ul.nav.nav-tabs
|
||||
%li.active
|
||||
= link_to 'Conference schedules', '#conference', 'data-toggle' => 'tab'
|
||||
%li
|
||||
= link_to 'Track schedules', '#tracks', 'data-toggle' => 'tab'
|
||||
.tab-content
|
||||
.tab-pane.active#conference
|
||||
.row
|
||||
.col-md-12
|
||||
%table.table.table-hover
|
||||
%thead
|
||||
%th Schedule
|
||||
%th Selected
|
||||
%th Actions
|
||||
%tbody
|
||||
- @schedules.where(track: nil).each do |schedule|
|
||||
%tr
|
||||
%td
|
||||
Schedule
|
||||
= schedule.id
|
||||
%td
|
||||
= selected_scheduled?(schedule)
|
||||
%td
|
||||
.btn-group{role: "group"}
|
||||
- if can? :show, schedule
|
||||
= link_to 'Show', admin_conference_schedule_path(@conference.short_title, schedule),
|
||||
method: :get, class: 'btn btn-primary'
|
||||
- if can? :destroy, schedule
|
||||
= link_to 'Delete', admin_conference_schedule_path(@conference.short_title, schedule),
|
||||
method: :delete, class: 'btn btn-danger', data: { confirm: "Do you really want to delete Schedule #{schedule.id}?" }
|
||||
.row
|
||||
.col-md-12
|
||||
- if @venue.try(:rooms).present?
|
||||
.text-right
|
||||
- if can? :create, @program.schedules.new
|
||||
= link_to 'Add Schedule', admin_conference_schedules_path(@conference.short_title),
|
||||
method: :post, class: 'btn btn-primary'
|
||||
- elsif @venue
|
||||
.h3
|
||||
No Rooms!
|
||||
%small
|
||||
= link_to 'Create rooms', admin_conference_venue_rooms_path
|
||||
before creating the schedule.
|
||||
- else
|
||||
.h3
|
||||
No Venue!
|
||||
%small
|
||||
= link_to 'Create a venue with rooms', new_admin_conference_venue_path
|
||||
before creating the schedule.
|
||||
.tab-pane#tracks
|
||||
.row
|
||||
.col-md-12
|
||||
%table.table.table-hover
|
||||
%thead
|
||||
%th Schedule
|
||||
%th Track
|
||||
%th Selected
|
||||
%th Actions
|
||||
%tbody
|
||||
- @schedules.where.not(track: nil).each do |schedule|
|
||||
%tr
|
||||
%td
|
||||
Schedule
|
||||
= schedule.id
|
||||
%td
|
||||
- track = schedule.track
|
||||
= link_to track.name, admin_conference_program_track_path(@conference.short_title, track)
|
||||
%td
|
||||
= schedule == schedule.track.selected_schedule ? 'Yes' : 'No'
|
||||
%td
|
||||
.btn-group{role: "group"}
|
||||
- if can? :show, schedule
|
||||
= link_to 'Show', admin_conference_schedule_path(@conference.short_title, schedule), class: 'btn btn-primary'
|
||||
- if can? :destroy, schedule
|
||||
= link_to 'Delete', admin_conference_schedule_path(@conference.short_title, schedule),
|
||||
method: :delete, class: 'btn btn-danger', data: { confirm: "Do you really want to delete Schedule #{schedule.id}?" }
|
||||
.row
|
||||
.col-md-12
|
||||
.text-right
|
||||
- if can? :new, @program.schedules.build(track: @program.tracks.new)
|
||||
= link_to 'Add Track Schedule', new_admin_conference_schedule_path(@conference.short_title), class: 'btn btn-primary'
|
||||
|
|
|
|||
|
|
@ -11,8 +11,15 @@
|
|||
.row
|
||||
.col-md-2
|
||||
Selected schedule
|
||||
= check_box_tag @conference.short_title, @schedule.id, (@schedule.id == @selected_schedule.try(:id)),
|
||||
method: :patch, url: (admin_conference_program_path(@conference.short_title) + '?[program][selected_schedule_id]='),
|
||||
:ruby
|
||||
if @schedule.track
|
||||
value = @schedule == @schedule.track.selected_schedule
|
||||
url = update_selected_schedule_admin_conference_program_track_path(@conference.short_title, @schedule.track) + '?[track][selected_schedule_id]='
|
||||
else
|
||||
value = @schedule.id == @selected_schedule.try(:id)
|
||||
url = admin_conference_program_path(@conference.short_title) + '?[program][selected_schedule_id]='
|
||||
end
|
||||
= check_box_tag @conference.short_title, @schedule.id, value, method: :patch, url: url,
|
||||
class: 'switch-checkbox-schedule', data: { size: 'small',
|
||||
off_color: 'warning',
|
||||
on_text: 'Yes',
|
||||
|
|
|
|||
|
|
@ -63,9 +63,19 @@
|
|||
.btn-group{role: "group"}
|
||||
- if can? :edit, track
|
||||
= link_to 'Edit', edit_admin_conference_program_track_path(@conference.short_title, track), class: 'btn btn-primary'
|
||||
- special_style = true
|
||||
- if can? :destroy, track
|
||||
= link_to 'Delete', admin_conference_program_track_path(@conference.short_title, track), method: :delete, class: 'btn btn-danger',
|
||||
data: { confirm: "Do you really want to delete #{track.name}? Attention: This track will be removed from all Events that have it set" }
|
||||
- if track.self_organized?
|
||||
- if track.selected_schedule
|
||||
- if can? :show, track.selected_schedule
|
||||
= link_to 'Show Schedule', admin_conference_schedule_path(@conference.short_title, track.selected_schedule),
|
||||
class: 'btn btn-default'
|
||||
- elsif can? :create, @program.schedules.build(track: track)
|
||||
= button_to 'Create Schedule', admin_conference_schedules_path(@conference.short_title),
|
||||
form: { class: 'btn', style: 'padding: 0px 0px; margin-top: -1px;' }, class: 'btn btn-default',
|
||||
style: ('border-top-left-radius: 0; border-bottom-left-radius: 0;' if special_style), params: { 'schedule[track_id]' => track.id }
|
||||
.row
|
||||
.col-md-12.text-right
|
||||
= link_to 'New Track', new_admin_conference_program_track_path(@conference.short_title), class: 'btn btn-success'
|
||||
|
|
|
|||
|
|
@ -21,10 +21,20 @@
|
|||
- if can? :edit, @track
|
||||
= link_to 'Edit', edit_admin_conference_program_track_path(@conference.short_title, @track),
|
||||
method: :get, class: 'btn btn-primary'
|
||||
- special_style = true
|
||||
- if can? :destroy, @track
|
||||
= link_to 'Delete', admin_conference_program_track_path(@conference.short_title, @track),
|
||||
method: :delete, class: 'btn btn-danger',
|
||||
data: { confirm: "Do you really want to delete #{@track.name}? Attention: This track will be removed from all Events that have it set" }
|
||||
- if @track.self_organized?
|
||||
- if @track.selected_schedule
|
||||
- if can? :show, @track.selected_schedule
|
||||
= link_to 'Show Schedule', admin_conference_schedule_path(@conference.short_title, @track.selected_schedule),
|
||||
class: 'btn btn-default'
|
||||
- elsif can? :create, @program.schedules.build(track: @track)
|
||||
= button_to 'Create Schedule', admin_conference_schedules_path(@conference.short_title),
|
||||
form: { class: 'btn', style: 'padding: 0px 0px; margin-top: -1px;' }, class: 'btn btn-default',
|
||||
style: ('border-top-left-radius: 0; border-bottom-left-radius: 0;' if special_style), params: { 'schedule[track_id]' => @track.id }
|
||||
.row
|
||||
.col-md-12
|
||||
%table.table
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue