mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-18 23:06:40 +00:00
Unify navigation to NavigateMixin (#1095)
* Unify page navigation to NavigateMixin * revert unintended change * Use template literal
This commit is contained in:
parent
a2ec19e10f
commit
5dc9efd995
@ -45,7 +45,7 @@
|
||||
</dom-module>
|
||||
|
||||
<script>
|
||||
class HassioAddonRepository extends window.hassMixins.EventsMixin(Polymer.Element) {
|
||||
class HassioAddonRepository extends window.hassMixins.NavigateMixin(Polymer.Element) {
|
||||
static get is() { return 'hassio-addon-repository'; }
|
||||
|
||||
static get properties() {
|
||||
@ -74,8 +74,7 @@ class HassioAddonRepository extends window.hassMixins.EventsMixin(Polymer.Elemen
|
||||
}
|
||||
|
||||
addonTapped(ev) {
|
||||
history.pushState(null, null, '/hassio/addon/' + ev.model.addon.slug);
|
||||
this.fire('location-changed');
|
||||
this.navigate(`/hassio/addon/${ev.model.addon.slug}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@
|
||||
</dom-module>
|
||||
|
||||
<script>
|
||||
class HassioAddons extends window.hassMixins.EventsMixin(Polymer.Element) {
|
||||
class HassioAddons extends window.hassMixins.NavigateMixin(Polymer.Element) {
|
||||
static get is() { return 'hassio-addons'; }
|
||||
|
||||
static get properties() {
|
||||
@ -68,14 +68,12 @@ class HassioAddons extends window.hassMixins.EventsMixin(Polymer.Element) {
|
||||
}
|
||||
|
||||
addonTapped(ev) {
|
||||
history.pushState(null, null, '/hassio/addon/' + ev.model.addon.slug);
|
||||
this.fire('location-changed');
|
||||
this.navigate('/hassio/addon/' + ev.model.addon.slug);
|
||||
ev.target.blur();
|
||||
}
|
||||
|
||||
openStore(ev) {
|
||||
history.pushState(null, null, '/hassio/store');
|
||||
this.fire('location-changed');
|
||||
this.navigate('/hassio/store');
|
||||
ev.target.blur();
|
||||
}
|
||||
}
|
||||
|
@ -99,7 +99,7 @@
|
||||
* @appliesMixin window.hassMixins.EventsMixin
|
||||
*/
|
||||
class HaAutomationPicker extends
|
||||
window.hassMixins.LocalizeMixin(window.hassMixins.EventsMixin(Polymer.Element)) {
|
||||
window.hassMixins.LocalizeMixin(window.hassMixins.NavigateMixin(Polymer.Element)) {
|
||||
static get is() { return 'ha-automation-picker'; }
|
||||
|
||||
static get properties() {
|
||||
@ -128,13 +128,11 @@ class HaAutomationPicker extends
|
||||
}
|
||||
|
||||
automationTapped(ev) {
|
||||
history.pushState(null, null, '/config/automation/edit/' + this.automations[ev.model.index].attributes.id);
|
||||
this.fire('location-changed');
|
||||
this.navigate('/config/automation/edit/' + this.automations[ev.model.index].attributes.id);
|
||||
}
|
||||
|
||||
addAutomation() {
|
||||
history.pushState(null, null, '/config/automation/new');
|
||||
this.fire('location-changed');
|
||||
this.navigate('/config/automation/new');
|
||||
}
|
||||
|
||||
computeName(automation) {
|
||||
|
@ -43,7 +43,7 @@
|
||||
* @appliesMixin window.hassMixins.EventsMixin
|
||||
*/
|
||||
class HaConfigNavigation extends
|
||||
window.hassMixins.LocalizeMixin(window.hassMixins.EventsMixin(Polymer.Element)) {
|
||||
window.hassMixins.LocalizeMixin(window.hassMixins.NavigateMixin(Polymer.Element)) {
|
||||
static get is() { return 'ha-config-navigation'; }
|
||||
|
||||
static get properties() {
|
||||
@ -78,8 +78,7 @@
|
||||
}
|
||||
|
||||
_navigate(ev) {
|
||||
history.pushState(null, null, '/config/' + ev.model.item);
|
||||
this.fire('location-changed');
|
||||
this.navigate('/config/' + ev.model.item);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@
|
||||
* @appliesMixin window.hassMixins.EventsMixin
|
||||
*/
|
||||
class HaScriptPicker extends
|
||||
window.hassMixins.LocalizeMixin(window.hassMixins.EventsMixin(Polymer.Element)) {
|
||||
window.hassMixins.LocalizeMixin(window.hassMixins.NavigateMixin(Polymer.Element)) {
|
||||
static get is() { return 'ha-script-picker'; }
|
||||
|
||||
static get properties() {
|
||||
@ -124,13 +124,11 @@ class HaScriptPicker extends
|
||||
}
|
||||
|
||||
scriptTapped(ev) {
|
||||
history.pushState(null, null, '/config/script/edit/' + this.scripts[ev.model.index].entity_id);
|
||||
this.fire('location-changed');
|
||||
this.navigate('/config/script/edit/' + this.scripts[ev.model.index].entity_id);
|
||||
}
|
||||
|
||||
addScript() {
|
||||
history.pushState(null, null, '/config/script/new');
|
||||
this.fire('location-changed');
|
||||
this.navigate('/config/script/new');
|
||||
}
|
||||
|
||||
computeName(script) {
|
||||
|
@ -160,7 +160,7 @@
|
||||
* @appliesMixin window.hassMixins.EventsMixin
|
||||
*/
|
||||
class HaSidebar extends
|
||||
window.hassMixins.LocalizeMixin(window.hassMixins.EventsMixin(Polymer.Element)) {
|
||||
window.hassMixins.LocalizeMixin(window.hassMixins.NavigateMixin(Polymer.Element)) {
|
||||
static get is() { return 'ha-sidebar'; }
|
||||
|
||||
static get properties() {
|
||||
@ -259,8 +259,7 @@ class HaSidebar extends
|
||||
if (path === document.location.pathname) {
|
||||
return;
|
||||
}
|
||||
history.pushState(null, null, path);
|
||||
this.fire('location-changed');
|
||||
this.navigate(path);
|
||||
}
|
||||
|
||||
handleLogOut() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user