Skip to content
Snippets Groups Projects
Commit 522bbfb7 authored by Paulus Schoutsen's avatar Paulus Schoutsen
Browse files

Expose to more info content if dialog is open

parent 5a0251c3
Branches
Tags
No related merge requests found
...@@ -7,12 +7,14 @@ ...@@ -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({ ...@@ -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({ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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({ ...@@ -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;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment