Skip to content

Commit a1408ca

Browse files
committed
TEST: move table of contents into the header
1 parent 9c8095f commit a1408ca

File tree

4 files changed

+49
-13
lines changed

4 files changed

+49
-13
lines changed

assets/sass/reference.scss

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,19 @@ h3.plumbing {
111111
&#reference-languages-trigger {
112112
float: right;
113113
}
114+
115+
// Ensure the TOC trigger floats right like topics/languages
116+
&#reference-toc-trigger {
117+
float: right;
118+
}
119+
}
120+
121+
// Place the "last updated" span inline next to the left-floating versions trigger
122+
> span.light {
123+
display: inline-block;
124+
clear: none;
125+
margin-left: 6px;
126+
vertical-align: middle;
114127
}
115128
}
116129

@@ -213,6 +226,28 @@ h3.plumbing {
213226
}
214227
}
215228

229+
// Position the Table of Contents dropdown under the right-floated TOC trigger
230+
#toc-dropdown {
231+
width: 300px;
232+
right: 12px;
233+
padding: 12px;
234+
font-weight: normal;
235+
line-height: 1;
236+
237+
ul {
238+
margin: 0;
239+
}
240+
241+
li {
242+
line-height: $base-line-height * 0.8;
243+
}
244+
245+
a {
246+
font-weight: normal;
247+
padding: 0;
248+
}
249+
}
250+
216251
ol.reference-previous-versions {
217252
@extend .unstyled !optional;
218253
margin-top: 3px;

layouts/_default/baseof.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ <h1>{{ .Params.book.section.cs_number }} {{ .Params.book.chapter.title }} - {{ .
123123
<div id='reference-version'>
124124
{{ partial "ref/languages.html" . }}
125125
{{ partial "ref/topics.html" . }}
126+
{{ partial "ref/toc.html" . }}
126127
{{ partial "ref/versions.html" . }}
127128
</div>
128129

layouts/partials/ref/toc.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{{ $headings := .Params.headings }}
2+
{{ if $headings }}
3+
<a class="dropdown-trigger" id="reference-toc-trigger" data-panel-id="toc-dropdown" href="#">Table of Contents ▾</a>
4+
<div class='dropdown-panel right' id='toc-dropdown'>
5+
<div>
6+
<ul class="toc">
7+
{{ range $i, $item := $headings }}
8+
<li><a href="#{{ .id }}">{{ .text }}</a></li>
9+
{{ end }}
10+
</ul>
11+
</div>
12+
</div>
13+
{{ end }}

layouts/partials/sidebar.html

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,19 +50,6 @@
5050
</li>
5151
</ul>
5252

53-
{{ $headings := .Params.headings }}
54-
{{ if $headings }}
55-
<ul>
56-
<li> Table of Contents
57-
<ul class="expanded">
58-
{{ range $i, $item := $headings }}
59-
<li><a href="#{{ .id }}">{{ .text }}</a> </li>
60-
{{ end }}
61-
</ul>
62-
</li>
63-
</ul>
64-
{{ end }}
65-
6653
{{ if (eq .Params.Sidebar "book") }}
6754
<hr class="sidebar">
6855
{{- /* If this page displays a section of the ProGit book, map all the translations thereof */ -}}

0 commit comments

Comments
 (0)