summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSandra McCann <samccann@redhat.com>2019-06-19 16:53:14 -0400
committerAlicia Cozine <879121+acozine@users.noreply.github.com>2019-06-19 15:53:14 -0500
commit33a92419a3dabd3203f96ac5b4c35ddc7040c25e (patch)
tree461707100940213c2ee871cff432ca6962bcc950
parent2aa20a974033df8e185edb341104ae8ca29163c0 (diff)
downloadansible-33a92419a3dabd3203f96ac5b4c35ddc7040c25e.tar.gz
backport 2.6 - add dropdown version changer - 55655 (#58098)
-rw-r--r--docs/docsite/_themes/sphinx_rtd_theme/ansible_versions.html29
-rw-r--r--docs/docsite/_themes/sphinx_rtd_theme/layout.html58
-rw-r--r--docs/docsite/_themes/sphinx_rtd_theme/versions.html1
-rw-r--r--docs/docsite/rst/conf.py6
4 files changed, 61 insertions, 33 deletions
diff --git a/docs/docsite/_themes/sphinx_rtd_theme/ansible_versions.html b/docs/docsite/_themes/sphinx_rtd_theme/ansible_versions.html
new file mode 100644
index 0000000000..06a0271eda
--- /dev/null
+++ b/docs/docsite/_themes/sphinx_rtd_theme/ansible_versions.html
@@ -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>
diff --git a/docs/docsite/_themes/sphinx_rtd_theme/layout.html b/docs/docsite/_themes/sphinx_rtd_theme/layout.html
index 2328d9c9d7..4b4d7ebd0f 100644
--- a/docs/docsite/_themes/sphinx_rtd_theme/layout.html
+++ b/docs/docsite/_themes/sphinx_rtd_theme/layout.html
@@ -17,7 +17,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script type="text/javascript" src="//www.redhat.com/dtm.js"></script>
- <meta class="swiftype" name="published_at" data-type="date" content="2017-12-13" />
+ <meta class="swiftype" name="published_at" data-type="date" content="2017-12-13" />
<meta class="swiftype" name="version" data-type="string" content="3.2.2">
<!-- Google Tag Manager Data Layer -->
@@ -113,7 +113,7 @@
</head>
-<body class="wy-body-for-nav">
+<body class="wy-body-for-nav">
<!-- Google Tag Manager -->
<noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-PSB293" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
@@ -131,7 +131,7 @@
</div>
<a class="DocSite-nav" href="/" style="padding-bottom: 30px;">
-
+
<img class="DocSiteNav-logo"
src="{{ pathto('_static/', 1) }}images/logo_invert.png"
alt="Ansible Logo">
@@ -145,32 +145,28 @@
{# SIDE NAV, TOGGLES ON MOBILE #}
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
-
+
<div class="wy-side-scroll">
<div class="wy-side-nav-search">
{% block sidebartitle %}
- <div style="background-color:#5bbdbf;height=80px;margin:'auto auto auto auto'">
- <a class="DocSiteProduct-header DocSiteProduct-header--core" href="/">
- <div class="DocSiteProduct-productName">
+ <div style="background-color:#5bbdbf;height=80px;margin:'auto auto auto auto'">
+ <a class="DocSiteProduct-header DocSiteProduct-header--core" href="/">
+ <div class="DocSiteProduct-productName">
<div class="DocSiteProduct-logoText">
- Ansible
- <div class="DocSiteProduct-CurrentVersion" align="right">
- 2.6
- </div>
+ Ansible
+ <div class="DocSiteProduct-CurrentVersion" align="right">{{ current_version }}</div>
</div>
- </div>
- </a>
+ </div>
+ </a>
+ </div>
- <div class="DocSiteProduct-CheckVersionPara">For previous versions, see the <a class="DocSiteProduct-versionheader" href="/#coreversionselect">documentation archive.</a></div>
- </div>
+ {% include "ansible_versions.html" %}
- <div class="wy-side-nav-search" style="background-color#5bbdbf;height=80px;margin:'auto auto auto auto'">
- <!-- <a href="{{ pathto(master_doc) }}" class="icon icon-home"> {{ project }}</a> -->
- {% include "searchbox.html" %}
- </div>
+ <div class="wy-side-nav-search" style="background-color#5bbdbf;height=80px;margin:'auto auto auto auto'">
+ {% include "searchbox.html" %}
+ </div>
-
{% endblock %}
</div>
@@ -194,19 +190,18 @@
{% endif %}
{% endblock %}
</div>
- <!-- changeable widget -->
- <div id="sideBanner">
- <br/>
- <a href="https://www.ansible.com/docs-left?utm_source=docs">
- <img style="border-width:0px;" src="https://cdn2.hubspot.net/hubfs/330046/docs-graphics/ASB-docs-left-rail.png" />
- </a>
- </div>
-
-
+ <!-- changeable widget -->
+
+ <div id="sideBanner">
+ <br/>
+ <a href="https://www.ansible.com/docs-left?utm_source=docs">
+ <img style="border-width:0px;" src="https://cdn2.hubspot.net/hubfs/330046/docs-graphics/ASB-docs-left-rail.png" />
+ </a>
+ <br/><br/><br/>
+ </div>
</div>
- &nbsp;
</nav>
- </div>
+ </div>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
@@ -248,7 +243,6 @@
</section>
</div>
- {% include "versions.html" %}
{% if not embedded %}
diff --git a/docs/docsite/_themes/sphinx_rtd_theme/versions.html b/docs/docsite/_themes/sphinx_rtd_theme/versions.html
index 4d78287ade..4b057d3211 100644
--- a/docs/docsite/_themes/sphinx_rtd_theme/versions.html
+++ b/docs/docsite/_themes/sphinx_rtd_theme/versions.html
@@ -34,4 +34,3 @@
</div>
</div>
{% endif %}
-
diff --git a/docs/docsite/rst/conf.py b/docs/docsite/rst/conf.py
index a9e43ec40e..2010ec830f 100644
--- a/docs/docsite/rst/conf.py
+++ b/docs/docsite/rst/conf.py
@@ -244,3 +244,9 @@ autoclass_content = 'both'
intersphinx_mapping = {'python': ('https://docs.python.org/2/', (None, '../python2-2.7.13.inv')),
'python3': ('https://docs.python.org/3/', (None, '../python3-3.6.2.inv')),
'jinja2': ('http://jinja.pocoo.org/docs/', (None, '../jinja2-2.9.7.inv'))}
+
+# list specifically out of order to make latest work
+html_context = {
+ 'current_version': version,
+ 'available_versions': ('latest', '2.7', '2.6', 'devel')
+}