doc/themes/yunohost-docs/templates/partials/versions.html.twig

19 lines
742 B
Twig
Raw Normal View History

2020-11-14 11:24:49 +01:00
<div class="version-chooser column col-4 text-right">
<select id="switch-version">
{% set langobj = grav['language'] %}
{% for key in langswitcher.languages %}
{% if key == langswitcher.current %}
{% set lang_url = page.url %}
{% set active = ' selected="selected"' %}
{% else %}
{% set lang_url = base_url_simple ~ langobj.getLanguageURLPrefix(key)~langswitcher.page_route ?: '/' %}
{% set active = '' %}
{% endif %}
<option value="{{ lang_url ~ uri.params }}"{{ active }}>{{ key }}</option>
{% endfor %}
</select>
</div>
<script>
jQuery(document).on('change', '#switch-version', function() { window.location.href = this.value });
</script>