mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-28 11:46:42 +00:00
Slugify title for url (#5621)
This commit is contained in:
parent
bf888b1547
commit
db2dab8227
@ -11,6 +11,7 @@ import {
|
|||||||
import { createCloseHeading } from "../../../../components/ha-dialog";
|
import { createCloseHeading } from "../../../../components/ha-dialog";
|
||||||
import "../../../../components/ha-icon-input";
|
import "../../../../components/ha-icon-input";
|
||||||
import { HaSwitch } from "../../../../components/ha-switch";
|
import { HaSwitch } from "../../../../components/ha-switch";
|
||||||
|
import { slugify } from "../../../../common/string/slugify";
|
||||||
import {
|
import {
|
||||||
LovelaceDashboard,
|
LovelaceDashboard,
|
||||||
LovelaceDashboardCreateParams,
|
LovelaceDashboardCreateParams,
|
||||||
@ -230,10 +231,11 @@ export class DialogLovelaceDashboardDetail extends LitElement {
|
|||||||
if ((this.hass.userData?.showAdvanced && this._urlPath) || !this._title) {
|
if ((this.hass.userData?.showAdvanced && this._urlPath) || !this._title) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const parts = this._title.toLowerCase().split(" ");
|
|
||||||
|
|
||||||
this._urlPath =
|
const slugifyTitle = slugify(this._title);
|
||||||
parts.length === 1 ? `lovelace-${parts[0]}` : parts.join("_");
|
this._urlPath = slugifyTitle.includes("-")
|
||||||
|
? slugifyTitle
|
||||||
|
: `lovelace-${slugifyTitle}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _showSidebarChanged(ev: Event) {
|
private _showSidebarChanged(ev: Event) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user