Cache admin schedule event partial

This commit is contained in:
James Mason 2018-09-25 17:13:40 -07:00 committed by Henne Vogelsang
parent 111fe83452
commit 21b908ad38

View file

@ -1,19 +1,20 @@
- cells_length = event.event_type.length / @program.schedule_interval - cache [:admin, @conference, @program, :schedule, event] do
/ this height fits the room cells - cells_length = event.event_type.length / @program.schedule_interval
- compact_grid = @program.schedule_interval < 15 / this height fits the room cells
- single_cell_height = compact_grid ? 32 : 58 - compact_grid = @program.schedule_interval < 15
- height = (cells_length * single_cell_height) - single_cell_height = compact_grid ? 32 : 58
- height -= 23 unless compact_grid - height = (cells_length * single_cell_height)
/ subtracting the padding before calculate the number of lines - height -= 23 unless compact_grid
- lines = (height - 7) / 23 / subtracting the padding before calculate the number of lines
- color = event.track.try(:color).present? ? event.track.try(:color) : 'FFFFFF' - lines = (height - 7) / 23
- non_schedulable = event_schedule_id && (EventSchedule.find(event_schedule_id).schedule != @schedule) - color = event.track.try(:color).present? ? event.track.try(:color) : 'FFFFFF'
.schedule-event{ style: "height: #{height}px; background-color: #{color}; color: #{contrast_color(color)}", | - non_schedulable = event_schedule_id && (EventSchedule.find(event_schedule_id).schedule != @schedule)
id: "event-#{event.id}", | .schedule-event{ style: "height: #{height}px; background-color: #{color}; color: #{contrast_color(color)}", |
event_id: event.id, | id: "event-#{event.id}", |
length: cells_length, | event_id: event.id, |
event_schedule_id: event_schedule_id, | length: cells_length, |
class: "#{'compact' if compact_grid} #{'non_schedulable' if non_schedulable}" } event_schedule_id: event_schedule_id, |
.schedule-event-text{ style: "-webkit-line-clamp: #{lines}; height: #{lines * 23}px;"} class: "#{'compact' if compact_grid} #{'non_schedulable' if non_schedulable}" }
%span.schedule-event-delete-button{ onclick: "Schedule.remove(\'event-#{event.id}\');" } X .schedule-event-text{ style: "-webkit-line-clamp: #{lines}; height: #{lines * 23}px;"}
= event.title %span.schedule-event-delete-button{ onclick: "Schedule.remove(\'event-#{event.id}\');" } X
= event.title