[feat]Add url, background color, text color to events in vertical schedule
This commit is contained in:
parent
468e170a2e
commit
83aeb5c330
3 changed files with 52 additions and 19 deletions
|
|
@ -4,10 +4,15 @@ class FullCalendarFormatter
|
|||
end
|
||||
|
||||
def self.event_schedules_to_resources(event_schedules)
|
||||
event_schedules.map { |event_schedule| event_schedule_to_resource(event_schedule) }.to_json
|
||||
return '[]' if event_schedules.empty?
|
||||
|
||||
conference = event_schedules.first.schedule.program.conference
|
||||
event_schedules.map { |event_schedule| event_schedule_to_resource(conference, event_schedule) }.to_json
|
||||
end
|
||||
|
||||
class << self
|
||||
include FormatHelper
|
||||
|
||||
private
|
||||
|
||||
def room_to_resource(room)
|
||||
|
|
@ -17,13 +22,19 @@ class FullCalendarFormatter
|
|||
}
|
||||
end
|
||||
|
||||
def event_schedule_to_resource(event_schedule)
|
||||
def event_schedule_to_resource(conference, event_schedule)
|
||||
event_type_color = event_schedule.event.event_type.color
|
||||
url = Rails.application.routes.url_helpers.conference_program_proposal_path(conference.short_title, event_schedule.event.id)
|
||||
|
||||
{
|
||||
id: event_schedule.event.guid,
|
||||
title: event_schedule.event.title,
|
||||
start: event_schedule.start_time,
|
||||
end: event_schedule.end_time,
|
||||
resourceId: event_schedule.room.guid
|
||||
id: event_schedule.event.guid,
|
||||
title: event_schedule.event.title,
|
||||
start: event_schedule.start_time,
|
||||
end: event_schedule.end_time,
|
||||
resourceId: event_schedule.room.guid,
|
||||
url: url,
|
||||
backgroundColor: event_type_color,
|
||||
textColor: contrast_color(event_type_color)
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue