Fix Lovelace (#1420)

pull/1424/head
quthla 2018-07-08 17:19:55 +02:00 committed by Paulus Schoutsen
parent 52f2c29726
commit c39b6bb665
3 changed files with 12 additions and 7 deletions

View File

@ -106,7 +106,7 @@ class HaSidebar extends
</app-toolbar>
<paper-listbox attr-for-selected="data-panel" selected="[[hass.panelUrl]]">
<paper-icon-item on-click="menuClicked" data-panel="states">
<paper-icon-item on-click="menuClicked" data-panel$="[[defaultPage]]">
<ha-icon slot="item-icon" icon="hass:apps"></ha-icon>
<span class="item-text">[[localize('panel.states')]]</span>
</paper-icon-item>
@ -159,6 +159,7 @@ class HaSidebar extends
type: Array,
computed: 'computePanels(hass)',
},
defaultPage: String,
};
}

View File

@ -45,7 +45,7 @@ class HomeAssistantMain extends NavigateMixin(EventsMixin(PolymerElement)) {
<app-drawer-layout fullbleed="" force-narrow="[[computeForceNarrow(narrow, dockedSidebar)]]" responsive-width="0">
<app-drawer id="drawer" slot="drawer" disable-swipe="[[_computeDisableSwipe(hass)]]" swipe-open="[[!_computeDisableSwipe(hass)]]" persistent="[[dockedSidebar]]">
<ha-sidebar narrow="[[narrow]]" hass="[[hass]]"></ha-sidebar>
<ha-sidebar narrow="[[narrow]]" hass="[[hass]]" default-page="[[_defaultPage]]"></ha-sidebar>
</app-drawer>
<iron-pages attr-for-selected="id" fallback-selection="panel-resolver" selected="[[hass.panelUrl]]" selected-attribute="panel-visible">
@ -76,6 +76,7 @@ class HomeAssistantMain extends NavigateMixin(EventsMixin(PolymerElement)) {
ready() {
super.ready();
this._defaultPage = localStorage.defaultPage || 'states';
this.addEventListener('hass-open-menu', () => this.handleOpenMenu());
this.addEventListener('hass-close-menu', () => this.handleCloseMenu());
this.addEventListener('hass-start-voice', ev => this.handleStartVoice(ev));

View File

@ -52,18 +52,21 @@ class HUIRoot extends NavigateMixin(EventsMixin(PolymerElement)) {
}
#view {
min-height: calc(100vh - 112px);
/**
* Since we only set min-height, if child nodes need percentage
* heights they must use absolute positioning so we need relative
/**
* Since we only set min-height, if child nodes need percentage
* heights they must use absolute positioning so we need relative
* positioning here.
*
* https://www.w3.org/TR/CSS2/visudet.html#the-height-property
*
* https://www.w3.org/TR/CSS2/visudet.html#the-height-property
*/
position: relative;
}
#view.tabs-hidden {
min-height: calc(100vh - 64px);
}
paper-item {
cursor: pointer;
}
</style>
<app-route route="[[route]]" pattern="/:view" data="{{routeData}}"></app-route>
<ha-app-layout id="layout">