Improve the gear menu.

Simplify the menu. We don't/can't list all old releases, it takes too much
room and overflows the screen on mobile. We now have a more useful set,
This commit is contained in:
mtail 2018-06-16 17:25:36 -07:00
parent 79c47dfcf0
commit 69d41816e0
2 changed files with 31 additions and 9 deletions

View File

@ -43,6 +43,18 @@ other = "Light Theme"
[dark_theme]
other = "Dark Theme"
[other_versions_of_site]
other = "Other versions of this site"
[current_release]
other = "Current Release (%s)"
[next_release]
other = "Next Release (Preliminary %s)"
[archived_releases]
other = "Older Releases"
[options_menu]
other = "Options and Settings"

View File

@ -1,8 +1,5 @@
{{ $posts := (where .Site.Pages "Section" "blog").ByPublishDate.Reverse }}
{{ $latest_post := index $posts 0 }}
{{ $version := .Site.Data.args.version }}
{{/* TODO: Need to set the specialized targets for the dropdown menu versions */}}
<header>
<nav class="navbar navbar-expand-md navbar-dark fixed-top bg-dark justify-content-between">
@ -60,12 +57,6 @@
</a>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="gearDropdown">
{{ range $rel := .Site.Data.releases }}
<a href="{{ $rel.url }}" class="dropdown-item {{ if eq $version $rel.name }}active{{ end }}">{{ $rel.name }}</a>
{{ end }}
<div class="dropdown-divider"></div>
<a lang="en" href="/" class="dropdown-item {{ if eq $home.Lang "en" }}active{{ end }}">English</a>
<a lang="zh" href="/zh" class="dropdown-item {{ if eq $home.Lang "zh" }}active{{ end }}">中文</a>
@ -83,6 +74,25 @@
<a class="dropdown-item" href="https://github.com/istio/istio.github.io/edit/master/content/{{ .Path }}">{{ i18n "edit_on_github" }}</a>
{{ end }}
{{ end }}
<div class="dropdown-divider"></div>
<h6 class="dropdown-header">{{ i18n "other_versions_of_site" }}</h6>
{{ $next := index .Site.Data.releases 0 }}
{{ $current := index .Site.Data.releases 1 }}
{{ if .Site.Data.args.archive }}
<a href="https://istio.io" class="dropdown-item">{{ printf (i18n "current_release") $current.name }}</a>
<a href="https://preliminary.istio.io" class="dropdown-item">{{ printf (i18n "next_release") $next.name }}</a>
<a href="https://archive.istio.io" class="dropdown-item">{{ i18n "archived_releases" }}</a>
{{ else if .Site.Data.args.preliminary }}
<a href="https://istio.io" class="dropdown-item">{{ printf (i18n "current_release") $current.name }}</a>
<a href="https://archive.istio.io" class="dropdown-item">{{ i18n "archived_releases" }}</a>
{{ else }}
<a href="https://preliminary.istio.io" class="dropdown-item">{{ printf (i18n "next_release") $next.name }}</a>
<a href="https://archive.istio.io" class="dropdown-item">{{ i18n "archived_releases" }}</a>
{{ end }}
</div>
</li>