Skip to content

Commit

Permalink
fix: use project version (not theme version) in banner (#1446)
Browse files Browse the repository at this point in the history
* use project version (not theme version) in banner

* change default text on version switcher button
  • Loading branch information
drammock authored Sep 18, 2023
1 parent eac1a87 commit 5db8dff
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ function populateVersionSwitcher(data, versionSwitcherBtns) {
* @param {Array} data The version data used to populate the switcher menu.
*/
function showVersionWarningBanner(data) {
const version = DOCUMENTATION_OPTIONS.theme_version;
var version = DOCUMENTATION_OPTIONS.VERSION;
// figure out what latest stable version is
var preferredEntries = data.filter((entry) => entry.preferred);
if (preferredEntries.length !== 1) {
Expand Down Expand Up @@ -489,6 +489,8 @@ function showVersionWarningBanner(data) {
bold.innerText = "an unstable development version";
} else if (versionsAreComparable && compare(version, preferredVersion, "<")) {
bold.innerText = `an old version (${version})`;
} else if (!version) {
bold.innerText = "an unknown version"; // e.g., an empty string
} else {
bold.innerText = `version ${version}`;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
document.write(`
<div class="version-switcher__container dropdown">
<button id="versionswitcherbutton" type="button" role="button" class="version-switcher__button btn btn-sm navbar-btn dropdown-toggle" data-bs-toggle="dropdown" aria-haspopup="listbox" aria-controls="versionswitcherlist" aria-label="Version switcher list">
{{ theme_switcher.get('version_match') }} <!-- this text may get changed later by javascript -->
Choose version <!-- this text may get changed later by javascript -->
<span class="caret"></span>
</button>
<div id="versionswitcherlist" class="version-switcher__menu dropdown-menu list-group-flush py-0" role="listbox" aria-labelledby="versionswitcherbutton">
Expand Down
2 changes: 1 addition & 1 deletion tests/test_build/navbar_switcher.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
document.write(`
<div class="version-switcher__container dropdown">
<button id="versionswitcherbutton" type="button" role="button" class="version-switcher__button btn btn-sm navbar-btn dropdown-toggle" data-bs-toggle="dropdown" aria-haspopup="listbox" aria-controls="versionswitcherlist" aria-label="Version switcher list">
0.7.1 <!-- this text may get changed later by javascript -->
Choose version <!-- this text may get changed later by javascript -->
<span class="caret"></span>
</button>
<div id="versionswitcherlist" class="version-switcher__menu dropdown-menu list-group-flush py-0" role="listbox" aria-labelledby="versionswitcherbutton">
Expand Down

0 comments on commit 5db8dff

Please sign in to comment.