Simplify schedule

This commit is contained in:
Linus Gasser 2025-10-01 19:07:31 +02:00
parent c1260e2f28
commit 43000060b2
2 changed files with 4 additions and 45 deletions

View file

@ -8,49 +8,7 @@ class SchedulesController < ApplicationController
before_action :load_withdrawn_event_schedules, only: [:show, :events] before_action :load_withdrawn_event_schedules, only: [:show, :events]
def show def show
event_schedules = @program.selected_event_schedules( redirect_to events_conference_schedule_path(@conference.short_title)
includes: [{ event: %i[event_type speakers submitter] }]
)
unless event_schedules
redirect_to events_conference_schedule_path(@conference.short_title)
return
end
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.order(:name) if @conference.venue
@dates = @conference.start_date..@conference.end_date
@step_minutes = @program.schedule_interval.minutes
@conf_start = @conference.start_hour
@conf_period = @conference.end_hour - @conf_start
# the schedule takes you to today if it is a date of the schedule
@current_day = @conference.current_conference_day
@day = @current_day.present? ? @current_day : @dates.first
if @current_day
# the schedule takes you to the current time if it is beetween the start and the end time.
@hour_column = @conference.hours_from_start_time(@conf_start, @conference.end_hour)
end
# 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
end end
def events def events

View file

@ -1,7 +1,8 @@
%div{ role: "tabpanel" } %div{ role: "tabpanel" }
/ Nav tabs / Nav tabs
%ul.nav.nav-tabs{ role: "tablist" } %ul.nav.nav-tabs{ role: "tablist" }
%li{ class: "schedule #{ 'active' if active == 'schedule' }", role: "presentation" } - unless active == 'program'
= link_to('Schedule', 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: "program #{ 'active' if active == 'program' }", role: "presentation" } %li{ class: "program #{ 'active' if active == 'program' }", role: "presentation" }
= link_to('All events', events_conference_schedule_path(@conference.short_title)) = link_to('All events', events_conference_schedule_path(@conference.short_title))