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

PD-1474 / 3.0 / PD-1474-make-version-switcher-consistent-across-branches (by DjP-iX) #3082

Merged
merged 1 commit into from
Sep 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Update docs-nav.html
(cherry picked from commit 43a61a2)
  • Loading branch information
DjP-iX authored and bugclerk committed Sep 25, 2024
commit e9b08fe800920888aa534975f292a0bb1228c1c7
27 changes: 23 additions & 4 deletions layouts/partials/docs-nav.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<div class="truenas-navmenudropdown" id="productDropdown">
<div class="truenas-dropdown-item" onclick="selectProduct('TrueNAS CORE')" data-id="core">TrueNAS CORE</div>
<div class="truenas-dropdown-item" onclick="selectProduct('TrueNAS SCALE')" data-id="scale">TrueNAS SCALE</div>
<div class="truenas-dropdown-item" onclick="selectProduct('TrueNAS Apps')" data-id="apps">TrueNAS Apps</div>
<div class="truenas-dropdown-item" onclick="selectProduct('TrueCommand')" data-id="truecommand">TrueCommand</div>
<div class="truenas-dropdown-item" onclick="selectProduct('TrueNAS Systems')" data-id="hardware">TrueNAS Systems</div>
</div>
Expand Down Expand Up @@ -141,14 +142,16 @@
versionUpdated = true;
} else if (path.includes('/scale/')) {
productButton.innerHTML = 'TrueNAS SCALE <i class="fa fa-angle-down"></i>';
if (path.includes('/24.04/')) {
if (path.includes('/24.10/')) {
versionButton.textContent = '24.10';
} else if (path.includes('/24.04/')) {
versionButton.textContent = '24.04';
} else if (path.includes('/23.10/')) {
versionButton.textContent = '23.10';
} else if (path.includes('/22.12/')) {
versionButton.textContent = 'Archive';
} else {
versionButton.textContent = '24.10';
versionButton.textContent = '25.04';
}
versionUpdated = true;
} else if (path.includes('/truecommand/')) {
Expand All @@ -167,6 +170,12 @@
versionButton.textContent = '---';
versionUpdated = true;
}
} else if (path.includes('/truenasapps/')) {
productButton.innerHTML = 'TrueNAS Apps <i class="fa fa-angle-down"></i>';
if (!versionUpdated) {
versionButton.textContent = '---';
versionUpdated = true;
}
} else {
productButton.innerHTML = 'Product <i class="fa fa-angle-down"></i>';
}
Expand Down Expand Up @@ -197,6 +206,9 @@
if (product === 'TrueNAS Systems') {
window.location.href = 'https://www.truenas.com/docs/hardware';
return;
} else if (product === 'TrueNAS Apps') {
window.location.href = 'https://www.truenas.com/docs/truenasapps';
return;
}

versionButton.disabled = false;
Expand All @@ -212,7 +224,8 @@
`;
} else if (product === 'TrueNAS SCALE') {
versionDropdown.innerHTML = `
<div class="truenas-dropdown-item" onclick="selectVersion('scale-nightly')" id="scale-nightly">24.10</div>
<div class="truenas-dropdown-item" onclick="selectVersion('scale-nightly')" id="scale-nightly">25.04</div>
<div class="truenas-dropdown-item" onclick="selectVersion('24.10')" id="2410">24.10</div>
<div class="truenas-dropdown-item" onclick="selectVersion('24.04')" id="2404">24.04</div>
<div class="truenas-dropdown-item" onclick="selectVersion('23.10')" id="2310">23.10</div>
<div class="truenas-dropdown-item" onclick="selectVersion('Archive')" id="Archive">Archive</div>
Expand Down Expand Up @@ -369,6 +382,8 @@
relative_url = 'scale/23.10/';
} else if (version === '24.04') {
relative_url = 'scale/24.04/';
} else if (version === '24.10') {
relative_url = 'scale/24.10/';
} else if (version === 'scale-nightly') {
relative_url = 'scale/';
} else if (version === 'tc-nightly') {
Expand Down Expand Up @@ -396,6 +411,8 @@
var versionsElement = document.getElementById('versions');
if (product) {
versionDropdown.style.display = product.toLowerCase() === 'truenas systems' ? 'none' : 'block';
} else if (product) {
versionDropdown.style.display = product.toLowerCase() === 'truenas apps' ? 'none' : 'block';
} else {
versionDropdown.style.display = 'none';
}
Expand Down Expand Up @@ -424,6 +441,8 @@

if (product) {
versionDropdown.style.display = product.toLowerCase() === 'truenas systems' ? 'none' : 'block';
} else if (product) {
versionDropdown.style.display = product.toLowerCase() === 'truenas apps' ? 'none' : 'block';
} else {
versionDropdown.style.display = 'none';
}
Expand All @@ -444,7 +463,7 @@
versionDropdown.style.display = 'none';
} else if (productButton.textContent === 'TrueNAS SCALE ') {
selectProduct('TrueNAS SCALE');
versionButton.innerHTML = currentPath.includes('/24.04/') ? '24.04 <i class="fa fa-angle-down"></i>' : currentPath.includes('/23.10/') ? '23.10 <i class="fa fa-angle-down"></i>' : currentPath.includes('/22.12/') ? '22.12 <i class="fa fa-angle-down"></i>' : '24.10 <i class="fa fa-angle-down"></i>';
versionButton.innerHTML = currentPath.includes('/24.10/') ? '24.10 <i class="fa fa-angle-down"></i>' : currentPath.includes('/24.04/') ? '24.04 <i class="fa fa-angle-down"></i>' : currentPath.includes('/23.10/') ? '23.10 <i class="fa fa-angle-down"></i>' : currentPath.includes('/22.12/') ? '22.12 <i class="fa fa-angle-down"></i>' : '25.04 <i class="fa fa-angle-down"></i>';
versionDropdown.style.display = 'none';
} else if (productButton.textContent === 'TrueCommand ') {
selectProduct('TrueCommand');
Expand Down
Loading