-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathtemplate.html.erb
438 lines (436 loc) · 16.9 KB
/
template.html.erb
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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
---
custom_colors: true
---
<% current_page.data.title =
"#{i.tournament.year} "\
"#{tournament_title_short(i.tournament)} " \
"(Div. #{i.tournament.division}) | Unosmium Results" %>
<% champion = i.tournament.teams[0] %>
<% runnerup = i.tournament.teams[1] %>
<% current_page.data.description =
"Full results for the #{i.tournament.year} "\
"#{tournament_title(i.tournament)} "\
"(Division #{i.tournament.division}), "\
"Champion: #{champion.school} "\
"#{champion.suffix ? champion.suffix + " " : ""}"\
"(#{champion.points} pts), "\
"Runner-up: #{runnerup.school} "\
"#{runnerup.suffix ? runnerup.suffix + " " : ""}"\
"(#{runnerup.points} pts), "\
"Total non-exhibition teams: #{i.tournament.nonexhibition_teams_count}" %>
<div class="results-classic-wrapper">
<div class="results-classic-thead-background shadow-sm"
style="min-width: <%= 2*(i.events.count + 1) + 28.5 %>em;">
<div class="results-classic-header"
style="width: <%= 2*(i.events.count + 1) + 28 %>em">
<div class="tournament-info">
<h1>
<%= i.tournament.year %>
<%= tournament_title(i.tournament) %> (Div. <%= i.tournament.division %><%= ' <span id="subdivision">Combined</span>' if i.tournament.subdivisions? %>)
</h1>
<p><%= i.tournament.date.strftime('%A, %B %-d, %Y') %>
@ <span style="white-space: nowrap;"><%= i.tournament.location %></span></p>
</div>
<div class="actions">
<a href="../results/index.html" class="js-back-button">
<svg viewBox="0 0 24 24"><path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"/></svg>
</a>
<button type="button" data-toggle="modal" data-target="#download-info">
<svg viewBox="0 0 24 24"><path d="M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"/></svg>
</button>
<button type="button" data-toggle="modal" data-target="#print-instructions">
<svg viewBox="0 0 24 24"><path d="M19 8H5c-1.66 0-3 1.34-3 3v6h4v4h12v-4h4v-6c0-1.66-1.34-3-3-3zm-3 11H8v-5h8v5zm3-7c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm-1-9H6v4h12V3z"/></svg>
</button>
<button type="button" id="share-button">
<svg viewBox="0 0 24 24"><path d="M18 16.08c-.76 0-1.44.3-1.96.77L8.91 12.7c.05-.23.09-.46.09-.7s-.04-.47-.09-.7l7.05-4.11c.54.5 1.25.81 2.04.81 1.66 0 3-1.34 3-3s-1.34-3-3-3-3 1.34-3 3c0 .24.04.47.09.7L8.04 9.81C7.5 9.31 6.79 9 6 9c-1.66 0-3 1.34-3 3s1.34 3 3 3c.79 0 1.5-.31 2.04-.81l7.12 4.16c-.05.21-.08.43-.08.65 0 1.61 1.31 2.92 2.92 2.92 1.61 0 2.92-1.31 2.92-2.92s-1.31-2.92-2.92-2.92z"/></svg>
</button>
<select id="event-select" class="custom-select custom-select-sm"
aria-label="Select Event Filter">
<option value="all" selected>All Events</option>
<% i.events.each.with_index do |e, i| %>
<option value="<%= i %>">
<%= e.name %>
<% if e.trial? %>
(Trial)
<% elsif e.trialed? %>
(Trialed)
<% end %>
</option>
<% end %>
</select>
<select id="sort-select" class="custom-select custom-select-sm"
aria-label="Select Sort Method">
<option value="number">by Number</option>
<option value="school">by School</option>
<option value="state">by State</option>
<option value="rank" selected>by Rank</option>
</select>
<button type="button" data-toggle="modal" data-target="#filters" class="settings">
<svg viewBox="0 0 24 24"><path d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"/></svg>
</button>
</div>
<p class="source">
Source:
<a href="https://unosmium.org<%= current_page.url %>">
Unosmium Results
</a>
</p>
</div>
</div>
<table class="results-classic table-hover">
<colgroup>
<col>
<col>
<col>
<col>
<col>
</colgroup>
<colgroup class="event-columns">
<% i.events.count.times do %>
<col>
<% end %>
<col> <%# for team penalties, which kinda act like an additional event %>
</colgroup>
<thead>
<tr>
<th class="number">#</th>
<th class="team">Team</th>
<th class="event-points-focus"><div></div></th>
<th class="rank"><div>Overall</div></th>
<th class="total-points">Total</th>
<% i.events.each do |e| %>
<th class="event-points">
<%= e.name %>
<% if e.trial? %>
<a tabindex="0" role="button"
data-toggle="popover" data-trigger="focus"
title="Trial Event"
data-content="Placings in this event did not count towards total
team score">
<span class="badge badge-info"><small>T</small></span>
</a>
<% elsif e.trialed? %>
<a tabindex="0" role="button"
data-toggle="popover" data-trigger="focus"
title="Trialed Event"
data-content="Placings in this event did not count towards total
team score because of unforseen circumstances during
the competition">
<span class="badge badge-danger"><small>Td</small></span>
</a>
<% end %>
</th>
<% end %>
<th class="team-penalties">Team Penalties</th>
</tr>
</thead>
<tbody>
<% i.teams.each do |tm| %>
<tr data-team-number="<%= tm.number %>"
data-school="<%= full_school_name(tm) %>"
data-team-name="<%= full_team_name(tm) %>"<%= " data-subdivision=\"#{tm.subdivision}\"" if i.tournament.subdivisions? %>>
<td class="number">
<a href="?team=<%= tm.number %>"
data-toggle="modal" data-target="#team-detail">
<%= tm.number %>
</a>
</td>
<td class="team">
<%= format_school(tm) %>
<%= tm.suffix %>
<%= "(#{tm.city})" if tm.city %>
<small><%= tm.state %></small>
<% if tm.disqualified? %>
<a tabindex="0" role="button"
data-toggle="popover" data-trigger="focus"
title="Disqualified Team"
data-content="This team is ranked behind all other teams that were not
disqualified">
<span class="badge badge-danger"><small>Dq</small></span>
<% elsif tm.exhibition? %>
<a tabindex="0" role="button"
data-toggle="popover" data-trigger="focus"
<% if team_attended?(tm) %>
title="Exhibition Team"
data-content="Placings by this team did not affect the ranks of other
teams (except in Trial Events)">
<span class="badge badge-warning"><small>Ex</small></span>
<% else %>
title="Absent Team"
data-content="This team registered but did not compete, and so was
treated as an Exhibition Team">
<span class="badge badge-light"><small>Ab</small></span>
<% end %>
</a>
<% end %>
</td>
<td class="event-points-focus" data-points=""><div></div></td>
<td class="rank" data-points="<%= tm.rank %>"<%= " data-o-points=\"#{tm.rank}\" data-o-sup-tag=\"#{bids_sup_tag(tm)}\" data-sub-points=\"#{tm.subdivision_team.rank}\"" if tm.subdivision %>><div><%= tm.rank %><%= bids_sup_tag(tm) %></div></td>
<td class="total-points"<%= " data-o-points=\"#{tm.points}\" data-sub-points=\"#{tm.subdivision_team.points}\"" if tm.subdivision %>><%= tm.points %></td>
<% i.events.each do |e| %>
<% placing = e.placing_for(tm) %>
<% points = placing.isolated_points %>
<% place = placing.place %>
<% unknown = placing.unknown? %>
<td class="event-points"
data-true-points="<%= placing.points %>"
data-notes="<%= placing_notes(placing) %>"
data-points="<%= unknown ? '??' : points %>"
data-place="<%= unknown && placing.points_limited_by_maximum_place? ? "≥#{i.tournament.maximum_place}" : place %>"
<% if tm.subdivision %>
data-o-true-points="<%= placing.points %>"
data-o-notes="<%= placing_notes(placing) %>"
data-o-points="<%= unknown ? '??' : points %>"
data-o-place="<%= unknown && placing.points_limited_by_maximum_place? ? "≥#{i.tournament.maximum_place}" : place %>"
data-o-sup-tag="<%= sup_tag(placing) %>"
<% sp = placing.subdivision_placing %>
data-sub-true-points="<%= sp.points %>"
data-sub-notes="<%= placing_notes(sp) %>"
data-sub-points="<%= sp.unknown? ? '??' : sp.isolated_points %>"
data-sub-place="<%= sp.place %>"
data-sub-sup-tag="<%= sup_tag(sp) %>"
<% end %>
data-sortable-place="<%= place ? place : (unknown ? 998000 + points : 999000 + points) %>">
<div><%= unknown && !placing.points_limited_by_maximum_place? ? '??' : points %><%= sup_tag(placing) %></div>
</td>
<% end %>
<% pen_points = tm.penalties.sum(&:points) %>
<td class="team-penalties text-muted" data-points="<%= pen_points %>">
<%= pen_points.zero? ? "00" : "+#{pen_points}" %>
</td>
</tr>
<% end %>
</tbody>
</table>
<div class="results-classic-footnotes"
style="width: <%= 2*(i.events.count + 1) + 28 %>em">
<% if i.tournament.ties? || i.tournament.exempt_placings? || i.tournament.worst_placings_dropped? || i.tournament.bids.nonzero? %>
<div class="wrapper">
<% if i.tournament.bids.nonzero? %>
<p class="footnote">
<sup>✧</sup><%= bids_sup_tag_note(i.tournament) %>
</p>
<% end %>
<% if i.tournament.exempt_placings? || i.tournament.worst_placings_dropped? %>
<p class="footnote">
<sup>◊</sup>Result was not counted as part of total score
</p>
<% end %>
<% if i.tournament.ties_outside_of_maximum_places? %>
<p class="footnote">
<sup>*</sup>Tied with another team
</p>
<% end %>
</div>
<% end %>
</div>
</div>
<div class="modal" id="filters" tabindex="-1" role="dialog"
aria-labelledby="filters-label" aria-hidden="true">
<div class="modal-dialog" role="form">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="filters-label">
Filters
</h5>
<button type="button" class="close" data-dismiss="modal"
aria-label="Close">
<span aria-hidden="true" style="vertical-align: super">×</span>
</button>
</div>
<div class="modal-body">
<% if i.tournament.subdivisions? %>
<h6>Select which subdivision to show</h6>
<div>
<input type="radio" id="sub-combined" name="subdivision" checked>
<label class="custom-control-label" for="sub-combined">
Combined (all teams)
</label>
</div>
<% i.tournament.subdivisions.each do |s, _| %>
<div>
<input type="radio" id="sub-<%= s %>" name="subdivision">
<label class="custom-control-label" for="sub-<%= s %>">
<%= s %>
</label>
</div>
<% end %>
<hr>
<% end %>
<h6>Select which teams to show</h6>
<div id="team-filter">
<div>
<input type="checkbox"
id="allTeams" checked>
<label class="custom-control-label" for="allTeams">
All Teams
</label>
</div>
<% i.teams.sort_by(&:number).each do |tm| %>
<div>
<input type="checkbox"
id="team<%= tm.number %>" checked>
<label class="custom-control-label" for="team<%= tm.number %>">
<%= tm.number %> <%= format_school(tm) %>
<%= tm.suffix %>
<%= "(#{tm.city})" if tm.city %>
<small><%= tm.state %></small>
</label>
</div>
<% end %>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">
Close
</button>
</div>
</div>
</div>
</div>
<div class="modal" id="print-instructions" tabindex="-1" role="dialog"
aria-labelledby="print-instructions-label" aria-hidden="true">
<div class="modal-dialog" role="form">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="print-instructions-label">
Instructions for printing
</h5>
<button type="button" class="close" data-dismiss="modal"
aria-label="Close">
<span aria-hidden="true" style="vertical-align: super">×</span>
</button>
</div>
<div class="modal-body">
<p>For best results, ensure the following:</p>
<ul>
<li>The printer is set to "Save as PDF", not "Microsoft Print to PDF".</li>
<li>The page is scaled so that the yellow "Team Penalties" column is visible.</li>
<li>The paper size is set appropriately for your printer (commonly "US Letter").
</ul>
<p class="small">
Note: You may want to use your browser's Print Preview feature before
printing.
</p>
<p>
The output will be in style of official results from the National
competition, suitable for distributing to teams after awards.
</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">
Cancel
</button>
<button type="button" class="btn btn-secondary" onclick="window.print();">
Print
</button>
</div>
</div>
</div>
</div>
<div class="modal" id="download-info" tabindex="-1" role="dialog"
aria-labelledby="download-info-label" aria-hidden="true">
<div class="modal-dialog" role="form">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="download-info-label">
About downloading
</h5>
<button type="button" class="close" data-dismiss="modal"
aria-label="Close">
<span aria-hidden="true" style="vertical-align: super">×</span>
</button>
</div>
<div class="modal-body">
<p>
To download these results as a PDF, select CANCEL and see the
instructions for printing (
<svg viewBox="0 0 24 24"><path d="M19 8H5c-1.66 0-3 1.34-3 3v6h4v4h12v-4h4v-6c0-1.66-1.34-3-3-3zm-3 11H8v-5h8v5zm3-7c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm-1-9H6v4h12V3z"/></svg>
) instead.
</p>
<p>
The results will be downloaded as a YAML file, specifically in the
SciolyFF, and can be opened with any text editor or parsed with your
favorite programming language. For more info about SciolyFF, see its
<a href="https://github.com/unosmium/sciolyff">GitHub repository</a>.
</p>
<p>
If you really want a CSV file, select CANCEL, copy the whole table
using <kbd>Ctrl+A</kbd> and <kbd>Ctrl+C</kbd>, then paste into a new
<a href="https://docs.google.com/spreadsheets/">Google Sheets</a>
spreadsheet and do File > Download as > Comma-separated values.
</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">
Cancel
</button>
<a role="button" class="btn btn-secondary"
href="../data/<%= File.basename(current_page.path, '.html') + '.yaml' %>">
Download
</a>
</div>
</div>
</div>
</div>
<div class="modal" id="team-detail" tabindex="-1" role="dialog"
aria-labelledby="team-detail-label" aria-hidden="true">
<div class="modal-dialog" role="form">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="team-detail-label">
Details for Team <span id="number">[number]</span>
</h5>
<button type="button" class="close" data-dismiss="modal"
aria-label="Close">
<span aria-hidden="true" style="vertical-align: super">×</span>
</button>
</div>
<div class="modal-body">
<h6>Summary</h6>
<p><span id="team">[team]</span> placed <span id="place">[place]</span>
overall with a total score of <span id="points">[points]</span> points.
<hr>
<div class="table-responsive-md">
<table class="table-striped">
<thead>
<tr>
<th class="event">Event</th>
<th class="points">Points</th>
<th class="place">Place</th>
<th class="notes">Notes</th>
</tr>
</thead>
<tbody>
<% i.events.each do |e| %>
<tr>
<td class="event">
<%= e.name %>
</td>
<td class="points"></td>
<td class="place"></td>
<td class="notes"></td>
</tr>
<% end %>
</tbody>
</table>
</div>
<hr>
<h6>Other Results</h6>
<p><a href="#" id="other-results">
View results for <span id="school">[school]</span> in other tournaments
</a></p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">
Close
</button>
</div>
</div>
</div>
</div>
<div class="snackbar" id="share-snack">
<div class="snackbar-body">
<%# populated using JS %>
</div>
</div>