Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,19 @@
{{ $deprecated := false }}

{{ range .versions }}
{{ if index . "storage" }}
{{ if and (index . "storage") (not .deprecated) }}
{{ $version = .name }}
{{ $schema = .schema }}
{{ $deprecated = .deprecated }}
{{ else if (and (index . "served") (not $version)) }}
{{ else if and (index . "served") (not .deprecated) (not $version) }}
{{ $version = .name }}
{{ $schema = .schema }}
{{ $deprecated = .deprecated }}
{{ else if and (index . "storage") (not $version) }}
{{ $version = .name }}
{{ $schema = .schema }}
{{ $deprecated = .deprecated }}
{{ else if and (index . "served") (not $version) }}
{{ $version = .name }}
{{ $schema = .schema }}
{{ $deprecated = .deprecated }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
{{/* Collapse/Expand Button and Kind name */}}
<div class="col col-xl-4 col-10 align-middle expand-buttons bigName-col">
{{/* Plus/Minus Button */}}
<button class="expand-button collapsed align-middle" data-bs-toggle="collapse" data-bs-target="#{{$kind}}" type="button" aria-expanded="false" aria-controls="{{$kind}}"></button>
<button class="expand-button collapsed align-middle" data-bs-toggle="collapse" data-bs-target="#{{$kind}}-{{$version}}" type="button" aria-expanded="false" aria-controls="{{$kind}}-{{$version}}"></button>

{{/* CRD name text */}}
<button class="crd-root collapsed align-middle" data-bs-toggle="collapse" data-bs-target="#{{$kind}}" type="button" aria-expanded="false" aria-controls="{{$kind}}">
<span class="align-middle {{ $kind }}"><a class="expansion-link" name="{{ $kind }}">{{ $kind }}{{ if $deprecated }} (deprecated){{ end }}</a></span>
<button class="crd-root collapsed align-middle" data-bs-toggle="collapse" data-bs-target="#{{$kind}}-{{$version}}" type="button" aria-expanded="false" aria-controls="{{$kind}}-{{$version}}">
<span class="align-middle {{ $kind }}"><a class="expansion-link" name="{{ $kind }}-{{$version}}">{{ $kind }}{{ if $deprecated }} (deprecated){{ end }}</a></span>
</button>
</div>

Expand Down
64 changes: 33 additions & 31 deletions themes/geekboot/layouts/partials/crds.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,47 +22,49 @@
{{/* bigName is the kind length limit to change CSS styles when it needs to be truncated */}}
{{ $bigName := partial "apiBuilder/checkBigName" $kind }}

{{/* Iterate over each served version and create separate entries */}}
{{ range $versionItem := $crdContent.spec.versions }}
{{ if $versionItem.served }}
{{ $schema := $versionItem.schema.openAPIV3Schema }}
{{ $version := $versionItem.name }}
{{ $deprecated := $versionItem.deprecated }}
{{ $description := $schema.description }}

{{/* Find the active version. We prefer the "storage: true" value but use "served: true" as a backup */}}
{{ $versionAndSchema := partial "apiBuilder/getVersionAndSchema" $crdContent.spec }}
{{ $schema := $versionAndSchema.schema.openAPIV3Schema }}
{{ $version := $versionAndSchema.version }}
{{ $deprecated := $versionAndSchema.deprecated }}
{{ $description := $schema.description }}
{{/* The div containing the entire CRD information including the Expand All/Collapse All row */}}
<div class="crd-root-row crd-container row align-middle bigName-row" data-kind="{{ $kind }}" data-group="{{ $group }}-{{ $kind}}" data-version="{{ $version }}-{{ $kind }}">

{{/* The div containing the entire CRD information including the Expand All/Collapse All row */}}
<div class="crd-root-row crd-container row align-middle bigName-row" data-kind="{{ $kind }}" data-group="{{ $group }}-{{ $kind}}" data-version="{{ $version }}-{{ $kind }}">
{{/* generate the GKV line to expand/collapse the CRD data */}}
{{ partial "apiBuilder/printGKVExpander" (dict "group" $group "version" $version "kind" $kind "deprecated" $deprecated) }}

{{/* generate the GKV line to expand/collapse the CRD data */}}
{{ partial "apiBuilder/printGKVExpander" (dict "group" $group "version" $version "kind" $kind "deprecated" $deprecated) }}

{{/* The container to show/hide with information related to the CRD */}}
<div class="collapse crd-expand {{$kind}}" id="{{$kind}}-{{$version}}">
{{/* Generate the "Download YAML" link */}}
{{ partial "apiBuilder/downloadLink" (dict "group" $group "version" $version "kind" $kind "downloadPath" $downloadPath) }}

{{/* The container to show/hide with information related to the CRD */}}
<div class="collapse crd-expand {{$kind}}" id="{{$kind}}">
{{/* Generate the "Download YAML" link */}}
{{ partial "apiBuilder/downloadLink" (dict "group" $group "version" $version "kind" $kind "downloadPath" $downloadPath) }}
{{/* bigName-reset prevents the description from expanding into the x-scroll */}}
<div class="description bigName-reset">
{{ $description | markdownify}}
<br />
</div>

{{/* bigName-reset prevents the description from expanding into the x-scroll */}}
<div class="description bigName-reset">
{{ $description | markdownify}}
<br />
</div>

{{/* Loop over each key inside the schema */}}
{{ range $key, $contents := $schema.properties }}
{{/* Loop over each key inside the schema */}}
{{ range $key, $contents := $schema.properties }}

{{/* Skip irrelevant keys at the top level */}}
{{ if not (in (slice "apiVersion" "description" "kind" "metadata") $key) }}
{{ partial "apiBuilder/processSpec" (dict "key" $key "contents" $contents "page" . "kind" $kind) }}
{{ end }}
{{/* Skip irrelevant keys at the top level */}}
{{ if not (in (slice "apiVersion" "description" "kind" "metadata") $key) }}
{{ partial "apiBuilder/processSpec" (dict "key" $key "contents" $contents "page" . "kind" $kind) }}
{{ end }}

{{ end }}
{{ end }}

{{/* Generate the "Return to top" link */}}
{{ partialCached "apiBuilder/backToTopButton" . }}
{{/* Generate the "Return to top" link */}}
{{ partialCached "apiBuilder/backToTopButton" . }}

</div>
</div>
</div>
</div>
{{ end }}
{{ end }}
{{ end}}
</div>

Expand Down