-
Notifications
You must be signed in to change notification settings - Fork 137
Expand file tree
/
Copy pathtrack.html
More file actions
210 lines (197 loc) · 7.09 KB
/
track.html
File metadata and controls
210 lines (197 loc) · 7.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
<%
# vim: set ft=eruby ts=2 sw=2 et ai:
%>
<% go_live = @site.config.fetch(:go_live) %>
<% matrix_works = @site.config.fetch(:matrix_works) %>
<p class="side-box">
<i class="icon-home"></i> <strong>Room<%= item[:rooms].size == 1 ? '' : 's' %></strong>:
<% if item[:rooms].empty? %>
<span class="muted">No room assigned yet</span>
<% else %>
<%= l item[:rooms].map(&$to_room) %>
<% end %>
<br/>
<i class="icon-calendar"></i> <strong>Calendar:</strong>
<%=
[
{ name: 'iCal', identifier: "/schedule/ical/track/#{item[:slug]}/" },
{ name: 'xCal', identifier: "/schedule/xcal/track/#{item[:slug]}/" },
].map{|cal| l(cal[:identifier], cal[:name]) }.join(", ")
%>
<br/>
</p>
<br style="clear: both;"/>
<%
event_color = {}
interval = $timetable.first.last.fetch(:interval)
days = $track_flatlist.keys.map(&$to_day)
start = days.reject{|d| d[:start_time].nil?}.map{|d| Time.parse(d[:start_time])}.min
if start
start_hour = start.hour
dayend = days.reject{|d| d[:end_time].nil?}.map{|d| Time.parse(d[:end_time])}.max
num_cells = dayend.hour - start_hour
num_slots = num_cells * (60 / interval)
%>
<table class="table table-striped table-bordered table-condensed roomtracks">
<thead>
<tr>
<th class="day"></th>
<% if item[:rooms].size > 1 %>
<th class="room">Room</th>
<% end %>
<% (0..num_cells-1).each do |i| %>
<th colspan="<%= 60 / interval %>" style="text-align: left;"><%= format("%02d", start_hour + i) %></th>
<% end %>
</tr>
</thead>
<tbody>
<%
last_day = nil
c = 1
$event_flatlist
.select{|dayslug, list| item[:events_by_day].has_key? dayslug.to_sym and not item[:events_by_day][dayslug.to_sym].empty? }
.each do |dayslug, flatlist_by_room|
d = $to_day.call(dayslug)
track_rooms_that_day = item[:events_per_room_per_day][dayslug.to_sym].keys
day_row_height = flatlist_by_room
.select{|roomslug, cells_list| track_rooms_that_day.include? roomslug.to_sym}
.map{|roomslug, cells_list| cells_list.size}
.inject(0, :+)
last_event = nil
i = 0
grid = flatlist_by_room.select{|r, cellrows| track_rooms_that_day.include? r.to_sym}
grid.each do |roomslug, cellrows|
start_offset_slots = (((Time.parse(d[:start_time]) - start) / 60) / interval).to_i
fillup_slots = (((dayend - Time.parse(d[:end_time])) / 60) / interval).to_i
i += 1
cellrows.each_with_index do |cells, row|
tr_classes = []
tr_classes << "section_start" if i == 1
if cellrows.size > 1
tr_classes << "subsection_start" if row == 0
tr_classes << "subsection_end" if row == cellrows.size - 1 and i < grid.keys.size
end
%>
<tr<% unless tr_classes.empty? %> class="<%= tr_classes.join(" ") %>"<% end %>>
<% if last_day.nil? or last_day != dayslug %>
<th class="day"<% if day_row_height > 1 %> rowspan="<%= day_row_height %>" style="vertical-align: middle;"<% end %>><%= l(d) %></th>
<% last_day = dayslug %>
<% end %>
<% if item[:rooms].size > 1 %>
<% if cellrows.size < 2 or row < 1 %>
<th class="room<% if cellrows.size > 1 %> subsection_start" style="vertical-align: middle;" rowspan="<%= cellrows.size %><% end %>"><%= l(room(roomslug)) %></th>
<% end %>
<% end %>
<% (0..start_offset_slots-1).each do |x| %>
<td class="t<%= (start + (x * interval * 60)).strftime("%M") %>"></td>
<% end %>
<%
slots = 0
cells.each do |cell|
if cell.nil?
slots_before_cell = slots
slots += 1
%>
<td class="t<%= (start + ((slots_before_cell + start_offset_slots) * interval * 60)).strftime("%M") %>"></td>
<%
else
slots_before_cell = slots
slots += cell[:slots]
color_class, link = if last_event.nil? or cell[:event_id] != last_event
last_event = cell[:event_id]
if cell[:track] == item[:slug]
c += 1
c %= $colors.size
[ $colors[c], l(event(cell[:slug]), :title, '', :title) ]
else
[ nil, nil ]
end
else
[ $colors[c], l(event(cell[:slug]), :title, '', :title) ]
end
classes = []
classes << color_class if color_class
if link
classes << "t#{(start + ((slots_before_cell + start_offset_slots) * interval * 60)).strftime("%M")}"
%>
<td class="<%= classes.join(" ") %>" colspan="<%= cell[:slots] %>"><%= link %></td>
<% event_color[cell[:event_id]] = color_class %>
<% else
(0..cell[:slots]-1).each do |x|
%>
<td class="t<%= (start + ((slots_before_cell + x) * interval * 60)).strftime("%M") %>"></td>
<%
end
end %>
<%
end #cell.nil?
end #cells
(0..fillup_slots - 1).each do |x|
%>
<td class="t<%= (start + ((slots + x) * interval * 60)).strftime("%M") %>"></td>
<%
end #x
%>
</tr>
<%
end #flatlist_by_room
end #event_flatlist
end
end
%>
</tbody>
</table>
<%
cfp = item[:conference_call_for_papers_url]
if cfp && !cfp.empty?
%>
<div class="well well-small track-cfp">
<p>Read the Call for Papers at <a href="<%= cfp %>"><%= cfp %></a>.</p>
</div>
<% end %>
<%
description = Kramdown::Document.new(item[:description], :auto_ids => false).to_html
if description
%>
<div class="well well-small track-description">
<%= description %>
</div>
<% end %>
<table class="table table-striped table-bordered table-condensed">
<thead>
<tr>
<th colspan="2">Event</th>
<th>Speakers</th>
<% if item[:rooms].size > 1 %>
<th>Room</th>
<% end %>
<th>Start</th>
<th>End</th>
</tr>
</thead>
<tbody>
<%
item[:events_by_day].each do |day_slug, event_slugs|
unless event_slugs.empty?
day = day(day_slug)
rooms = (item[:rooms].size > 1) ? item[:rooms].map(&$to_room) : []
%>
<tr>
<td colspan="6"><h3><%= day[:title] %></h3></td>
</tr>
<% event_slugs.map(&$to_event).sort_by{|e| [e[:start_time], e[:title], e[:room_rank]]}.each do |e| %>
<tr>
<td class="<%= event_color.fetch e[:event_id] %>"> </td>
<td><%= l e %></td>
<td><%= l e[:speakers].map(&$to_speaker), :title, ", ", nil, 'quiet' %></td>
<% unless rooms.empty? %>
<td><%= l room(e[:room]), :title, ", ", nil, 'quiet' %></td>
<% end %>
<td><%= ltt e, :start, css: 'quiet' %></td>
<td><%= ltt e, :end, css: 'quiet' %></td>
</tr>
<% end %>
<% end %>
<% end %>
</tbody>
</table>