openstack-manuals/www/templates/switch_releases.tmpl
Adam Spiers dbd704f335 Provide dropdown menu which allows switching doc release
Currently deprecation badge headers just point back to the root of
the documentation for the latest stable release, so for example the
badge at the top of

    https://docs.openstack.org/latest/user/index.html

just points to

    https://docs.openstack.org/rocky/

It's useful to be able to quickly jump between different releases of
the same documentation page, but currently this requires hand-editing
URLs or many extra manual hops in the navigation trail.  So
automatically generate the links, but only display them if the link
target exists.

Since the main portal page for each release already had a "More
Releases" dropdown, remove that to avoid two dropdowns on the portal
pages.

Change-Id: I2498f00a6c863d078a70289a655b0aa3958325ed
2019-01-24 00:19:22 +00:00

43 lines
2.3 KiB
Cheetah

<div class="dropdown docs-dropdown">
<a data-toggle="dropdown" href="#">
{% if SERIES_INFO.status == 'development' %}
{{SERIES_IN_DEVELOPMENT|title}}
{% else %}
{{SERIES|title}}
{% endif %}
<i class="fa fa-caret-down fa-3"></i></a>
<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
{% if SERIES_INFO.status == 'development' %}
<li role="presentation" class="current">
<span role="menuitem" tabindex="-1">
{{SERIES_IN_DEVELOPMENT|title}}
(viewing, in development)</span>
</li>
{% else %}
<li role="presentation">
{% set devtarget=TEMPLATE_FILE.replace(SERIES_PATH_PREFIX, SERIES_IN_DEVELOPMENT) %}
<a role="menuitem" tabindex="-1"
href="{{TOPDIR}}{{devtarget}}">{{SERIES_IN_DEVELOPMENT|title}}
(in development)</a>
{% endif %}
</li>
{% for series_name in PAST_SERIES|reverse %}
{% set target=TEMPLATE_FILE.replace(SERIES_PATH_PREFIX, series_name) %}
{% if series_name == SERIES %}
<li role="presentation" class="current">
{{series_name|title}}
{% if series_name == RELEASED_SERIES %}
(viewing, current release)
{% else %}
(viewing)
{% endif %}
{% elif TEMPLATE_FILES[target] %}
<li role="presentation">
<a role="menuitem" tabindex="-1"
href="{{TOPDIR}}{{target}}">{{series_name|title}}{% if series_name == RELEASED_SERIES %} (current release){% endif %}</a>
{% endif %}
</li>
{% endfor %}
</ul>
</div>