From 1af86b6fc5d601d9ff02b39396d2d2bec5d841d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Lyngs=C3=B8?= Date: Mon, 3 Jul 2023 13:33:47 +0200 Subject: [PATCH] Revert "use null instead of root." This reverts commit bd68faa7489697a004dfb09eab993f2be3a5001c. --- .../templates/entity-actions/create/create.action.ts | 2 +- .../templates/workspace/template-workspace.context.ts | 3 ++- .../templates/workspace/template-workspace.element.ts | 6 +++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/packages/templating/templates/entity-actions/create/create.action.ts b/src/Umbraco.Web.UI.Client/src/packages/templating/templates/entity-actions/create/create.action.ts index 4dc38218e1..41655e46d0 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/templating/templates/entity-actions/create/create.action.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/templating/templates/entity-actions/create/create.action.ts @@ -9,7 +9,7 @@ export class UmbCreateEntityAction }> extends // TODO: can we make this a generic create action async execute() { // TODO: get entity type from repository? - const url = `section/settings/workspace/template/create/${this.unique || 'null'}`; + const url = `section/settings/workspace/template/create/${this.unique || 'root'}`; // TODO: how do we handle this with a href? history.pushState(null, '', url); } diff --git a/src/Umbraco.Web.UI.Client/src/packages/templating/templates/workspace/template-workspace.context.ts b/src/Umbraco.Web.UI.Client/src/packages/templating/templates/workspace/template-workspace.context.ts index d63dd7404e..0837506049 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/templating/templates/workspace/template-workspace.context.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/templating/templates/workspace/template-workspace.context.ts @@ -148,6 +148,7 @@ ${currentContent}`; alias: template.alias, }); this.repository.requestTreeItemsOf(this.#masterTemplate.value?.id ?? ''); + } } @@ -156,7 +157,7 @@ ${currentContent}`; if (!data) return; this.setIsNew(true); this.#data.next({ ...data, id: '', name: '', alias: '', $type: 'TemplateResponseModel' }); - if (!parentId) return; + if (!parentId || parentId === 'root') return; await this.setMasterTemplate(parentId); } diff --git a/src/Umbraco.Web.UI.Client/src/packages/templating/templates/workspace/template-workspace.element.ts b/src/Umbraco.Web.UI.Client/src/packages/templating/templates/workspace/template-workspace.element.ts index e8cce0e4b0..953e780bb4 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/templating/templates/workspace/template-workspace.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/templating/templates/workspace/template-workspace.element.ts @@ -20,11 +20,11 @@ export class UmbTemplateWorkspaceElement extends UmbLitElement { @state() _routes: UmbRoute[] = [ { - path: 'create/:parentId', + path: 'create/:parentKey', component: () => this.#element, setup: (component: PageComponent, info: IRoutingInfo) => { - const parentId = info.match.params.parentId === 'null' ? null : info.match.params.parentId; - this.#templateWorkspaceContext.create(parentId); + const parentKey = info.match.params.parentKey; + this.#templateWorkspaceContext.create(parentKey); }, }, {