boxes/_includes/version-select.html
Thomas Jensen c049484e4c
Update website design
- Updated frameworks for better browser support
- Improved responsive design
- Versioned documentation
- Better social media support via the Jekyll SEO plugin
- New looks, fwiw
- Start page has some more relevant info
- Documentation sorted to be more easily accessible
- Internally upgraded from plain CSS to SASS
2021-05-26 21:13:21 +02:00

48 lines
1.5 KiB
HTML

{%- comment -%}
Outputs a dropdown with specific boxes versions for which we have documentation.
Parameters:
- currentVersion: the version of the current page, e.g. 'v2.1.0'
- contentPiece: the page to target, e.g. 'config-syntax'
{%- endcomment -%}
{%- comment -%} ------------ Determine the list of boxes versions ------------ {%- endcomment -%}
{%- assign versions = "" | split: "," -%}
{%- for p in site.pages -%}
{%- if p.bxVersion -%}
{%- assign versions = versions | push: p.bxVersion -%}
{%- endif -%}
{%- endfor - %}
{%- assign versions = versions | sort | uniq | reverse -%}
{%- comment -%} ------------ Output the dopdown control ------------ {%- endcomment -%}
<form>
<div class="form-group my-4 row">
<div class="col-4 col-md-3 col-xl-2">
<label for="bxVersionSelect" class="form-label"><i>Boxes</i> Version:</label>
</div>
<div class="col-4 col-md-3 col-lg-2">
<select class="form-control form-select" id="bxVersionSelect">
{%- for v in versions %}
<option value="{{ v }}"
{%- if include.currentVersion == v %} selected {%- endif -%}>{{ v }}</option>
{%- endfor - %}
</select>
</div>
</div>
</form>
<script>
document.getElementById("bxVersionSelect").onchange = function() {
if (this.selectedIndex >= 0) {
window.location.href = '{{ site.baseurl }}/' + this.value + '/{{ include.contentPiece }}.html';
}
};
</script>