mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-28 03:36:44 +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 "../../../../components/ha-icon-input";
|
||||
import { HaSwitch } from "../../../../components/ha-switch";
|
||||
import { slugify } from "../../../../common/string/slugify";
|
||||
import {
|
||||
LovelaceDashboard,
|
||||
LovelaceDashboardCreateParams,
|
||||
@ -230,10 +231,11 @@ export class DialogLovelaceDashboardDetail extends LitElement {
|
||||
if ((this.hass.userData?.showAdvanced && this._urlPath) || !this._title) {
|
||||
return;
|
||||
}
|
||||
const parts = this._title.toLowerCase().split(" ");
|
||||
|
||||
this._urlPath =
|
||||
parts.length === 1 ? `lovelace-${parts[0]}` : parts.join("_");
|
||||
const slugifyTitle = slugify(this._title);
|
||||
this._urlPath = slugifyTitle.includes("-")
|
||||
? slugifyTitle
|
||||
: `lovelace-${slugifyTitle}`;
|
||||
}
|
||||
|
||||
private _showSidebarChanged(ev: Event) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user