Skip to content

Commit

Permalink
backport 2.6 - add dropdown version changer - 55655 (#58098)
Browse files Browse the repository at this point in the history
  • Loading branch information
samccann authored and acozine committed Jun 19, 2019
1 parent 2aa20a9 commit 33a9241
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 33 deletions.
29 changes: 29 additions & 0 deletions 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>
58 changes: 26 additions & 32 deletions docs/docsite/_themes/sphinx_rtd_theme/layout.html
Expand Up @@ -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 -->
Expand Down Expand Up @@ -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>
Expand All @@ -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">
Expand All @@ -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>

Expand All @@ -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">
Expand Down Expand Up @@ -248,7 +243,6 @@
</section>

</div>
{% include "versions.html" %}

{% if not embedded %}

Expand Down
1 change: 0 additions & 1 deletion docs/docsite/_themes/sphinx_rtd_theme/versions.html
Expand Up @@ -34,4 +34,3 @@
</div>
</div>
{% endif %}

6 changes: 6 additions & 0 deletions docs/docsite/rst/conf.py
Expand Up @@ -244,3 +244,9 @@
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')
}

0 comments on commit 33a9241

Please sign in to comment.