Replaced hardcoded edit path with constant helper
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user