[feat]Add vertical schedule tab in Schedule

This commit is contained in:
Jimmy 2021-04-26 10:41:54 +08:00 committed by CactusPuppy
parent 4b83ae8be7
commit 1bc6b092de
No known key found for this signature in database
GPG key ID: 4B33B0A3E15E2C82
3 changed files with 11 additions and 27 deletions

View file

@ -75,40 +75,16 @@ class SchedulesController < ApplicationController
respond_to do |format|
format.html
format.json { render json: @events_schedules.to_json(root: false, include: :event) }
end
end
def vertical_schedule
@event_schedules = @program.selected_event_schedules(
includes: [{ event: %i[event_id title speaker] }]
includes: [{ event: %i[event_type speakers submitter] }]
)
respond_to do |format|
format.xml do
@events_xml = event_schedules.map(&:event).group_by{ |event| event.time.to_date } if event_schedules
end
format.ics do
cal = Icalendar::Calendar.new
cal = icalendar_proposals(cal, event_schedules.map(&:event), @conference)
cal.publish
render inline: cal.to_ical
end
format.html do
@rooms = @conference.venue.rooms if @conference.venue
@dates = @conference.start_date..@conference.end_date
# Ids of the @event_schedules of confrmed self_organized tracks along with the selected_schedule_id
@selected_schedules_ids = [@conference.program.selected_schedule_id]
@conference.program.tracks.self_organized.confirmed.each do |track|
@selected_schedules_ids << track.selected_schedule_id
end
@selected_schedules_ids.compact!
@event_schedules_by_room_id = event_schedules.select { |s| @selected_schedules_ids.include?(s.schedule_id) }.group_by(&:room_id)
end
end
@rooms = @conference.venue.rooms if @conference.venue
@dates = @conference.start_date..@conference.end_date
end
def app

View file

@ -7,3 +7,5 @@
= link_to('Happening Now', happening_now_conference_schedule_path(@conference.short_title))
%li{ class: "schedule #{ 'active' if active == 'schedule' }", role: "presentation" }
= link_to('Schedule', conference_schedule_path(@conference.short_title))
%li{ class: "vertical_schedule #{ 'active' if active == 'vertical_schedule' }", role: "presentation" }
= link_to('Vertical Schedule', vertical_schedule_conference_schedule_path(@conference.short_title))

View file

@ -0,0 +1,6 @@
.container#program
= render 'schedule_tabs', active: 'vertical_schedule'
%h1.text-center
Vertical Schedule for
= @conference.title