From e398b3adea98c659dd2d8294fc1ef3585ce5f2ee Mon Sep 17 00:00:00 2001 From: leekelleher Date: Wed, 1 May 2024 09:27:49 +0100 Subject: [PATCH] Replaced hardcoded edit path with constant helper --- .../views/grid/document-grid-collection-view.element.ts | 7 +++++-- .../views/table/document-table-collection-view.element.ts | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/collection/views/grid/document-grid-collection-view.element.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/collection/views/grid/document-grid-collection-view.element.ts index fb55c39022..6781ebd2cd 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/collection/views/grid/document-grid-collection-view.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/collection/views/grid/document-grid-collection-view.element.ts @@ -1,4 +1,5 @@ import { getPropertyValueByAlias } from '../index.js'; +import { UMB_EDIT_DOCUMENT_WORKSPACE_PATH_PATTERN } from '../../../paths.js'; import type { UmbCollectionColumnConfiguration } from '../../../../../core/collection/types.js'; import type { UmbDocumentCollectionFilterModel, UmbDocumentCollectionItemModel } from '../../types.js'; import { css, customElement, html, nothing, repeat, state, when } from '@umbraco-cms/backoffice/external/lit'; @@ -75,10 +76,12 @@ export class UmbDocumentGridCollectionViewElement extends UmbLitElement { ); } - #onOpen(event: Event, id: string) { + #onOpen(event: Event, unique: string) { event.preventDefault(); event.stopPropagation(); - window.history.pushState(null, '', this._editDocumentPath + 'edit/' + id); + + const url = this._editDocumentPath + UMB_EDIT_DOCUMENT_WORKSPACE_PATH_PATTERN.generateLocal({ unique }); + window.history.pushState(null, '', url); } #onSelect(item: UmbDocumentCollectionItemModel) { diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/collection/views/table/document-table-collection-view.element.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/collection/views/table/document-table-collection-view.element.ts index 54683263d1..4b019ecd61 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/collection/views/table/document-table-collection-view.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/collection/views/table/document-table-collection-view.element.ts @@ -1,4 +1,5 @@ import { getPropertyValueByAlias } from '../index.js'; +import { UMB_EDIT_DOCUMENT_WORKSPACE_PATH_PATTERN } from '../../../paths.js'; import type { UmbCollectionColumnConfiguration } from '../../../../../core/collection/types.js'; import type { UmbDocumentCollectionItemModel } from '../../types.js'; import type { UmbDocumentCollectionContext } from '../../document-collection.context.js'; @@ -150,7 +151,8 @@ export class UmbDocumentTableCollectionViewElement extends UmbLitElement { const data = this._tableColumns?.map((column) => { const editPath = this.#routeBuilder - ? this.#routeBuilder({ entityType: item.entityType }) + `edit/${item.unique}` + ? this.#routeBuilder({ entityType: item.entityType }) + + UMB_EDIT_DOCUMENT_WORKSPACE_PATH_PATTERN.generateLocal({ unique: item.unique }) : ''; return {