-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[docs] Fix dashboard height issue (#5799)
* [docs] Fix dashboard hight issue #5795, merged yesterday, contained a flawed assumption: that a warning banner was always displayed. This is not the case and led to the latest docs page wrapper height being incorrect. This changes the management of the messages and dashboard wrapper to be in the same place and makes a change so that the height can be correctly calculated regardless of the version. Signed-off-by: Charlie Egan <[email protected]>
- Loading branch information
1 parent
2d1583e
commit 7abe178
Showing
6 changed files
with
64 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 0 additions & 39 deletions
39
docs/website/layouts/partials/docs/banner-version-warning.html
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,53 @@ | ||
{{ partial "docs/banner-version-warning.html" . }} | ||
{{- $latest := "latest" -}} | ||
{{- if eq (len site.Data.releases) 1 -}} | ||
{{- $latest = "edge" -}} | ||
{{- end -}} | ||
|
||
<div class="dashboard"> | ||
{{ partial "docs/dashboard-panel.html" . }} | ||
{{ $releases := site.Data.releases }} | ||
|
||
<div class="dashboard-main is-scrollable"> | ||
{{ partial "docs/navbar.html" . }} | ||
{{ partial "docs/article.html" . }} | ||
{{ $version := index (split .File.Path "/") 1 }} | ||
|
||
{{ $latestVersionString := printf "%s" (index $releases 1) }} | ||
{{- if eq (len $releases) 1 -}} | ||
{{- $latestVersionString = "(dev preview)" -}} | ||
{{- end -}} | ||
|
||
{{ $rank := 1 }} | ||
{{- range $index, $ver := site.Data.releases -}} | ||
{{- if eq $ver $version -}} | ||
{{ $rank = $index }} | ||
{{- end -}} | ||
{{- end -}} | ||
{{ $ancient := gt $rank 5 }} | ||
|
||
{{ $isEdge := (eq $version "edge") }} | ||
{{ $isNotLatest := (and (ne $version $latest) (ne $version $latestVersionString)) }} | ||
|
||
<div class="dashboard-wrapper {{ if (or $isEdge $isNotLatest) }}showing-banner-version-warning{{ end }}"> | ||
{{- if $isEdge }} | ||
<div class="message is-info banner-version-warning"> | ||
<div class="message-body"> | ||
This version is still under development! Latest stable release is <a href="/docs/latest">{{ $latestVersionString }}</a> | ||
<button class="delete" aria-label="delete"></button> | ||
</div> | ||
</div> | ||
{{- else if $isNotLatest }} | ||
<div class="message {{ cond $ancient "is-danger" "is-warning"}} banner-version-warning"> | ||
<div class="message-body"> | ||
These are the docs for an older version of OPA ({{ $version }}). Latest stable release is <a href="/docs/latest">{{ $latestVersionString }}</a> | ||
{{ if not $ancient }} | ||
<button class="delete" aria-label="delete"></button> | ||
{{ end }} | ||
</div> | ||
</div> | ||
{{- end }} | ||
|
||
<div class="dashboard"> | ||
{{ partial "docs/dashboard-panel.html" . }} | ||
|
||
<div class="dashboard-main is-scrollable"> | ||
{{ partial "docs/navbar.html" . }} | ||
{{ partial "docs/article.html" . }} | ||
</div> | ||
</div> | ||
</div> |