From b0fdd452059f06e5eb7f8f95d6558527e6744e03 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Wed, 27 May 2015 22:04:38 -0700 Subject: [PATCH] Polymer 1.0: Move attribute classnames logic to more info elements --- .../polymer/more-infos/more-info-content.html | 20 ++--------- .../polymer/more-infos/more-info-light.html | 12 +++++-- .../more-infos/more-info-thermostat.html | 36 +++++++++++-------- .../polymer/resources/home-assistant-js.html | 7 ++++ 4 files changed, 41 insertions(+), 34 deletions(-) diff --git a/homeassistant/components/frontend/www_static/polymer/more-infos/more-info-content.html b/homeassistant/components/frontend/www_static/polymer/more-infos/more-info-content.html index a62ba9c96ac..f5652557d43 100644 --- a/homeassistant/components/frontend/www_static/polymer/more-infos/more-info-content.html +++ b/homeassistant/components/frontend/www_static/polymer/more-infos/more-info-content.html @@ -33,24 +33,13 @@ type: Boolean, value: false, }, - - classNames: { - type: String, - value: '', - } - }, - classNames: '', - dialogOpen: false, - - observe: { - 'stateObj.attributes': 'stateAttributesChanged', }, dialogOpenChanged: function(newVal, oldVal) { - var moreInfoContainer = this.$.moreInfoContainer; + var root = Polymer.dom(this); - if (moreInfoContainer.lastChild) { - moreInfoContainer.lastChild.dialogOpen = newVal; + if (root.lastChild) { + root.lastChild.dialogOpen = newVal; } }, @@ -82,9 +71,6 @@ root.lastChild.stateObj = newVal; } - - this.classNames = Object.keys(newVal.attributes).map( - function(key) { return 'has-' + key; }).join(' '); }, }); })(); diff --git a/homeassistant/components/frontend/www_static/polymer/more-infos/more-info-light.html b/homeassistant/components/frontend/www_static/polymer/more-infos/more-info-light.html index 69f80e1e958..cbfa9ab7475 100644 --- a/homeassistant/components/frontend/www_static/polymer/more-infos/more-info-light.html +++ b/homeassistant/components/frontend/www_static/polymer/more-infos/more-info-light.html @@ -28,16 +28,16 @@ transition: max-height .5s ease-in .3s; } - /*:host-context(.has-brightness)*/ .brightness { + .has-brightness .brightness { max-height: 500px; } - /*:host-context(.has-xy_color)*/ color-picker { + .has-xy_color color-picker { max-height: 500px; }