From f2da14fb4849ea2308b091dd43674f46b80d79ef Mon Sep 17 00:00:00 2001 From: Wayne Werner Date: Fri, 22 Jul 2022 16:14:10 -0500 Subject: [PATCH 1/8] ultra-basic PoC This "works" with sphinx-multiversion. It's very ugly, but the versions *will* show up in the sidebar if we're not being built on RTD. From Salt's perspective we probably want to just keep with the recent approach of master/main/latest, and then adding the previous two versions. Or maybe even just limiting build to the supported versions? --- .gitignore | 3 +++ src/furo/assets/styles/extensions/_readthedocs.sass | 6 ++++++ src/furo/theme/furo/sidebar/variant-selector.html | 13 +++++++++++++ 3 files changed, 22 insertions(+) diff --git a/.gitignore b/.gitignore index dd270e1a9..beb53418a 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,6 @@ node_modules /build /dist __pycache__ +env/ + +*.sw[a-p] diff --git a/src/furo/assets/styles/extensions/_readthedocs.sass b/src/furo/assets/styles/extensions/_readthedocs.sass index 66c157405..c03e59bc0 100644 --- a/src/furo/assets/styles/extensions/_readthedocs.sass +++ b/src/furo/assets/styles/extensions/_readthedocs.sass @@ -1,6 +1,12 @@ // This file contains the styles used for tweaking how ReadTheDoc's embedded // contents would show up inside the theme. +#furo-versions + .latest-version + font-weight: bold + font-size: 1.5em + text-decoration: underline + #furo-sidebar-ad-placement padding: var(--sidebar-item-spacing-vertical) var(--sidebar-item-spacing-horizontal) .ethical-sidebar diff --git a/src/furo/theme/furo/sidebar/variant-selector.html b/src/furo/theme/furo/sidebar/variant-selector.html index aefb22ec0..f35924eab 100644 --- a/src/furo/theme/furo/sidebar/variant-selector.html +++ b/src/furo/theme/furo/sidebar/variant-selector.html @@ -30,4 +30,17 @@ +{% elif versions %} +
+

Versions

