Skip to content

Commit

Permalink
fix 0.9.0 not being latest anymore
Browse files Browse the repository at this point in the history
after page update, check what version we're displaying, match it with the versions.json and display the name as the version dropdown
  • Loading branch information
Grifs committed Dec 19, 2024
1 parent c604adf commit 9700877
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 16 additions & 0 deletions versions.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,22 @@ function setVersionLinks(json) {
// Alter the navbar logo link to point to the root
var navbarElements = document.getElementsByClassName("navbar-brand");
navbarElements[0].setAttribute("href", "/");

// Alter the version dropdown to show the displayed version
var url = window.location.pathname;
var urlParts = url.split("/");
var versionPath = "";
if (urlParts.length > 3 && urlParts[1] == "versioned") {
versionPath = urlParts[2];
}
for (var i = 0; i < json.versions.length; i++) {
var version = json.versions[i];
if (version.link == versionPath) {
var dropdownElement = document.getElementById("nav-menu-version");
dropdownElement.innerHTML = version.name;
break;
}
}
}

fetch('/versions.json')
Expand Down
2 changes: 1 addition & 1 deletion versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"link": ""
},
{
"name": "Viash 0.9.0 (Latest)",
"name": "Viash 0.9.0",
"link": "0_9_0"
},
{
Expand Down

0 comments on commit 9700877

Please sign in to comment.