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

use project version (not theme version) in banner #1446

Merged
merged 2 commits into from Sep 18, 2023
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
Expand Up @@ -429,7 +429,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 @@ -473,6 +473,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
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
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