Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs/website: make "outdated version" banner red if ancient #5339

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 12 additions & 3 deletions docs/website/layouts/partials/docs/article.html
@@ -1,9 +1,18 @@
{{ $releases := site.Data.releases }}
{{ $version := index (split .File.Path "/") 1 }}
{{ $latest := printf "%s" (index $releases 1) }}
{{- if eq (len site.Data.releases) 1 -}}
{{- if eq (len $releases) 1 -}}
{{- $latest = "(dev preview)" -}}
{{- end -}}
{{ $version := index (split .File.Path "/") 1 }}

{{ $rank := 1 }}
{{- range $index, $ver := $releases -}}
{{- if eq $ver $version -}}
{{ $rank = $index }}
{{- end -}}
{{- end -}}
{{ $ancient := gt $rank 5 }}

<article class="article">
{{- if (eq $version "edge") }}
<div class="message is-danger">
Expand All @@ -12,7 +21,7 @@
</div>
</div>
{{- else if (and (ne $version "latest") (ne $version $latest)) }}
<div class="message is-warning">
<div class="message {{ cond $ancient "is-danger" "is-warning"}}">
<div class="message-body">
These are the docs for an older version of OPA. Latest stable release is <a href="/docs/latest">{{ $latest }}</a>
</div>
Expand Down
22 changes: 15 additions & 7 deletions docs/website/layouts/partials/docs/dashboard-panel.html
Expand Up @@ -5,6 +5,14 @@
{{ $version := index (split .File.Path "/") 1 }}
{{ $page := trim .RelPermalink "/" }}
{{ $isLatest := or (eq $version $latest) (eq $version "latest") }}

{{ $rank := 1 }}
{{- range $index, $ver := $releases -}}
{{- if eq $ver $version -}}
{{ $rank = $index }}
{{- end -}}
{{- end -}}
{{ $ancient := gt $rank 5 }}
<div class="dashboard-panel left has-background-white-bis is-hidden-touch">
<div class="dashboard-panel-header has-text-centered">
<div class="dashboard-panel-header-logo">
Expand All @@ -27,16 +35,16 @@
</span>
{{ if $isLatest }}
<span class="tag latest-tag is-success is-small has-text-weight-bold">
latest
</span>
latest
</span>
{{ else if (eq $version "edge") }}
<span class="tag latest-tag is-danger is-small has-text-weight-bold">
pre-release
</span>
pre-release
</span>
{{ else }}
<span class="tag latest-tag is-warning is-small has-text-weight-bold">
older
</span>
<span class="tag latest-tag {{ cond $ancient "is-danger" "is-warning"}} is-small has-text-weight-bold">
older
</span>
{{ end }}
<span class="icon is-small">
<i class="fas fa-angle-down" aria-hidden="true"></i>
Expand Down
1 change: 1 addition & 0 deletions netlify.toml
Expand Up @@ -17,6 +17,7 @@ command = "make netlify-preview WASM_ENABLED=0 CGO_ENABLED=0"
# "netlify dev" will serve the static content using netlify locally
# with all the redirects and other netlify specific rules in place.
publish = "docs/website/public"
framework = "#static"

# To run the netlify dev service with hugo dev server "live" behind
# it uncomment these lines:
Expand Down