Skip to content

Commit 99a17c5

Browse files
committed
accordion doc navigation & search
1 parent 1901d03 commit 99a17c5

File tree

13 files changed

+158
-28
lines changed

13 files changed

+158
-28
lines changed

_includes/docs_contents.html

Lines changed: 0 additions & 8 deletions
This file was deleted.

_includes/docs_nav.html

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
2+
{% for section in site.data.docs %}
3+
<div class="panel panel-default">
4+
<div class="panel-heading">
5+
<h4 class="panel-title">
6+
<a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse-{{forloop.index}}" aria-expanded="false" aria-controls="collapse-{{forloop.index}}">
7+
{{ section.title }}
8+
</a>
9+
</h4>
10+
</div>
11+
<div id="collapse-{{forloop.index}}" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingOne">
12+
<ul class="list-group">
13+
{% for item in section.docs %}
14+
{% assign item_url = item | prepend:"/docs/" | append:"/" %}
15+
{% assign p = site.docs | where:"url", item_url | first %}
16+
<a class="list-group-item {% if item_url == page.url %}active{% endif %}" href="{{ p.url }}">{{ p.title }}</a>
17+
{% endfor %}
18+
</ul>
19+
</div>
20+
</div>
21+
{% endfor %}
22+
</div>

_includes/docs_ul.html

Lines changed: 0 additions & 7 deletions
This file was deleted.

_includes/footer.html

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,3 @@
1010
<!-- <p class="text-muted">Place sticky footer content here.</p> -->
1111
</div>
1212
</footer>
13-
14-
<script src="https://code.jquery.com/jquery-1.10.2.min.js"></script>
15-
<script src="{{ " /js/bootstrap.min.js " | prepend: site.baseurl }} "></script>

_includes/js_files.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<script src="https://code.jquery.com/jquery-1.10.2.min.js"></script>
2+
<script src="{{ " /js/bootstrap.min.js " | prepend: site.baseurl }} "></script>
3+
<script src="{{ " /js/typeahead.bundle.min.js " | prepend: site.baseurl }} "></script>
4+
5+
<script src="{{ " /js/main.js " | prepend: site.baseurl }} "></script>

_includes/topnav.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@
1717
<li {% if page.sectionid=='blog' %} class="active" {% endif %}><a href="{{ site.posts.first.url | prepend: site.baseurl }}">Blog</a></li>
1818
<li><a href="{{ site.github_address }}"><i class="fa fa-github" aria-hidden="true"></i> GitHub</a></li>
1919
</ul>
20+
<form class="navbar-form navbar-right">
21+
<input id="search-box" type="text" class="form-control" placeholder="Search...">
22+
23+
<!-- <div id="search-box-container">
24+
25+
</div> -->
26+
</form>
2027
</div>
2128
</div>
2229
</nav>

_layouts/default.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
</div>
1515

1616
{% include footer.html %}
17-
17+
{% include js_files.html %}
1818
</body>
1919

2020
</html>

_layouts/docs.html

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,15 @@
77
<div class="container">
88
<div class="row">
99
<div class="col-md-4">
10-
11-
<div class="panel panel-default">
12-
<div class="panel-body">
13-
{% include docs_contents.html %}
14-
</div>
15-
</div>
10+
{% include docs_nav.html %}
1611
</div>
1712

18-
<div class="col-lg-8">
13+
<div class="col-md-8">
1914
<h1>{{ page.title }}</h1>
2015
<div>{{ content }}</div>
2116
<hr>
2217
{% include section_nav.html %}
2318
</div>
2419

25-
2620
</div>
2721
</div>

_sass/_typeahead.scss

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
//http://stackoverflow.com/questions/21749179/typeahead-js-v0-10-1-and-bootstrap-3/33177315#33177315
2+
@mixin typeahead-active() {
3+
// mimics @extend .dropdown-menu > .active > a;
4+
color: $dropdown-link-active-color;
5+
text-decoration: none;
6+
outline: 0;
7+
background-color: $dropdown-link-active-bg;
8+
}
9+
10+
//https://github.com/corejavascript/typeahead.js/blob/master/doc/jquery_typeahead.md#class-names
11+
span.twitter-typeahead {
12+
// this is the suggested matches dropdown
13+
.tt-menu {
14+
@extend .dropdown-menu;
15+
}
16+
17+
.tt-hint {
18+
color: #999;
19+
}
20+
// Added to suggestion elements.
21+
.tt-suggestion {
22+
// mimic .dropdown-menu > li > a
23+
padding: 3px 20px;
24+
line-height: $line-height-base;
25+
// Added to suggestion element when menu cursor moves to said suggestion.
26+
&.tt-cursor {
27+
@include typeahead-active;
28+
}
29+
// Hover/focus on suggestion
30+
&:focus,
31+
&:hover {
32+
@include typeahead-active;
33+
}
34+
35+
p {
36+
margin: 0;
37+
}
38+
}
39+
40+
.input-group & {
41+
display: block !important;
42+
43+
.tt-dropdown-menu {
44+
top: 32px !important;
45+
}
46+
}
47+
48+
.input-group.input-group-lg & {
49+
.tt-dropdown-menu {
50+
top: 44px !important;
51+
}
52+
}
53+
54+
.input-group.input-group-sm & {
55+
.tt-dropdown-menu {
56+
top: 28px !important;
57+
}
58+
}
59+
}

css/main.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"variables",
99
"bootstrap",
1010
"bootswatch",
11-
"syntax-highlighting"
11+
"syntax-highlighting",
12+
"typeahead"
1213
;
1314

1415
html {

0 commit comments

Comments
 (0)