Skip to content

Commit 14454d8

Browse files
author
Jordan McCullough
committed
Merge pull request #266 from github/curriculum-help-feature
Add "?" help toggle, modal help dialog
2 parents 722839a + a721dcd commit 14454d8

File tree

2 files changed

+55
-5
lines changed

2 files changed

+55
-5
lines changed

_javascript/curriculum.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ $(function(){
88
$(".slide").toggleClass("hidden");
99
});
1010

11-
1211
// Parse username from querystring
1312
var urlSearch = window.location.search,
1413
teacherQuery = urlSearch.match(/teacher=[a-z,A-Z,0-9]*/),
@@ -100,14 +99,21 @@ $(function(){
10099
}
101100

102101
// Bind checkbox toggle for TOC
103-
var toc = {};
104-
toc.toggle = function(event){
105-
if(event.shiftKey && event.keyCode === 84){
102+
var shortcuts = {};
103+
shortcuts.toggle = function(event){
104+
console.log(event.keyCode);
105+
106+
// Help "?" toggle
107+
if(event.shiftKey && event.keyCode === 191){
108+
$('#help').modal('toggle');
109+
}
110+
// TOC "T" toggle
111+
else if(event.shiftKey && event.keyCode === 84){
106112
$(".col-content").toggleClass("shift-left");
107113
$(".col-toc").toggleClass("shift-left");
108114
}
109115
}
110-
document.addEventListener("keydown", toc.toggle, false);
116+
document.addEventListener("keydown", shortcuts.toggle, false);
111117

112118
// Render the TOC
113119
buildToc();

_layouts/curriculum.html

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,50 @@
33
leadingpath: ../
44
---
55

6+
<!-- Modal -->
7+
<div class="modal fade" id="help" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
8+
<div class="modal-dialog">
9+
<div class="modal-content">
10+
<div class="modal-header">
11+
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
12+
<h4 class="modal-title" id="myModalLabel">Help / Shortcuts</h4>
13+
</div>
14+
<div class="modal-body">
15+
<table>
16+
<tr>
17+
<th>Command</th>
18+
<th>Feature</th>
19+
</tr>
20+
21+
<tr>
22+
<td><code>?</code></td>
23+
<td>Hide/show help</td>
24+
</tr>
25+
26+
<tr>
27+
<td><code>shift</code>+<code>t</code></td>
28+
<td>Hide/show table of contents</td>
29+
</tr>
30+
31+
<tr>
32+
<td><code>?teacher=[github-user]</code></td>
33+
<td>Auto-generated teacher slide</td>
34+
</tr>
35+
</table>
36+
</div>
37+
</div>
38+
</div>
39+
</div>
40+
41+
42+
43+
44+
45+
<div id="help" class="help">
46+
<div class="content">
47+
48+
</div>
49+
</div>
650

751
<div class="timer-wrapper fade-out">
852
<div class="timer">

0 commit comments

Comments
 (0)