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 @@
+
+
+
+
@@ -15,6 +19,13 @@
+
+
-
+
@@ -60,19 +78,16 @@ Polymer({
is: 'home-assistant-main',
properties: {
- hass: {
+ hass: Object,
+
+ narrow: Boolean,
+
+ route: {
type: Object,
- value: null,
- observer: 'hassChanged',
- },
-
- narrow: {
- type: Boolean,
- },
-
- currentPanel: {
- type: String,
+ observer: '_routeChanged',
},
+ routeData: Object,
+ routeTail: Object,
dockedSidebar: {
type: Boolean,
@@ -86,13 +101,9 @@ Polymer({
'hass-start-voice': 'handleStartVoice',
},
- hassChanged: function (hass) {
- if (this.currentPanel !== hass.currentPanel) {
- this.currentPanel = hass.currentPanel;
-
- if (this.narrow) {
- this.$.drawer.closeDrawer();
- }
+ _routeChanged: function () {
+ if (this.narrow) {
+ this.$.drawer.closeDrawer();
}
},
@@ -127,5 +138,9 @@ Polymer({
computeDockedSidebar: function (hass) {
return hass.dockedSidebar;
},
+
+ _computeSelected: function (routeData) {
+ return routeData.panel || 'states';
+ },
});
diff --git a/src/layouts/partial-cards.html b/src/layouts/partial-cards.html
index eee78357d5..51f5c8e89a 100644
--- a/src/layouts/partial-cards.html
+++ b/src/layouts/partial-cards.html
@@ -11,6 +11,7 @@
+
@@ -35,7 +36,12 @@
text-transform: uppercase;
}
-
+
@@ -49,24 +55,33 @@
scrollable
selected='[[currentView]]'
attr-for-selected='data-entity'
- on-iron-select='handleViewSelected'
+ on-iron-activate='handleViewSelected'
>
-
- [[locationName]]
-
-
-
-
-
-
- [[computeStateName(defaultView)]]
-
+
+ [[locationName]]
-
+
+
+
+
+
+ [[computeStateName(defaultView)]]
+
+
+
0 ? 'Home Assistant' : locationName;
},
@@ -276,12 +305,6 @@ Polymer({
},
hassChanged: function (hass) {
- var newView = hass.currentView || '';
-
- if (newView !== this.currentView) {
- this.currentView = newView;
- }
-
var views = window.HAWS.extractViews(hass.states);
// If default view present, it's in first index.
if (views.length > 0 && views[0].entity_id === this.DEFAULT_VIEW_ENTITY_ID) {
diff --git a/src/layouts/partial-panel-resolver.html b/src/layouts/partial-panel-resolver.html
index 1087b8c59a..f24f27ac31 100644
--- a/src/layouts/partial-panel-resolver.html
+++ b/src/layouts/partial-panel-resolver.html
@@ -1,4 +1,5 @@
+
@@ -9,6 +10,12 @@
display: none !important;
}
+
diff --git a/src/util/ha-url-sync.html b/src/util/ha-url-sync.html
index e38ce67d4e..3d5510f332 100644
--- a/src/util/ha-url-sync.html
+++ b/src/util/ha-url-sync.html
@@ -1,19 +1,7 @@