From e2eb731db19efaf20ec3a53bb540c8bf62451c5d Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Mon, 30 Sep 2024 19:34:19 +0200 Subject: [PATCH] add paths --- ...ictionary-table-collection-view.element.ts | 11 ++++++----- .../src/packages/dictionary/index.ts | 1 + .../src/packages/dictionary/paths.ts | 19 +++++++++++++++++++ .../src/packages/translation/section/index.ts | 1 + .../src/packages/translation/section/paths.ts | 6 ++++++ 5 files changed, 33 insertions(+), 5 deletions(-) create mode 100644 src/Umbraco.Web.UI.Client/src/packages/dictionary/paths.ts create mode 100644 src/Umbraco.Web.UI.Client/src/packages/translation/section/paths.ts diff --git a/src/Umbraco.Web.UI.Client/src/packages/dictionary/collection/views/table/dictionary-table-collection-view.element.ts b/src/Umbraco.Web.UI.Client/src/packages/dictionary/collection/views/table/dictionary-table-collection-view.element.ts index 1d692afb5f..5fd03c0e1c 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/dictionary/collection/views/table/dictionary-table-collection-view.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/dictionary/collection/views/table/dictionary-table-collection-view.element.ts @@ -1,4 +1,5 @@ import type { UmbDictionaryCollectionModel } from '../../types.js'; +import { UMB_EDIT_DICTIONARY_WORKSPACE_PATH_PATTERN } from '../../../paths.js'; import type { UmbDefaultCollectionContext } from '@umbraco-cms/backoffice/collection'; import { UMB_COLLECTION_CONTEXT } from '@umbraco-cms/backoffice/collection'; import type { UmbTableColumn, UmbTableConfig, UmbTableItem } from '@umbraco-cms/backoffice/components'; @@ -74,17 +75,17 @@ export class UmbDictionaryTableCollectionViewElement extends UmbLitElement { #createTableItems(dictionaries: Array, languages: Array) { this._tableItems = dictionaries.map((dictionary) => { + const editPath = UMB_EDIT_DICTIONARY_WORKSPACE_PATH_PATTERN.generateAbsolute({ + unique: dictionary.unique, + }); + return { id: dictionary.unique, icon: 'icon-book-alt-2', data: [ { columnAlias: 'name', - value: html` - ${dictionary.name} `, + value: html` ${dictionary.name} `, }, ...languages.map((language) => { return { diff --git a/src/Umbraco.Web.UI.Client/src/packages/dictionary/index.ts b/src/Umbraco.Web.UI.Client/src/packages/dictionary/index.ts index 5c7b94903c..696313ca04 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/dictionary/index.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/dictionary/index.ts @@ -3,3 +3,4 @@ export * from './tree/index.js'; export * from './modals/dictionary-picker-modal.token.js'; export * from './entity.js'; export * from './components/index.js'; +export * from './paths.js'; diff --git a/src/Umbraco.Web.UI.Client/src/packages/dictionary/paths.ts b/src/Umbraco.Web.UI.Client/src/packages/dictionary/paths.ts new file mode 100644 index 0000000000..7eb3abb18a --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/dictionary/paths.ts @@ -0,0 +1,19 @@ +import { UMB_DICTIONARY_ENTITY_TYPE } from './entity.js'; +import { UmbPathPattern } from '@umbraco-cms/backoffice/router'; +import { UMB_TRANSLATION_SECTION_PATHNAME } from '@umbraco-cms/backoffice/translation'; +import { UMB_WORKSPACE_PATH_PATTERN } from '@umbraco-cms/backoffice/workspace'; +import type { UmbEntityModel, UmbEntityUnique } from '@umbraco-cms/backoffice/entity'; + +export const UMB_DICTIONARY_WORKSPACE_PATH = UMB_WORKSPACE_PATH_PATTERN.generateAbsolute({ + sectionName: UMB_TRANSLATION_SECTION_PATHNAME, + entityType: UMB_DICTIONARY_ENTITY_TYPE, +}); + +export const UMB_CREATE_DICTIONARY_WORKSPACE_PATH_PATTERN = new UmbPathPattern<{ + parentEntityType: UmbEntityModel['entityType']; + parentUnique: UmbEntityUnique; +}>('create/parent/:parentEntityType/:parentUnique', UMB_DICTIONARY_WORKSPACE_PATH); + +export const UMB_EDIT_DICTIONARY_WORKSPACE_PATH_PATTERN = new UmbPathPattern<{ + unique: UmbEntityUnique; +}>('edit/:unique', UMB_DICTIONARY_WORKSPACE_PATH); diff --git a/src/Umbraco.Web.UI.Client/src/packages/translation/section/index.ts b/src/Umbraco.Web.UI.Client/src/packages/translation/section/index.ts index 4f07201dcf..14b140114e 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/translation/section/index.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/translation/section/index.ts @@ -1 +1,2 @@ export * from './constants.js'; +export * from './paths.js'; diff --git a/src/Umbraco.Web.UI.Client/src/packages/translation/section/paths.ts b/src/Umbraco.Web.UI.Client/src/packages/translation/section/paths.ts new file mode 100644 index 0000000000..7007c30aec --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/translation/section/paths.ts @@ -0,0 +1,6 @@ +import { UMB_SECTION_PATH_PATTERN } from '@umbraco-cms/backoffice/section'; + +export const UMB_TRANSLATION_SECTION_PATHNAME = 'translation'; +export const UMB_TRANSLATION_SECTION_PATH = UMB_SECTION_PATH_PATTERN.generateAbsolute({ + sectionName: UMB_TRANSLATION_SECTION_PATHNAME, +});