Skip to content

Commit 5b24e32

Browse files
committed
Revert "Add description to version selector in docs"
This reverts commit c642705.
1 parent 11a43a7 commit 5b24e32

File tree

2 files changed

+34
-46
lines changed

2 files changed

+34
-46
lines changed

static/css/documentation.css

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,3 @@
1-
.documentation-header {
2-
position: relative;
3-
}
4-
5-
.version-selector {
6-
position: absolute;
7-
right: 20px;
8-
top: 0;
9-
}
10-
111
.docs-list {
122
display: flex;
133
flex-wrap: wrap;
@@ -51,8 +41,12 @@
5141
}
5242
}
5343

54-
.version-selector__select {
44+
.version-selector {
5545
font-size: 16px;
5646
border: solid 1px #333;
5747
background-color: #fff;
48+
width: 160px;
49+
text-align: center;
50+
text-align-last: center;
51+
visibility: hidden;
5852
}

themes/hugo-sustain/layouts/documentation/list.html

Lines changed: 29 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -5,38 +5,30 @@
55
<!-- Header -->
66
{{ partial "header" . }}
77
<div class="container">
8-
<div class="documentation-header">
9-
<div class="version-selector">
10-
<select id="version-selector__select" class="version-selector__select" title="Choose a version">
11-
<option value="">check different version</option>
12-
{{ $latestDocs := .Site.Params.latestDocs }}
13-
{{ range (readDir "./content/documentation") }}
14-
{{ if ne .Name "_index.md"}}
15-
16-
{{ if eq .Name $latestDocs }}
17-
<option value={{ .Name }}>{{ .Name }} - latest</option>
18-
{{ else }}
19-
<option value={{ .Name }}>{{ .Name }}</option>
20-
{{ end }}
21-
22-
{{ end }}
23-
{{ end }}
24-
</select>
25-
</div>
26-
<h3>Documentation</h3>
27-
<h4 class="selected-version">
28-
version: <strong>{{ replace (replace .File.Dir "documentation" "") "/" "" }}</strong>
29-
</h4>
30-
</div>
8+
<h3>Documentation</h3>
9+
<select class="version-selector">
10+
{{ $latestDocs := .Site.Params.latestDocs }}
11+
{{ range (readDir "./content/documentation") }}
12+
{{ if ne .Name "_index.md"}}
13+
14+
{{ if eq .Name $latestDocs }}
15+
<option value={{ .Name }}>{{ .Name }} - latest</option>
16+
{{ else }}
17+
<option value={{ .Name }}>{{ .Name }}</option>
18+
{{ end }}
19+
20+
{{ end }}
21+
{{ end }}
22+
</select>
3123
<div class="panel panel-default">
3224
<div class="docs-list">
3325
{{ range .Data.Pages }}
3426

3527
<a href="{{ .RelPermalink }}" class="doc-item">
36-
<div>
37-
<h5 class="doc-title">{{ .Title | markdownify }}</h5>
38-
<div class="doc-description">{{ .Description }}</div>
39-
</div>
28+
<div>
29+
<h5 class="doc-title">{{ .Title | markdownify }}</h5>
30+
<div class="doc-description">{{ .Description }}</div>
31+
</div>
4032
</a>
4133
{{ end }}
4234
</div>
@@ -45,16 +37,18 @@ <h5 class="doc-title">{{ .Title | markdownify }}</h5>
4537
</div>
4638
<!-- Footer -->
4739
{{ partial "footer" . }}
48-
<script>
49-
window.addEventListener('load', function () {
50-
var versionSelector = document.querySelector('.version-selector__select');
40+
<script >
41+
window.addEventListener('load', function() {
42+
var versionSelector = document.querySelector('.version-selector');
43+
var versionFromUrl = window.location.href.split('/').filter(part => !!part).reverse()[0];
44+
45+
versionSelector.value = versionFromUrl;
46+
versionSelector.style.visibility = 'visible';
5147

52-
versionSelector.addEventListener('change', function (e) {
48+
versionSelector.addEventListener('change', function(e) {
5349
var selectedVersion = e.target.value;
54-
55-
if(selectedVersion) {
56-
window.location.assign('/documentation/' + selectedVersion);
57-
}
50+
51+
window.location.assign('/documentation/' + selectedVersion);
5852
});
5953
});
6054
</script>

0 commit comments

Comments
 (0)