+ +
{% endif %} +{# +latest: {{ latest_version }} +current: {{ current_version }} +#} From 21ef2facbb0704fac9ac826cdcb58146893859c2 Mon Sep 17 00:00:00 2001 From: Wayne Werner Date: Fri, 22 Jul 2022 16:53:17 -0500 Subject: [PATCH 2/8] slightly better(?) styling --- src/furo/assets/styles/extensions/_readthedocs.sass | 6 ++++-- src/furo/theme/furo/sidebar/variant-selector.html | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/furo/assets/styles/extensions/_readthedocs.sass b/src/furo/assets/styles/extensions/_readthedocs.sass index c03e59bc0..8756b3616 100644 --- a/src/furo/assets/styles/extensions/_readthedocs.sass +++ b/src/furo/assets/styles/extensions/_readthedocs.sass @@ -1,11 +1,13 @@ // This file contains the styles used for tweaking how ReadTheDoc's embedded // contents would show up inside the theme. -#furo-versions +#furo-versions .latest-version font-weight: bold + + .current-version + font-weight: bold font-size: 1.5em - text-decoration: underline #furo-sidebar-ad-placement padding: var(--sidebar-item-spacing-vertical) var(--sidebar-item-spacing-horizontal) diff --git a/src/furo/theme/furo/sidebar/variant-selector.html b/src/furo/theme/furo/sidebar/variant-selector.html index f35924eab..0cc402f59 100644 --- a/src/furo/theme/furo/sidebar/variant-selector.html +++ b/src/furo/theme/furo/sidebar/variant-selector.html @@ -35,7 +35,7 @@

Versions

From 16d5d0683a58a328e4c8dc549fa31f1c79e4ab29 Mon Sep 17 00:00:00 2001 From: Wayne Werner Date: Fri, 22 Jul 2022 16:57:34 -0500 Subject: [PATCH 3/8] better current vs latest styles --- src/furo/theme/furo/sidebar/variant-selector.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/furo/theme/furo/sidebar/variant-selector.html b/src/furo/theme/furo/sidebar/variant-selector.html index 0cc402f59..d93accfd5 100644 --- a/src/furo/theme/furo/sidebar/variant-selector.html +++ b/src/furo/theme/furo/sidebar/variant-selector.html @@ -35,7 +35,7 @@

Versions

From 34a2fca55d237c0db3aa4cac1b57c38f0d3fb99e Mon Sep 17 00:00:00 2001 From: Wayne Werner Date: Thu, 4 Aug 2022 16:30:30 -0500 Subject: [PATCH 4/8] add a latest bit --- src/furo/assets/styles/extensions/_readthedocs.sass | 3 +++ src/furo/theme/furo/sidebar/variant-selector.html | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/furo/assets/styles/extensions/_readthedocs.sass b/src/furo/assets/styles/extensions/_readthedocs.sass index 8756b3616..47b0d0355 100644 --- a/src/furo/assets/styles/extensions/_readthedocs.sass +++ b/src/furo/assets/styles/extensions/_readthedocs.sass @@ -2,12 +2,15 @@ // contents would show up inside the theme. #furo-versions + font-size: var(--sidebar-item-font-size) + .latest-version font-weight: bold .current-version font-weight: bold font-size: 1.5em + list-style-type: "\11" #furo-sidebar-ad-placement padding: var(--sidebar-item-spacing-vertical) var(--sidebar-item-spacing-horizontal) diff --git a/src/furo/theme/furo/sidebar/variant-selector.html b/src/furo/theme/furo/sidebar/variant-selector.html index d93accfd5..306f3f2a1 100644 --- a/src/furo/theme/furo/sidebar/variant-selector.html +++ b/src/furo/theme/furo/sidebar/variant-selector.html @@ -34,8 +34,9 @@

Versions

From abb1a29a8124bf366ff0593707b8faa3d6e94d7b Mon Sep 17 00:00:00 2001 From: Wayne Werner Date: Thu, 4 Aug 2022 16:34:18 -0500 Subject: [PATCH 5/8] use a different arrow --- src/furo/assets/styles/extensions/_readthedocs.sass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/furo/assets/styles/extensions/_readthedocs.sass b/src/furo/assets/styles/extensions/_readthedocs.sass index 47b0d0355..042ff89b6 100644 --- a/src/furo/assets/styles/extensions/_readthedocs.sass +++ b/src/furo/assets/styles/extensions/_readthedocs.sass @@ -10,7 +10,7 @@ .current-version font-weight: bold font-size: 1.5em - list-style-type: "\11" + list-style-type: "⇛" #furo-sidebar-ad-placement padding: var(--sidebar-item-spacing-vertical) var(--sidebar-item-spacing-horizontal) From 6a1109fa51577d204a2ab424aeacca01854fb199 Mon Sep 17 00:00:00 2001 From: Wayne Werner Date: Fri, 5 Aug 2022 15:43:32 -0500 Subject: [PATCH 6/8] latest and style matching Tried to match the styles in the main navbar, and just bolding+list style changing the selected version. It seems to be pretty decent? --- src/furo/assets/styles/extensions/_readthedocs.sass | 10 ++++++++-- src/furo/theme/furo/sidebar/variant-selector.html | 6 +++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/furo/assets/styles/extensions/_readthedocs.sass b/src/furo/assets/styles/extensions/_readthedocs.sass index 042ff89b6..0899227f1 100644 --- a/src/furo/assets/styles/extensions/_readthedocs.sass +++ b/src/furo/assets/styles/extensions/_readthedocs.sass @@ -9,8 +9,14 @@ .current-version font-weight: bold - font-size: 1.5em - list-style-type: "⇛" + //font-size: 1.5em + list-style-type: "⇛ " + + .caption + color: var(--color-sidebar-caption-text) + font-weight: bold + text-transform: uppercase + font-size: var(--sidebar-caption-font-size) #furo-sidebar-ad-placement padding: var(--sidebar-item-spacing-vertical) var(--sidebar-item-spacing-horizontal) diff --git a/src/furo/theme/furo/sidebar/variant-selector.html b/src/furo/theme/furo/sidebar/variant-selector.html index 306f3f2a1..23f5a3685 100644 --- a/src/furo/theme/furo/sidebar/variant-selector.html +++ b/src/furo/theme/furo/sidebar/variant-selector.html @@ -32,11 +32,11 @@ {% elif versions %}
-

Versions

+

Versions

From 7e2356264d28889f259fcec7c4cd6d58000a88dc Mon Sep 17 00:00:00 2001 From: Nate Watts Date: Mon, 31 Oct 2022 11:28:29 -0500 Subject: [PATCH 7/8] Updated styling --- src/furo/assets/scripts/furo.js | 24 ++++++++++++++++- .../styles/extensions/_readthedocs.sass | 27 +++++++++++++++++-- .../theme/furo/sidebar/variant-selector.html | 13 +++++++-- 3 files changed, 59 insertions(+), 5 deletions(-) diff --git a/src/furo/assets/scripts/furo.js b/src/furo/assets/scripts/furo.js index 3e99d8ac6..f080c1503 100644 --- a/src/furo/assets/scripts/furo.js +++ b/src/furo/assets/scripts/furo.js @@ -160,16 +160,38 @@ function setup() { setupScrollSpy(); } +//////////////////////////////////////////////////////////////////////////////// +// Version dropdown +//////////////////////////////////////////////////////////////////////////////// +function versionDropdown() { + const checkbox = document.getElementById("versions-label"); + checkbox.addEventListener("click", toggleDropdown); + + function toggleDropdown() { + if (localStorage.getItem("version-dropdown-opened") === "true") { + localStorage.setItem("version-dropdown-opened", "false"); + } else { + localStorage.setItem("version-dropdown-opened", "true"); + } + } +} + //////////////////////////////////////////////////////////////////////////////// // Main entrypoint //////////////////////////////////////////////////////////////////////////////// function main() { document.body.parentNode.classList.remove("no-js"); - header = document.querySelector("header"); tocScroll = document.querySelector(".toc-scroll"); setup(); + + // Version dropdown functionality + const checkboxInput = document.getElementById("checkbox_toggle"); + if (localStorage.getItem("version-dropdown-opened") === "true") { + checkboxInput.checked = true; + } + versionDropdown(); } document.addEventListener("DOMContentLoaded", main); diff --git a/src/furo/assets/styles/extensions/_readthedocs.sass b/src/furo/assets/styles/extensions/_readthedocs.sass index 0899227f1..213a7189a 100644 --- a/src/furo/assets/styles/extensions/_readthedocs.sass +++ b/src/furo/assets/styles/extensions/_readthedocs.sass @@ -3,20 +3,43 @@ #furo-versions font-size: var(--sidebar-item-font-size) + margin-bottom: 4em .latest-version font-weight: bold .current-version font-weight: bold - //font-size: 1.5em - list-style-type: "⇛ " .caption + display: inline-block color: var(--color-sidebar-caption-text) font-weight: bold text-transform: uppercase font-size: var(--sidebar-caption-font-size) + padding-right: var(--sidebar-expander-width) + margin-top: 0 + + input[type=checkbox] + display: none + position: absolute + box-sizing: border-box + padding: 0 + overflow: visible + + input[type=checkbox]:checked ~ ul + display: inline-block + line-height: var(--sidebar-item-line-height) + margin-left: var(--sidebar-item-spacing-horizontal) + padding: var(--sidebar-item-spacing-vertical) var(--sidebar-item-spacing-horizontal) + text-decoration: none + + ul + display: none + + .versions-label + position: relative + float: right #furo-sidebar-ad-placement padding: var(--sidebar-item-spacing-vertical) var(--sidebar-item-spacing-horizontal) diff --git a/src/furo/theme/furo/sidebar/variant-selector.html b/src/furo/theme/furo/sidebar/variant-selector.html index 23f5a3685..dbb4b93ec 100644 --- a/src/furo/theme/furo/sidebar/variant-selector.html +++ b/src/furo/theme/furo/sidebar/variant-selector.html @@ -31,9 +31,18 @@ {% elif versions %} -
+ {% endif %} -{# -latest: {{ latest_version }} -current: {{ current_version }} -#}