Add category for Works with Home Assistant partners (#31019)

This commit is contained in:
Franck Nijhof 2024-01-24 09:34:10 +01:00 committed by GitHub
parent 6ec05712cd
commit 1a399a57c4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -32,7 +32,10 @@ regenerate: false
<div class="filter-button-group">
<a href='#all' class="btn">All ({{tot}})</a>
<a href='#featured' class="btn featured">Featured</a>
<div class="featured">
<a href='#featured' class="btn">Featured</a>
<a href='#works-with-home-assistant' class="btn">Partners</a>
</div>
<div class="version_select">Added in: <select name="versions">
<option value="#"></option>
{%- for group in components_by_version -%}
@ -121,7 +124,7 @@ var allComponents = [
{% capture category %}"{{ ha_category | slugify | downcase }}"{% endcapture %}
{% assign categories = categories | push: category %}
{%- endfor -%}
{url:"{{ component.url }}", title:"{{component.title}}", cat: [{{categories|join: ","}}], featured: {% if component.featured %}true{% else %}false{% endif %}, v: "{{major_version}}.{{minor_version}}", logo: "{{component.logo}}", domain: "{{component.ha_domain}}", ha_brand: "{{component.ha_brand}}"},
{url:"{{ component.url }}", title:"{{component.title}}", cat: [{{categories|join: ","}}], featured: {% if component.featured %}true{% else %}false{% endif %}, v: "{{major_version}}.{{minor_version}}", logo: "{{component.logo}}", domain: "{{component.ha_domain}}", ha_brand: "{{component.ha_brand}}", wwha: {% if component.works_with %}true{% else %}false{% endif %}},
{% endif -%}
{%- endfor -%}
false
@ -210,6 +213,12 @@ allComponents.pop(); // remove placeholder element at the end
return comp.featured;
};
} else if (hash === '#works-with-home-assistant' || hash === '') {
// only show those partners of the Works with Home Assistant program
filter = function (comp) {
return comp.wwha;
};
} else if (hash.indexOf('#version/') === 0) {
// compare against a version
search = decodeURIComponent(hash).substring(9).toLowerCase();