diff --git a/bower.json b/bower.json index c2a2b2fc40..9e50c93fa7 100644 --- a/bower.json +++ b/bower.json @@ -9,6 +9,7 @@ "private": true, "dependencies": { "app-layout": "^2.0.0", + "app-route": "PolymerElements/app-route#^2.0.0", "app-storage": "^2.0.2", "fecha": "~2.3.0", "font-roboto-local": "~1.0.1", @@ -70,6 +71,7 @@ "iron-input": "^2.0.0", "iron-jsonp-library": "^2.0.0", "iron-list": "^2.0.0", + "iron-location": "^2.0.1", "iron-media-query": "^2.0.0", "iron-menu-behavior": "^2.0.0", "iron-meta": "^2.0.0", @@ -103,7 +105,6 @@ "paper-scroll-header-panel": "^2.0.0", "paper-slider": "^2.0.0", "paper-spinner": "^2.0.0", - "paper-styles": "2.0.0", "paper-styles": "^2.0.0", "paper-tabs": "^2.0.0", "paper-toast": "^2.0.0", diff --git a/src/components/ha-sidebar.html b/src/components/ha-sidebar.html index e1f152e43d..54003cd219 100644 --- a/src/components/ha-sidebar.html +++ b/src/components/ha-sidebar.html @@ -99,7 +99,7 @@ - + States @@ -178,9 +178,9 @@ Polymer({ type: String, }, - narrow: { - type: Boolean, - }, + narrow: Boolean, + + route: Object, panels: { type: Array, @@ -193,10 +193,6 @@ Polymer({ }, }, - created: function () { - this._boundUpdateStyles = this.updateStyles.bind(this); - }, - computePanels: function (hass) { var panels = hass.config.panels; var sortValue = { @@ -236,10 +232,6 @@ Polymer({ return result; }, - menuSelect: function () { - this.debounce('updateStyles', this._boundUpdateStyles, 1); - }, - menuClicked: function (ev) { var target = ev.target; var checks = 5; @@ -262,14 +254,16 @@ Polymer({ }, selectPanel: function (newChoice) { - if (newChoice === this.hass.currentPanel) { - return; - } else if (newChoice === 'logout') { + if (newChoice === 'logout') { this.handleLogOut(); return; } - this.fire('hass-navigate', { panel: newChoice }); - this.debounce('updateStyles', this._boundUpdateStyles, 1); + var path = '/' + newChoice; + if (path === document.location.pathname) { + return; + } + history.pushState(null, null, path); + this.fire('location-changed'); }, handleLogOut: function () { diff --git a/src/home-assistant.html b/src/home-assistant.html index 43453e1f8c..65a56de3e6 100644 --- a/src/home-assistant.html +++ b/src/home-assistant.html @@ -25,7 +25,6 @@