From fee72102c98dda4e4e8031e769710baf942d0578 Mon Sep 17 00:00:00 2001 From: Gaurav Nelson <23069445+gaurav-nelson@users.noreply.github.com> Date: Tue, 5 Aug 2025 21:54:02 +1000 Subject: [PATCH 1/2] Revert "Testing Edit this page along with select and report feature" This reverts commit c795052302064d118cfdf96c87664b6c7ebcb0e7. --- .hintrc | 20 --- layouts/_default/baseof.html | 3 +- .../partials/select-report-issue-hover.html | 54 -------- .../partials/select-report-issue-popup.html | 54 -------- layouts/partials/toc.html | 16 +-- static/js/select-report-issue-hover.js | 125 ------------------ static/js/select-report-issue-popup.js | 112 ---------------- 7 files changed, 4 insertions(+), 380 deletions(-) delete mode 100644 .hintrc delete mode 100644 layouts/partials/select-report-issue-hover.html delete mode 100644 layouts/partials/select-report-issue-popup.html delete mode 100644 static/js/select-report-issue-hover.js delete mode 100644 static/js/select-report-issue-popup.js diff --git a/.hintrc b/.hintrc deleted file mode 100644 index e30e55803..000000000 --- a/.hintrc +++ /dev/null @@ -1,20 +0,0 @@ -{ - "extends": [ - "development" - ], - "hints": { - "meta-viewport": "off", - "axe/text-alternatives": [ - "default", - { - "document-title": "off" - } - ], - "axe/language": [ - "default", - { - "html-has-lang": "off" - } - ] - } -} \ No newline at end of file diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 4264f4184..6e828cd91 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -1,7 +1,7 @@ {{- partial "head.html" . -}} - +
{{- partial "header.html" . -}} {{- block "main" . }} @@ -9,7 +9,6 @@ {{- end }}
- + {{ partial "page-navigation.html" . }} + + +
+
+ + {{ if .File }} + + + Edit this page + + + + + Open a documentation issue + + {{ end }} +
+
{{ partial "toc.html" . }} diff --git a/layouts/partials/page-navigation.html b/layouts/partials/page-navigation.html new file mode 100644 index 000000000..b52805d28 --- /dev/null +++ b/layouts/partials/page-navigation.html @@ -0,0 +1,157 @@ +{{/* Page Navigation Partial */}} +{{ $currentPage := . }} +{{ $nextPage := false }} +{{ $prevPage := false }} + +{{ if eq .Section "learn" }} + {{/* For learn section, use the menu system to get the correct order */}} + {{ $allMenuItems := slice }} + {{ range .Site.Menus.learn }} + {{ if .HasChildren }} + {{/* Add parent */}} + {{ $allMenuItems = $allMenuItems | append . }} + {{/* Add children */}} + {{ range .Children }} + {{ $allMenuItems = $allMenuItems | append . }} + {{ end }} + {{ else }} + {{/* Add standalone item */}} + {{ $allMenuItems = $allMenuItems | append . }} + {{ end }} + {{ end }} + + {{/* Find current page index in menu items */}} + {{ $currentIndex := 0 }} + {{ range $index, $item := $allMenuItems }} + {{ if eq $item.URL $currentPage.RelPermalink }} + {{ $currentIndex = $index }} + {{ end }} + {{ end }} + + {{/* Get previous and next pages */}} + {{ if gt $currentIndex 0 }} + {{ $prevItem := index $allMenuItems (sub $currentIndex 1) }} + {{ $prevPage = .Site.GetPage $prevItem.URL }} + {{ end }} + {{ if lt $currentIndex (sub (len $allMenuItems) 1) }} + {{ $nextItem := index $allMenuItems (add $currentIndex 1) }} + {{ $nextPage = .Site.GetPage $nextItem.URL }} + {{ end }} + +{{ else }} + {{/* For other sections like patterns, use the page structure */}} + {{ $currentSection := .Section }} + {{ $pages := slice }} + + {{/* For patterns section, we need to get pages from the current pattern's subsection */}} + {{ if eq .Section "patterns" }} + {{/* Check if this is a pattern index page (e.g., /patterns/industrial-edge/_index.md) */}} + {{ if eq .Kind "section" }} + {{/* This is a pattern index page, get all its regular pages and include the index page itself */}} + {{ $pages = .RegularPages }} + {{/* Add the current index page to the list for proper navigation order */}} + {{ $pages = $pages | append . }} + {{ else }} + {{/* This is a regular page within a pattern, get pages from the parent section */}} + {{ $parentPage := .Parent }} + {{ if $parentPage }} + {{/* Get all regular pages in this pattern's directory and include the parent index page */}} + {{ $pages = $parentPage.RegularPages }} + {{ $pages = $pages | append $parentPage }} + {{ end }} + {{ end }} + {{ else }} + {{/* For other sections, use the traditional approach */}} + {{ $section := .Site.GetPage "section" .Section }} + {{ $pages = where $section.RegularPages "Section" .Section }} + {{ end }} + + {{/* Sort pages by weight, then by title */}} + {{ $sortedPages := sort $pages ".Params.weight" "asc" }} + {{ if not $sortedPages }} + {{ $sortedPages = sort $pages ".Title" "asc" }} + {{ end }} + + {{ $currentIndex := 0 }} + {{/* Find current page index in the sorted section */}} + {{ range $index, $page := $sortedPages }} + {{ if eq $page.RelPermalink $.RelPermalink }} + {{ $currentIndex = $index }} + {{ end }} + {{ end }} + + {{/* Get previous and next pages */}} + {{ if gt $currentIndex 0 }} + {{ $prevPage = index $sortedPages (sub $currentIndex 1) }} + {{ end }} + {{ if lt $currentIndex (sub (len $sortedPages) 1) }} + {{ $nextPage = index $sortedPages (add $currentIndex 1) }} + {{ end }} +{{ end }} + +{{/* Render navigation only if there are previous or next pages */}} +{{ if or $prevPage $nextPage }} +
+ +
+{{ end }} diff --git a/layouts/partials/patterns-index.html b/layouts/partials/patterns-index.html index 8aa3c6baa..ee1abb4b3 100644 --- a/layouts/partials/patterns-index.html +++ b/layouts/partials/patterns-index.html @@ -77,6 +77,33 @@

