home-assistant.io/source/_includes/asides/component_navigation.html
Robbert Müller d54499fc21 Buildtime improvements (#7315)
* Remove whitespace generation

this removes about 65MB of added whitespace, which didn't need
generating

* Remove liquid compression.

Most of the stripepd whitespace, is already removed in the previous
commit. And this removes more then 50% of the build time ( localy )

* Remove unneeded whitespace generation
2018-11-01 11:11:05 +01:00

142 lines
4.3 KiB
HTML

{%- assign components = site.components | sort_natural: 'title' -%}
{%- assign github_main_repo = 'https://github.com/home-assistant/home-assistant/blob/master/homeassistant' -%}
<section class="aside-module grid__item one-whole lap-one-half">
{%- include edit_github.html -%}
<div class='brand-logo-container section'>
{%- if page.logo -%}
<img src='/images/supported_brands/{{ page.logo }}' />
{%- endif -%}
</div>
{%- assign file_parts = page.url | split: '/' | last | split: '.' -%}
{%- if file_parts.size == 2 -%}
{%- assign is_platform = true -%}
{%- assign imp_name = file_parts[1] -%}
{%- assign parent_name = file_parts[0] -%}
{%- assign parent_url = parent_name | prepend: '/components/' | append: '/' -%}
{%- assign parent_component = components | where: 'url', parent_url | first -%}
{%- else -%}
{%- assign is_platform = false -%}
{%- assign imp_name = file_parts | first -%}
{%- endif -%}
{%- if page.ha_iot_class -%}
<div class='section'>
IoT class<sup><a href='/blog/2016/02/12/classifying-the-internet-of-things/#classifiers'><i class="icon-info-sign"></i></a></sup>: {{ page.ha_iot_class }}
</div>
{%- endif -%}
{%- if page.ha_qa_scale -%}
<div class='section'>
Quality Scale: <a href='/docs/quality_scale/'>
{%- if page.ha_qa_scale == 'platinum' -%}
🏆 (platinum)
{%- elsif page.ha_qa_scale == 'gold' -%}
🥇 (gold)
{%- elsif page.ha_qa_scale == 'silver' -%}
🥈 (silver)
{%- elsif page.ha_qa_scale == 'internal' -%}
🏠 (internal)
{%- endif -%}
</a>
</div>
{%- endif -%}
{%- if page.ha_release -%}
<div class='section'>
Introduced in release: {{ page.ha_release }}
</div>
{%- endif -%}
{%- if is_platform -%}
<div class='section'>
Source:
<a href='{{github_main_repo}}{{parent_url}}{{imp_name}}.py'>{{parent_name}}/{{imp_name}}.py</a>
</div>
{%- endif -%}
{%- if is_platform and parent_name != 'sensor' -%}
<div class='section'>
This is a platform for
<a href='{{parent_component.url}}'>the {{parent_component.title}} component</a>.
</div>
{%- elsif is_platform == false and imp_name != 'ifttt' -%}
{%- assign platforms_found = false -%}
{%- for component in components -%}
{%- if component.url != page.url -%}
{%- assign comp_imp_name = component.url | split: '/' | last | split: '.' | first -%}
{%- if comp_imp_name == imp_name %}
{%- unless platforms_found -%}
{%- assign platforms_found = true -%}
<h1 class='title delta'>Platforms</h1>
<ul class='divided'>
{%- endunless -%}
<li><a href='{{component.url}}'>
{{component.title}}
</a></li>
{% endif -%}
{%- endif -%}
{%- endfor -%}
{%- if platforms_found -%}
</ul>
{%- endif -%}
{%- endif -%}
{%- assign related_found = false -%}
{%- for component in components -%}
{%- if component.url != page.url -%}
{%- assign comp_file_parts = component.url | split: '/' | last | split: '.' -%}
{%- if comp_file_parts.size == 2 -%}
{%- assign comp_imp_name = comp_file_parts | last -%}
{%- else -%}
{%- assign comp_imp_name = comp_file_parts | first -%}
{%- endif -%}
{%- if comp_imp_name == imp_name -%}
{%- unless related_found -%}
{%- assign related_found = true -%}
<div class='section'>
<h1 class='title delta'>Related components</h1>
<ul class='divided'>
{%- endunless -%}
<li><a href='{{component.url}}'>
{{component.title}}
</a></li>
{%- endif -%}
{%- endif -%}
{%- endfor -%}
{%- if related_found -%}
</ul>
</div>
{%- endif -%}
{%- if page.ha_category -%}
<div class='section'>
<h1 class="title delta">Category {{page.ha_category}}</h1>
<ul class='divided'>
{%- for component in components -%}
{%- if component.ha_category == page.ha_category -%}
<li>
{%- if component.url == page.url -%}
{{component.title}}
{%- else -%}
<a href='{{component.url}}'>{{component.title}}</a>
{%- endif -%}
</li>
{%- endif -%}
{%- endfor -%}
</ul>
</div>
{%- endif -%}
</section>