-
Notifications
You must be signed in to change notification settings - Fork 17
/
blackboard.html
512 lines (503 loc) · 18.9 KB
/
blackboard.html
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
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
<template name="blackboard">
<!-- puzzles w/ index -->
<div class="row-fluid">
<div id="bb-sidebar" class="span2">
<ul class="nav nav-list bb-sidenav span2">
<li><a class="bb-wiki" href="{{wiki title=""}}"
target="_blank">Codex Wiki</a></li>
<li class="divider"></li>
{{#each roundgroups}}
<li class="nav-header">{{name}}</li>
{{#each rounds}}
<li><a title="r{{round_num}}" href="#r{{round._id}}{{updateScrollSpy}}"><i class="icon-chevron-right"></i>
{{round.name}}</a></li>
{{/each}}
{{/each}}
</ul>
</div>
<div id="bb-tables" class="{{#if hideStatus}}span10{{else}}span8{{/if}} {{#if canEdit}}bb-canEdit{{/if}}">
<!-- content div -->
<div class="btn-toolbar pull-right text-right bb-top-buttons">
{{#if canEdit}}
<div class="btn-group">
<button class="btn btn-mini btn-inverse bb-add-round-group">
<i class="bb-add-icon icon-plus icon-white"></i>
Add new round group
</button>
</div>
{{else}}
<div class="btn-group text-left">
{{#if notificationsEnabled}}
<button class="btn btn-small bb-notification-enabled{{#if anyNotificationsEnabled}} btn-inverse{{/if}}">
<i class="{{#if anyNotificationsEnabled}}icon-bullhorn icon-white{{else}}icon-off{{/if}}"></i>
Notifications
</button>
<button class="btn btn-small dropdown-toggle{{#if anyNotificationsEnabled}} btn-inverse{{/if}}" data-toggle="dropdown">
<span class="caret"></span>
</button>
<ul class="dropdown-menu pull-left bb-notification-controls">
{{#each notificationStreams}}
<li><a href="#"><label for="bb-notification-{{name}}">
<input type="checkbox" id="bb-notification-{{name}}"
data-notification-stream="{{name}}"
checked="{{notificationStreamEnabled name}}">
{{label}}
</label></a></li>
{{/each}}
</ul>
{{else if notificationsAsk}}
<button class="btn btn-small bb-notification-ask">
<i class="icon-off"></i>
Enable notifications
</button>
{{/if}}
</div>
{{/if}}
<div class="btn-group bb-sort-order">
<button class="btn btn-small {{#if sortReverse}}active{{/if}}"
data-sortReverse="true">Newest rounds first</button>
<button class="btn btn-small {{#unless sortReverse}}active{{/unless}}"
data-sortReverse="false">Oldest rounds first</button>
</div>
{{#unless canEdit}}<br/>
<div class="btn-group btn-group-vertical">
<label class="checkbox bb-hide-solved">
<input type="checkbox" id="bb-hide-solved-input" checked="{{hideSolved}}">
Hide solved puzzles
</label>
<label class="checkbox bb-hide-rounds-solved-meta">
<input type="checkbox" id="bb-hide-rounds-solved-meta-input" checked="{{hideRoundsSolvedMeta}}">
Hide rounds with solved metas
</label>
<label class="checkbox bb-compact-mode">
<input type="checkbox" id="bb-compact-mode" checked="{{compactMode}}">
Compact mode
</label>
</div>
{{/unless}}
</div>
<h1 align="center" class="bb-blackboard-h1">
<span class="bb-no-wrap">
<span class="bb-hide-when-narrower">Codex</span></span> <span class="bb-hide-when-narrow">Puzzle </span><span class="bb-no-wrap">Blackboard
</span>
</h1>
<table class="table table-bordered table-condensed bb-puzzle">
<thead>
{{#unless compactMode}}
<tr>
<th class="puzzle-name">Name</th>
<th class="puzzle-answer">Solution</th>
<th class="puzzle-status">Status</th>
{{#unless canEdit}}
<th class="puzzle-working">Working on this</th>
<th class="puzzle-update">Last update</th>
{{/unless}}
</tr>
{{/unless}}
</thead>
{{#each roundgroups}}
<tr><th colspan="{{nCols}}" id="group{{_id}}">
<h2 class="bb-editable" data-bbedit="roundgroups/{{_id}}/title">
{{#if editing "roundgroups" _id "title"}}
<input type="text" id="roundgroups-{{_id}}-title"
value="{{name}}"
class="input-block-level" autofocus />
{{else}}
{{#if canEdit}}
<i class="bb-delete-icon icon-remove pull-left"
title="Delete this round group"></i>
<i class="bb-edit-icon icon-pencil pull-right"
title="Edit the name of this round group"></i>
{{else}}
{{link id=_id title="Chat room for round group" chat=true icon="icon-comment" class="pull-right bb-rg-chat"}}
{{/if}}
{{name}}
{{/if}}
</h2>
{{#unless compactMode}}{{>blackboard_tags}}{{/unless}}
{{>blackboard_link}}
{{#if canEdit}}
<div class="bb-roundgroup-buttons" data-bbedit="roundgroups/{{_id}}">
<button class="btn btn-mini btn-inverse bb-add-round">
<i class="icon-plus icon-white"></i>
Add new round to this group
</button>
<button class="btn btn-mini btn-inverse bb-add-tag">
<i class="icon-tag icon-white"></i>
Add new tag to this group
</button>
<button class="btn btn-mini btn-inverse bb-move-down">
<i class="icon-arrow-down icon-white"></i>
Move group down
</button>
<button class="btn btn-mini btn-inverse bb-move-up">
<i class="icon-arrow-up icon-white"></i>
Move group up
</button>
</div>
{{/if}}
</th></tr>
{{#each rounds}}
{{> blackboard_round }}
{{/each}}
{{/each}}
</table>
</div><!-- bb-tables -->
{{#if hideStatus}}
<div class="bb-hide-status"><i class='icon-chevron-left'></i></div>
{{else}}
<div id="bb-right-sidebar" class="span2"><div>
<div class="bb-hide-status"><i class='icon-chevron-right'></i></div>
{{> blackboard_status_grid}}
</div></div><!-- bb-right-sidebar -->
{{/if}}
</div><!-- row-fluid -->
</template>
<template name="blackboard_status_grid">
<div class="bb-status-grid">
{{#each roundgroups}}
<div class="bb-status-grid-row {{#if solved}}bb-status-solved{{else}}{{#if stuck this}}bb-status-stuck{{else}}bb-status-unsolved{{/if}}{{/if}}">{{link id=_id}}</div>
{{#each rounds}}
<div class="bb-status-grid-row">
<div class="bb-status-grid-cell">
<div class="{{#if round.solved}}bb-status-solved{{else}}{{#if stuck round}}bb-status-stuck{{else}}bb-status-unsolved{{/if}}{{/if}}">
{{link id=round._id title=round.name text=rX}}:
</div>
</div><!--
-->{{#each puzzles}}<!--
--><div class="bb-status-grid-cell">
<div class="{{#if puzzle.solved}}bb-status-solved{{else}}{{#if stuck puzzle}}bb-status-stuck{{else}}bb-status-unsolved{{/if}}{{/if}}">
{{link id=puzzle._id title=puzzle.name text=puzzle_num}}
</div>
</div><!--
-->{{/each}}
</div>
{{/each}}
{{/each}}
</div><!-- bb-status-grid -->
</template>
<template name="blackboard_round">
{{#if showRound }}
<tbody id="r{{round._id}}{{updateScrollSpy}}">
<tr><th colspan="{{nCols}}">
<h3 class="bb-editable" data-bbedit="rounds/{{round._id}}/title">
{{#if editing "rounds" round._id "title"}}
<input type="text" id="rounds-{{round._id}}-title"
value="{{round.name}}"
class="input-block-level" autofocus />
{{else}}
{{#if canEdit}}
<i class="bb-delete-icon icon-remove pull-left"
title="Delete this round"></i>
<i class="bb-edit-icon icon-pencil pull-right"
title="Edit the name of this round"></i>
{{/if}}
{{link id=round._id title=rX editing=canEdit}}
<small>({{rX}}: {{num_solved}}/{{num_puzzles}} puzzles solved)</small>
{{/if}}
</h3></th></tr>
{{#if hasPuzzles}}
{{! META }}
{{#if showMeta}}
<tr class="{{#if stuck round}}bb-status-stuck{{/if}}">
<td class="puzzle-name"><div>
{{#unless canEdit}}
<a href="{{spread_link round.spreadsheet}}" title="Spreadsheet for round" class="pull-right"><i class="icon-th"></i></a>
{{link id=round._id title="Chat room for round" chat=true class="pull-right" icon="icon-comment"}}
{{#if round.link}}<a class="pull-right" href="{{round.link}}" title="Link to hunt site"><i class="icon-share-alt"></i></a>{{/if}}
{{/unless}}
<b>{{link id=round._id title=rX text="ROUND/META" editing=canEdit}}</b>
{{#if canEdit}}
<div class="bb-puzzle-add-move" data-bbedit="rounds/{{round._id}}">
<button class="btn btn-link bb-add-tag"
title="Add tag to puzzle">
<i class="icon-tags"></i>
<i class="icon-plus"></i>
</button>
</div>
{{/if}}
{{#unless compactMode}}
{{#with round}}{{>blackboard_puzzle_tags}}{{/with}}
{{/unless}}
{{#with round}}{{>blackboard_link}}{{/with}}
</div></td>
<td class="puzzle-answer bb-editable"
data-bbedit="tags/{{round._id}}/answer/value">
{{#if editing "tags" round._id "answer" "value"}}
<input type="text" id="tags-{{round._id}}-answer-value"
value="{{tag "answer"}}"
class="input-block-level" autofocus />
{{else}}
{{#if canEdit}}
<i class="bb-edit-icon icon-pencil pull-right"
title="Change the meta answer for this round"></i>
{{#if tag "answer"}}
<i class="bb-delete-icon icon-remove pull-left"
title="Delete the meta answer for this round"></i>
{{/if}}
{{/if}}
<b>{{tag "answer"}}</b>
{{/if}}
</td>
{{#unless compactMode}}
<td class="puzzle-status bb-editable"
data-bbedit="tags/{{round._id}}/status/value">
{{#if editing "tags" round._id "status" "value"}}
<input type="text" id="tags-{{round._id}}-status-value"
value="{{tag "status"}}"
class="input-block-level" autofocus />
{{else}}
{{#if canEdit}}
<i class="bb-edit-icon icon-pencil pull-right"
title="Change the status of this round meta"></i>
{{#if tag "status"}}
<i class="bb-delete-icon icon-remove pull-left"
title="Delete the status message for this round meta"></i>
{{/if}}
{{/if}}
{{tag "status"}}
{{/if}}
</td>
{{#unless canEdit}}
<td class="puzzle-working">
<div class="{{#if lotsOfPeople whos_working.count}}bb-lots{{/if}}">
<span class="bb-short">
{{ whos_working.count }} people
({{local_working}}<i class="icon-map-marker"></i>)
</span>
<span class="bb-long">
{{#each whos_working}}{{> nick_presence }} {{/each}}
</span>
</div>
</td>
<td class="puzzle-update">
{{#if round.solved}}solved {{pretty_ts timestamp=round.solved style="brief duration"}}
{{else}}added {{pretty_ts timestamp=round.created style="brief duration"}}
{{/if}}
</td>
{{/unless}}
{{/unless}}
</tr>
{{/if}}
{{#each puzzles}}
{{> blackboard_puzzle}}
{{/each}}
{{else}}
<tr><td colspan="{{nCols}}">No puzzles in this round yet.</td></tr>
{{/if}}
{{#if canEdit}}
<tr><td colspan="{{nCols}}">
<div class="bb-round-buttons" data-bbedit="rounds/{{round._id}}">
<button class="btn btn-mini btn-inverse bb-add-puzzle">
<i class="icon-plus icon-white"></i>
Add new puzzle to this round
</button>
<button class="btn btn-mini btn-inverse bb-move-down">
<i class="icon-arrow-down icon-white"></i>
Move round down
</button>
<button class="btn btn-mini btn-inverse bb-move-up">
<i class="icon-arrow-up icon-white"></i>
Move round up
</button>
</div>
</td></tr>
{{/if}}
</tbody>
{{/if}}
</template>
<template name="nick_presence">
<span class="nick {{#unless foreground}}background{{/unless}} {{#if nickNear nick}}near{{/if}}"
title="{{nickOrName nick}}{{nickLocation nick}}">{{gravatar id=email image="wavatar" size=14 }}</span>
</template>
<template name="blackboard_puzzle">
<tr class="{{#if stuck puzzle}}bb-status-stuck{{/if}}"><!-- {{id}} -->
<td class="puzzle-name"><div>{{! div needed to establish relative pos }}
<div class="bb-editable" data-bbedit="puzzles/{{puzzle._id}}/title">
{{#if editing "puzzles" puzzle._id "title"}}
<input type="text" id="puzzles-{{puzzle._id}}-title"
value="{{puzzle.name}}"
class="input-block-level" autofocus />
{{else}}
{{#if canEdit}}
<i class="bb-delete-icon icon-remove pull-left"
title="Delete this puzzle"></i>
<i class="bb-edit-icon icon-pencil pull-right"
title="Edit the name of this puzzle"></i>
{{else}}
<a href="{{spread_link puzzle.spreadsheet}}" title="Spreadsheet for puzzle" class="pull-right"><i class="icon-th"></i></a>
{{link id=puzzle._id title="Chat room for puzzle" chat=true class="pull-right" icon="icon-comment"}}
{{#if puzzle.link}}<a class="pull-right" href="{{puzzle.link}}" title="Link to hunt site"><i class="icon-share-alt"></i></a>{{/if}}
{{/if}}
{{link id=puzzle._id title=rXpY editing=canEdit}}
{{/if}}
</div>
{{#if canEdit}}
<div class="bb-puzzle-add-move" data-bbedit="puzzles/{{puzzle._id}}">
<button class="btn btn-link bb-add-tag"
title="Add tag to puzzle">
<i class="icon-tags"></i>
<i class="icon-plus"></i>
</button>
<button class="btn btn-link bb-move-down"><i class="icon-arrow-down"></i></button>
<button class="btn btn-link bb-move-up"><i class="icon-arrow-up"></i></button>
</div>
{{/if}}
{{#unless compactMode}}
{{#with puzzle}}{{>blackboard_puzzle_tags}}{{/with}}
{{/unless}}
{{#with puzzle}}{{>blackboard_link}}{{/with}}
</div></td>
<td class="puzzle-answer bb-editable"
data-bbedit="tags/{{puzzle._id}}/answer/value">
{{#if editing "tags" puzzle._id "answer" "value"}}
<input type="text" id="tags-{{puzzle._id}}-answer-value"
value="{{tag "answer"}}"
class="input-block-level" autofocus />
{{else}}
{{#if canEdit}}
<i class="bb-edit-icon icon-pencil pull-right"
title="Change the answer of this puzzle"></i>
{{/if}}
{{#if tag "answer"}}
{{#if canEdit}}
<i class="bb-delete-icon icon-remove pull-left"
title="Delete the answer to this puzzle"></i>
{{/if}}
<span class="answer">{{tag "answer"}}</span>
{{/if}}
{{/if}}
</td>
{{#unless compactMode}}
<td class="puzzle-status bb-editable"
data-bbedit="tags/{{puzzle._id}}/status/value">
{{#if editing "tags" puzzle._id "status" "value"}}
<input type="text" id="tags-{{puzzle._id}}-status-value"
value="{{tag "status"}}"
class="input-block-level" autofocus />
{{else}}
{{#if canEdit}}
<i class="bb-edit-icon icon-pencil pull-right"
title="Change the status of this puzzle"></i>
{{#if tag "status"}}
<i class="bb-delete-icon icon-remove pull-left"
title="Delete the status message for this puzzle"></i>
{{/if}}
{{/if}}
{{tag "status"}}
{{/if}}
</td>
{{#unless canEdit}}
<td class="puzzle-working">
<div class="{{#if lotsOfPeople whos_working.count}}bb-lots{{/if}}">
<span class="bb-short">
{{ whos_working.count }} people
({{local_working}}<i class="icon-map-marker"></i>)
</span>
<span class="bb-long">
{{#each whos_working}}{{> nick_presence }} {{/each}}
</span>
</div>
</td>
<td class="puzzle-update">
{{#if puzzle.solved}}solved {{pretty_ts timestamp=puzzle.solved style="brief duration"}}
{{else}}added {{pretty_ts timestamp=puzzle.created style="brief duration"}}
{{/if}}
</td>
{{/unless}}
{{/unless}}
</tr>
</template>
<template name="blackboard_tags">
<dl class="dl-horizontal">{{#each tags _id}}
<dt class="bb-editable"
data-bbedit="tags/{{id}}/{{canon}}/name">
{{#if editing "tags" id canon "name"}}
<input type="text" id="tags-{{id}}-{{canon}}-name"
value="{{name}}"
class="input-block-level" autofocus />
{{else}}
{{#if canEdit}}
<i class="bb-edit-icon icon-pencil pull-left"
title="Edit the name of this tag"></i>
{{/if}}
{{name}}:
{{/if}}
</dt>
<dd class="bb-editable"
data-bbedit="tags/{{id}}/{{canon}}/value">
{{#if editing "tags" id canon "value"}}
<input type="text" id="tags-{{id}}-{{canon}}-value"
value="{{value}}"
class="input-block-level" autofocus />
{{else if canEdit}}
<i class="bb-delete-icon icon-remove pull-left"
title="Delete this tag and value"></i>
<i class="bb-edit-icon icon-pencil pull-right"
title="Edit the value of this tag"></i>
{{value}}
{{else if value}}
{{linkify value}}
{{else}}
{{! make sure right-hand side stays in place! }}
{{/if}}
</dd>
{{/each}}</dl>
</template>
<template name="blackboard_puzzle_tags">
<table class="bb-tag-table"><tbody>{{#each tags _id}}
<tr>
<td class="bb-editable"
data-bbedit="tags/{{id}}/{{canon}}/name">
{{#if editing "tags" id canon "name"}}
<input type="text" id="tags-{{id}}-{{canon}}-name"
value="{{name}}"
class="input-block-level" autofocus />
{{else}}
{{#if canEdit}}
<i class="bb-edit-icon icon-pencil pull-left"
title="Edit the name of this tag"></i>
{{/if}}
{{name}}:
{{/if}}
</td>
<td class="bb-editable"
data-bbedit="tags/{{id}}/{{canon}}/value">
{{#if editing "tags" id canon "value"}}
<input type="text" id="tags-{{id}}-{{canon}}-value"
value="{{value}}"
class="input-block-level" autofocus />
{{else if canEdit}}
<i class="bb-delete-icon icon-remove pull-left"
title="Delete this tag and value"></i>
<i class="bb-edit-icon icon-pencil pull-right"
title="Change the value of this tag"></i>
{{value}}
{{else}}
{{linkify value}}
{{/if}}
</td>
</tr>
{{/each}}</tbody></table>
</template>
<template name="blackboard_link">
{{#if canEdit}}
<table class="bb-tag-table"><tbody>
<tr>
<td>Hunt site link:</td>
<td class="bb-editable"
data-bbedit="link/{{_id}}">
{{#if editing "link" _id}}
<input type="text" id="link-{{_id}}"
value="{{./link}}"
class="input-block-level" autofocus />
{{else if canEdit}}
<i class="bb-edit-icon icon-pencil pull-right"
title="Change the value of the hunt site link"></i>
<a href="{{./link}}">{{./link}}</a>
{{/if}}
</td>
</tr>
</tbody></table>
{{/if}}
</template>