mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Expose to more info content if dialog is open
This commit is contained in:
parent
5a0251c3cd
commit
522bbfb716
@ -7,12 +7,14 @@
|
|||||||
|
|
||||||
<polymer-element name="more-info-dialog">
|
<polymer-element name="more-info-dialog">
|
||||||
<template>
|
<template>
|
||||||
<ha-dialog id="dialog">
|
<ha-dialog id="dialog" on-core-overlay-open="{{dialogOpenChanged}}">
|
||||||
<div>
|
<div>
|
||||||
<state-card-content stateObj="{{stateObj}}" style='margin-bottom: 24px;'>
|
<state-card-content stateObj="{{stateObj}}" style='margin-bottom: 24px;'>
|
||||||
</state-card-content>
|
</state-card-content>
|
||||||
<state-timeline stateHistory="{{stateHistory}}"></state-timeline>
|
<state-timeline stateHistory="{{stateHistory}}"></state-timeline>
|
||||||
<more-info-content stateObj="{{stateObj}}"></more-info-content>
|
<more-info-content
|
||||||
|
stateObj="{{stateObj}}"
|
||||||
|
dialogOpen="{{dialogOpen}}"></more-info-content>
|
||||||
</div>
|
</div>
|
||||||
</ha-dialog>
|
</ha-dialog>
|
||||||
</template>
|
</template>
|
||||||
@ -27,11 +29,16 @@ Polymer(Polymer.mixin({
|
|||||||
stateObj: null,
|
stateObj: null,
|
||||||
stateHistory: null,
|
stateHistory: null,
|
||||||
hasHistoryComponent: false,
|
hasHistoryComponent: false,
|
||||||
|
dialogOpen: false,
|
||||||
|
|
||||||
observe: {
|
observe: {
|
||||||
'stateObj.attributes': 'reposition'
|
'stateObj.attributes': 'reposition'
|
||||||
},
|
},
|
||||||
|
|
||||||
|
created: function() {
|
||||||
|
this.dialogOpenChanged = this.dialogOpenChanged.bind(this);
|
||||||
|
},
|
||||||
|
|
||||||
attached: function() {
|
attached: function() {
|
||||||
this.listenToStores(true);
|
this.listenToStores(true);
|
||||||
},
|
},
|
||||||
@ -66,6 +73,13 @@ Polymer(Polymer.mixin({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
dialogOpenChanged: function(ev) {
|
||||||
|
// we get CustomEvent, undefined and true/false from polymer…
|
||||||
|
if (typeof ev === 'object') {
|
||||||
|
this.dialogOpen = ev.detail;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
changeEntityId: function(entityId) {
|
changeEntityId: function(entityId) {
|
||||||
this.entityId = entityId;
|
this.entityId = entityId;
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
<link rel="import" href="more-info-thermostat.html">
|
<link rel="import" href="more-info-thermostat.html">
|
||||||
<link rel="import" href="more-info-script.html">
|
<link rel="import" href="more-info-script.html">
|
||||||
|
|
||||||
<polymer-element name="more-info-content" attributes="stateObj">
|
<polymer-element name="more-info-content" attributes="stateObj dialogOpen">
|
||||||
<template>
|
<template>
|
||||||
<style>
|
<style>
|
||||||
:host {
|
:host {
|
||||||
@ -20,11 +20,20 @@
|
|||||||
<script>
|
<script>
|
||||||
Polymer({
|
Polymer({
|
||||||
classNames: '',
|
classNames: '',
|
||||||
|
dialogOpen: false,
|
||||||
|
|
||||||
observe: {
|
observe: {
|
||||||
'stateObj.attributes': 'stateAttributesChanged',
|
'stateObj.attributes': 'stateAttributesChanged',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
dialogOpenChanged: function(oldVal, newVal) {
|
||||||
|
var moreInfoContainer = this.$.moreInfoContainer;
|
||||||
|
|
||||||
|
if (moreInfoContainer.lastChild) {
|
||||||
|
moreInfoContainer.lastChild.dialogOpen = newVal;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
stateObjChanged: function(oldVal, newVal) {
|
stateObjChanged: function(oldVal, newVal) {
|
||||||
var moreInfoContainer = this.$.moreInfoContainer;
|
var moreInfoContainer = this.$.moreInfoContainer;
|
||||||
|
|
||||||
@ -42,10 +51,12 @@ Polymer({
|
|||||||
|
|
||||||
var moreInfo = document.createElement("more-info-" + newVal.moreInfoType);
|
var moreInfo = document.createElement("more-info-" + newVal.moreInfoType);
|
||||||
moreInfo.stateObj = newVal;
|
moreInfo.stateObj = newVal;
|
||||||
|
moreInfo.dialogOpen = this.dialogOpen;
|
||||||
moreInfoContainer.appendChild(moreInfo);
|
moreInfoContainer.appendChild(moreInfo);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
moreInfoContainer.lastChild.dialogOpen = this.dialogOpen;
|
||||||
moreInfoContainer.lastChild.stateObj = newVal;
|
moreInfoContainer.lastChild.stateObj = newVal;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user