Skip to content

Commit f8488a5

Browse files
committed
Added code block and private method toggles.
1 parent 28bf32a commit f8488a5

File tree

1 file changed

+69
-7
lines changed

1 file changed

+69
-7
lines changed

templates/bootstrap.hbs

Lines changed: 69 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,21 @@
6161

6262
<div class="page-header">
6363

64+
<div class="pull-right">
65+
<div>
66+
<label>
67+
<input type="checkbox" name="toggle-code" class="toggle-code-blocks">
68+
Toggle Code Blocks
69+
</label>
70+
</div>
71+
<div>
72+
<label>
73+
<input type="checkbox" name="toggle-private" class="toggle-private">
74+
Toggle Private Methods/Function
75+
</label>
76+
</div>
77+
</div>
78+
6479
<h1>{{title}}{{#if description}} <small>{{description}}</small>{{/if}}</h1>
6580

6681
</div>
@@ -77,7 +92,9 @@
7792

7893
{{#if ctx}}
7994

80-
<li><a href="#{{formatId ctx.string}}">{{formatName ctx.string}}</a></li>
95+
<li class="scope-{{#if isPrivate}}private{{else}}public{{/if}}">
96+
<a href="#{{formatId ctx.string}}">{{formatName ctx.string}}</a>
97+
</li>
8198

8299
{{/if}}
83100

@@ -93,11 +110,11 @@
93110

94111
{{#each methods}}
95112

96-
<div class="method">
113+
{{#unless ignore}}
97114

98-
{{#unless ignore}}
115+
{{#if ctx}}
99116

100-
{{#if ctx}}
117+
<div class="method scope-{{#if isPrivate}}private{{else}}public{{/if}}">
101118

102119
{{registerContext this}}
103120

@@ -201,11 +218,11 @@
201218

202219
{{/each}}
203220

204-
{{/if}}
221+
</div>
205222

206-
{{/unless}}
223+
{{/if}}
207224

208-
</div>
225+
{{/unless}}
209226

210227
{{/each}}
211228

@@ -227,5 +244,50 @@
227244

228245
</footer>
229246

247+
<script src="http://cdn.jsdelivr.net/jquery/2.1.1/jquery.min.js"></script>
248+
<script>
249+
250+
(function () {
251+
252+
var hash = window.location.hash,
253+
$hash_elem = $('[id="' + hash.replace(/#/, '') + '"]'),
254+
$code_block = $('.code'),
255+
$scope_private = $('.scope-private'),
256+
$toggle_code_blocks = $('.toggle-code-blocks')
257+
$toggle_private = $('.toggle-private');
258+
259+
$toggle_code_blocks.on('click', function () {
260+
261+
if ($toggle_code_blocks.is(':checked')) {
262+
$code_block.show();
263+
} else {
264+
$code_block.hide();
265+
}
266+
267+
});
268+
269+
$toggle_private.on('click', function () {
270+
271+
if ($toggle_private.is(':checked')) {
272+
$scope_private.show();
273+
} else {
274+
$scope_private.hide();
275+
}
276+
277+
});
278+
279+
$code_block.hide();
280+
$scope_private.hide();
281+
282+
if ($hash_elem.length && !$hash_elem.is(':visible')) {
283+
284+
$toggle_private.trigger('click');
285+
286+
}
287+
288+
}());
289+
290+
</script>
291+
230292
</body>
231293
</html>

0 commit comments

Comments
 (0)