Skip to content

Update docs-nav.html and scripts.html for rdi versions #1188

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions layouts/integration/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,6 @@ <h1>{{ .Title }}</h1>
</section>
</div>
{{ partial "docs-toc.html" . }}
{{ partial "scripts.html" . }}
</main>
{{ end }}
1 change: 1 addition & 0 deletions layouts/integration/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,6 @@ <h1>{{ .Title }}</h1>
</section>
</div>
{{ partial "docs-toc.html" . }}
{{ partial "scripts.html" . }}
</main>
{{ end }}
11 changes: 11 additions & 0 deletions layouts/partials/docs-nav.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,17 @@
<a href="https://redis.io/docs/latest/operate/rs/7.4/" id="rs-version-select-7.4" onclick="_setSelectedVersion('rs', 'v7.4')">v7.4</a>
</div>
</div>
{{else if (eq (.Params.linkTitle) "Redis Data Integration")}}
<div id="versionSelectorRedis-Data-Integration" class="menu__version-selector version-selector-control" onclick="_openVersionSelector('Redis-Data-Integration')" style="display: none;">
<button class="menu__version-selector-btn version-selector-control">
<span id="versionSelectorRedis-Data-IntegrationValue" class="version-selector-control">latest</span>
<span class="menu__version-selector__toggler opener version-selector-control">&#x25BC;</span>
<span class="menu__version-selector__toggler closer version-selector-control">&#x25B2;</span>
</button>
<div id="versionDropdownRedis-Data-Integration" class="menu__version-selector__list version-selector-control">
<a href="https://redis.io/docs/latest/integrate/redis-data-integration/" id="redis-data-integration-version-select-latest" onclick="_setSelectedVersion('redis-data-integration', 'latest')">latest</a>
</div>
</div>
</li>

{{end}}
Expand Down
7 changes: 6 additions & 1 deletion layouts/partials/scripts.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
var currentUrl = window.location.href
const regex_kubernetes = new RegExp('/docs/(latest|staging\/.+)/operate/kubernetes/.*')
const regex_rs = new RegExp('/docs/(latest|staging\/.+)/operate/rs/.*')
const regex_rdi = new RegExp('/docs/(latest|staging\/.+)/integrate/redis-data-integration/.*')

if (regex_kubernetes.test(currentUrl)){
// unhide kubernetes version selector
Expand All @@ -14,6 +15,10 @@
// unhide rs version selector
document.getElementById( 'versionSelectorRs' ).style.display = '';
}
else if (regex_rdi.test(currentUrl)) {
// unhide rdi version selector
document.getElementById( 'versionSelectorRedis-Data-Integration' ).style.display = '';
}
}

function _setSelectedVersion(product, ver) {
Expand Down Expand Up @@ -48,7 +53,7 @@
var versionsDropdown = document.getElementById("versionDropdown" + product).children
var versionsDropdownLength = versionsDropdown.length

const regex = new RegExp(String.raw`^.+\/operate\/${productLowercase}`,"g");
const regex = new RegExp(String.raw`^.+\/(?:operate|integrate)\/${productLowercase}`,"g");
const versionRegex = /^(\/\d+\.\d+(?:\.\d+)?(?:\-\d+)?)?/g;

// for each version in dropdown, edit its href link
Expand Down