{{ .Title }}

{{ .Content }} + + + {{ partial "page-navigation.html" . }} + + +
+
+ + {{ if .File }} + + + Edit this page + + + + + Open a documentation issue + + {{ end }} +
+
{{ partial "toc.html" . }} diff --git a/layouts/partials/toc.html b/layouts/partials/toc.html index 7282b2036..2558d477e 100644 --- a/layouts/partials/toc.html +++ b/layouts/partials/toc.html @@ -1,16 +1,8 @@ diff --git a/layouts/patterns/single.html b/layouts/patterns/single.html index 2781c5bee..1b637936e 100644 --- a/layouts/patterns/single.html +++ b/layouts/patterns/single.html @@ -10,6 +10,33 @@
{{ .Content }} + + + {{ partial "page-navigation.html" . }} + + +
+
+ + {{ if .File }} + + + Edit this page + + + + + Open a documentation issue + + {{ end }} +
+
{{ partial "toc.html" . }}
diff --git a/static/css/custom.css b/static/css/custom.css index 05d44d711..4eca65c8f 100644 --- a/static/css/custom.css +++ b/static/css/custom.css @@ -50,6 +50,19 @@ h3 { margin-bottom: 1rem; } +/* Page Navigation Styles */ +.page-nav-card { + border: 1px solid #d2d2d2; + border-radius: 3px; + height: auto; + min-height: 80px; + cursor: pointer; +} + +.page-nav-chevron { + color: #6a6e73; +} + /*CODE BLOCKS */ code {