From 92fb95d4ca895cf4e74b633332a76de711e08ef2 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Thu, 24 Jan 2019 23:17:28 +0100 Subject: [PATCH] Refactor of documentation method for components (2019-0016) (#8265) * :tractor: Refactor of documentation method for components * :shirt: Marks Ikea Tradfri ha_config_flow * :shirt: Fixes additionalwhitespace generation --- sass/custom/_paulus.scss | 2 ++ source/_components/light.tradfri.markdown | 16 ----------- source/_components/sensor.tradfri.markdown | 16 ----------- source/_components/switch.tradfri.markdown | 16 ----------- source/_components/tradfri.markdown | 10 ++++++- .../asides/component_navigation.html | 27 +++++++++---------- source/components/index.html | 16 ++++++++--- 7 files changed, 35 insertions(+), 68 deletions(-) delete mode 100644 source/_components/light.tradfri.markdown delete mode 100644 source/_components/sensor.tradfri.markdown delete mode 100644 source/_components/switch.tradfri.markdown diff --git a/sass/custom/_paulus.scss b/sass/custom/_paulus.scss index f0c233ec106..af314eff8b9 100644 --- a/sass/custom/_paulus.scss +++ b/sass/custom/_paulus.scss @@ -411,6 +411,8 @@ p.note { .brand-logo-container { text-align: center; height: 87px; + margin-top: 50px; + margin-bottom: 25px; img { max-height: 67px; diff --git a/source/_components/light.tradfri.markdown b/source/_components/light.tradfri.markdown deleted file mode 100644 index e7b44cdfd2b..00000000000 --- a/source/_components/light.tradfri.markdown +++ /dev/null @@ -1,16 +0,0 @@ ---- -layout: page -title: "IKEA Trådfri lights" -description: "Access and control your Zigbee-based IKEA Trådfri (Tradfri) Lights." -date: 2017-04-12 22.04 -sidebar: true -comments: false -sharing: true -footer: true -logo: ikea.svg -ha_category: Light -ha_iot_class: "Local Polling" -ha_release: 0.43 ---- - -For installation instructions, see [the Trådfri component](/components/tradfri/). diff --git a/source/_components/sensor.tradfri.markdown b/source/_components/sensor.tradfri.markdown deleted file mode 100644 index a6aebf4e5b6..00000000000 --- a/source/_components/sensor.tradfri.markdown +++ /dev/null @@ -1,16 +0,0 @@ ---- -layout: page -title: "IKEA Trådfri Sensor" -description: "Access and control your Zigbee-based IKEA Trådfri (Tradfri) Sensors." -date: 2017-04-12 22.04 -sidebar: true -comments: false -sharing: true -footer: true -logo: ikea.svg -ha_category: Sensor -ha_iot_class: "Local Polling" -ha_release: 0.67 ---- - -For installation instructions, see [the Trådfri component](/components/tradfri/). diff --git a/source/_components/switch.tradfri.markdown b/source/_components/switch.tradfri.markdown deleted file mode 100644 index 95069570664..00000000000 --- a/source/_components/switch.tradfri.markdown +++ /dev/null @@ -1,16 +0,0 @@ ---- -layout: page -title: "IKEA Trådfri Switch" -description: "Access and control your Zigbee-based IKEA Trådfri (Tradfri) Switches." -date: 2018-09-30 19.22 -sidebar: true -comments: false -sharing: true -footer: true -logo: ikea.svg -ha_category: Switch -ha_iot_class: "Local Polling" -ha_release: 0.80 ---- - -For installation instructions, see [the Trådfri component](/components/tradfri/). diff --git a/source/_components/tradfri.markdown b/source/_components/tradfri.markdown index a642a1959a9..fb234f2e928 100644 --- a/source/_components/tradfri.markdown +++ b/source/_components/tradfri.markdown @@ -9,9 +9,17 @@ comments: false sharing: true footer: true logo: ikea.svg -ha_category: Hub ha_iot_class: "Local Polling" +ha_config_flow: true ha_release: 0.43 +ha_category: + - Light + - Sensor + - Switch +redirect_from: + - /components/light.tradfri/ + - /components/sensor.tradfri/ + - /components/switch.tradfri/ --- The `tradfri` component support the IKEA Trådfri Gateway (a.k.a. IKEA Tradfri hub/bridge). The gateway can control compatible Zigbee-based lights (certified ZigBee Light Link products) connected to it and Home Assistant will automatically discover the gateways presence on your local network, if `discovery:` is present in your `configuration.yaml` file. diff --git a/source/_includes/asides/component_navigation.html b/source/_includes/asides/component_navigation.html index bd64fc7efe3..d9c4b26c9ce 100644 --- a/source/_includes/asides/component_navigation.html +++ b/source/_includes/asides/component_navigation.html @@ -50,6 +50,12 @@ {%- endif -%} + {%- if page.ha_config_flow -%} +
+ This component is configurable via UI +
+ {%- endif -%} + {%- if is_platform -%}
Source: @@ -88,7 +94,6 @@ {%- endif -%} - {%- assign related_found = false -%} {%- for component in components -%} {%- if component.url != page.url -%} @@ -118,22 +123,14 @@
{%- endif -%} - - - {%- if page.ha_category -%} + {%- if page.ha_category.first -%}
-

Category {{page.ha_category}}

+

Categories

diff --git a/source/components/index.html b/source/components/index.html index eea09566104..d6d9ade957f 100644 --- a/source/components/index.html +++ b/source/components/index.html @@ -17,12 +17,16 @@ regenerate: false {%- assign tot = 0 -%} {%- for comp in site.components -%} {%- if comp.ha_category -%} - {%- assign tot = tot | plus: 1 -%} + {%- if comp.ha_category.first -%} + {%- assign tot = tot | plus: comp.ha_category.size -%} + {%- else -%} + {%- assign tot = tot | plus: 1 -%} + {%- endif -%} {%- endif %} {%- endfor -%} {%- assign components = site.components | sort: 'title' -%} -{%- assign categories = components | sort: 'ha_category' | map: 'ha_category' | uniq -%} +{%- assign categories = components | map: 'ha_category' | join: ',' | join: ',' | split: ',' | uniq | sort -%} {%- capture current_version -%}{{ site.current_major_version }}.{{ site.current_minor_version }}{% endcapture -%} {%- assign added_one_ago_minor_version = site.current_minor_version|minus: 1 -%} {%- capture added_one_ago_version -%}{{ site.current_major_version }}.{{ added_one_ago_minor_version }}{% endcapture -%} @@ -51,7 +55,7 @@ Support for these components is provided by the Home Assistant community. {%- endif -%} {%- endfor -%} - Other + Other ({{ components | where: 'ha_category', 'Other' | size }})
@@ -100,7 +104,11 @@ var allComponents = [ {%- assign sliced_version = component.ha_release | split: '.' -%} {%- assign minor_version = sliced_version[1]|plus: 0 -%} {%- assign major_version = sliced_version[0]|plus: 0 -%} -{url:"{{ component.url }}", title:"{{component.title}}", cat:"{{component.ha_category | slugify}}", featured: {% if component.featured %}true{% else %}false{% endif %}, v: "{{major_version}}.{{minor_version}}", logo: "{{component.logo}}"}, +{%- assign featured_first = true -%} + {%- for ha_category in component.ha_category -%} +{url:"{{ component.url }}", title:"{{component.title}}", cat:"{{ha_category | slugify}}", featured: {% if component.featured and featured_first %}true{% else %}false{% endif %}, v: "{{major_version}}.{{minor_version}}", logo: "{{component.logo}}"}, + {%- assign featured_first = false -%} + {%- endfor -%} {% endif -%} {%- endfor -%} false