Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
backport 2.6 - add dropdown version changer - 55655 (#58098)
- Loading branch information
Showing
4 changed files
with
61 additions
and
33 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
docs/docsite/_themes/sphinx_rtd_theme/ansible_versions.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<!--- Based on https://github.com/rtfd/sphinx_rtd_theme/pull/438/files --> | ||
{# Creates dropdown version selection in the top-left navigation. #} | ||
<div class="version"> | ||
{% if not READTHEDOCS %} | ||
<div class="version-dropdown"> | ||
<select class="version-list" id="version-list" onchange="javascript:location.href = this.value;"> | ||
<script> x = document.getElementById("version-list"); </script> | ||
{% for slug in available_versions %} | ||
<script> | ||
current_url = window.location.href; | ||
option = document.createElement("option"); | ||
option.text = "{{ slug }}"; | ||
if ( "{{ slug }}" == "{{ current_version }}" ) { | ||
option.selected = true; | ||
} | ||
if (current_url.search("{{ current_version }}") > -1) { | ||
option.value = current_url.replace("{{ current_version }}","{{ slug }}"); | ||
} else { | ||
option.value = current_url.replace("latest","{{ slug }}"); | ||
} | ||
x.add(option); | ||
</script> | ||
{% endfor %} | ||
</select> | ||
</div> | ||
{% else %} | ||
{{ nav_version }} | ||
{% endif %} | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,4 +34,3 @@ | |
</div> | ||
</div> | ||
{% endif %} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters