mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-09 18:36:51 +00:00
Add a dropdown for selecting a specific version
This commit is contained in:
parent
bdbece9f3f
commit
c22b20094d
@ -70,6 +70,17 @@ module Jekyll
|
|||||||
def canonical_url(input)
|
def canonical_url(input)
|
||||||
full_url(input).sub(/index\.\w+$/i, '')
|
full_url(input).sub(/index\.\w+$/i, '')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Sort an array of semvers
|
||||||
|
def semver_sort(input)
|
||||||
|
input.sort_by { |v|
|
||||||
|
val = v['name']
|
||||||
|
if val == "pre 0.7"
|
||||||
|
val = "0.6"
|
||||||
|
end
|
||||||
|
Gem::Version.new(val)
|
||||||
|
}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@ regenerate: false
|
|||||||
{%- endfor -%}
|
{%- endfor -%}
|
||||||
|
|
||||||
{%- assign components = site.components | sort: 'title' -%}
|
{%- assign components = site.components | sort: 'title' -%}
|
||||||
|
{%- assign components_by_version = site.components | group_by: 'ha_release' | semver_sort | reverse -%}
|
||||||
{%- assign categories = components | map: 'ha_category' | join: ',' | join: ',' | split: ',' | uniq | sort -%}
|
{%- assign categories = components | map: 'ha_category' | join: ',' | join: ',' | split: ',' | uniq | sort -%}
|
||||||
{%- capture current_version -%}{{ site.current_major_version }}.{{ site.current_minor_version }}{% endcapture -%}
|
{%- capture current_version -%}{{ site.current_major_version }}.{{ site.current_minor_version }}{% endcapture -%}
|
||||||
{%- assign added_one_ago_minor_version = site.current_minor_version|minus: 1 -%}
|
{%- assign added_one_ago_minor_version = site.current_minor_version|minus: 1 -%}
|
||||||
@ -48,7 +49,11 @@ Support for these components is provided by the Home Assistant community.
|
|||||||
<a href='#version/{{ current_version }}' class="btn added_in_current_version">Added in {{ current_version }} ({{ current_version_components_count }})</a>
|
<a href='#version/{{ current_version }}' class="btn added_in_current_version">Added in {{ current_version }} ({{ current_version_components_count }})</a>
|
||||||
<a href='#version/{{ added_one_ago_version }}' class="btn added_one_version_ago">Added in {{ added_one_ago_version }} ({{ one_ago_version_components_count }})</a>
|
<a href='#version/{{ added_one_ago_version }}' class="btn added_one_version_ago">Added in {{ added_one_ago_version }} ({{ one_ago_version_components_count }})</a>
|
||||||
<a href='#version/{{ added_two_ago_version }}' class="btn added_two_versions_ago">Added in {{ added_two_ago_version }} ({{ two_ago_version_components_count }})</a>
|
<a href='#version/{{ added_two_ago_version }}' class="btn added_two_versions_ago">Added in {{ added_two_ago_version }} ({{ two_ago_version_components_count }})</a>
|
||||||
|
Added in <select name="versions">
|
||||||
|
{%- for version in components_by_version -%}
|
||||||
|
<option value="#version/{{ version.name }}">{{ version.name }} ({{ version.items | size }})
|
||||||
|
{%- endfor -%}
|
||||||
|
</select>
|
||||||
{%- for category in categories -%}
|
{%- for category in categories -%}
|
||||||
{%- assign components_count = components | where: 'ha_category', category | size -%}
|
{%- assign components_count = components | where: 'ha_category', category | size -%}
|
||||||
{%- if category and category != 'Other' and components_count != 0 -%}
|
{%- if category and category != 'Other' and components_count != 0 -%}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user