Skip to content

Commit 1032789

Browse files
committed
add paths
1 parent d9e4b2e commit 1032789

File tree

5 files changed

+33
-5
lines changed

5 files changed

+33
-5
lines changed

src/packages/dictionary/collection/views/table/dictionary-table-collection-view.element.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { UmbDictionaryCollectionModel } from '../../types.js';
2+
import { UMB_EDIT_DICTIONARY_WORKSPACE_PATH_PATTERN } from '../../../paths.js';
23
import type { UmbDefaultCollectionContext } from '@umbraco-cms/backoffice/collection';
34
import { UMB_COLLECTION_CONTEXT } from '@umbraco-cms/backoffice/collection';
45
import type { UmbTableColumn, UmbTableConfig, UmbTableItem } from '@umbraco-cms/backoffice/components';
@@ -74,17 +75,17 @@ export class UmbDictionaryTableCollectionViewElement extends UmbLitElement {
7475

7576
#createTableItems(dictionaries: Array<UmbDictionaryCollectionModel>, languages: Array<UmbLanguageDetailModel>) {
7677
this._tableItems = dictionaries.map((dictionary) => {
78+
const editPath = UMB_EDIT_DICTIONARY_WORKSPACE_PATH_PATTERN.generateAbsolute({
79+
unique: dictionary.unique,
80+
});
81+
7782
return {
7883
id: dictionary.unique,
7984
icon: 'icon-book-alt-2',
8085
data: [
8186
{
8287
columnAlias: 'name',
83-
value: html`<a
84-
style="font-weight:bold"
85-
href="section/dictionary/workspace/dictionary/edit/${dictionary.unique}">
86-
${dictionary.name}</a
87-
> `,
88+
value: html`<a style="font-weight:bold" href=${editPath}> ${dictionary.name}</a> `,
8889
},
8990
...languages.map((language) => {
9091
return {

src/packages/dictionary/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ export * from './tree/index.js';
33
export * from './modals/dictionary-picker-modal.token.js';
44
export * from './entity.js';
55
export * from './components/index.js';
6+
export * from './paths.js';

src/packages/dictionary/paths.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { UMB_DICTIONARY_ENTITY_TYPE } from './entity.js';
2+
import { UmbPathPattern } from '@umbraco-cms/backoffice/router';
3+
import { UMB_TRANSLATION_SECTION_PATHNAME } from '@umbraco-cms/backoffice/translation';
4+
import { UMB_WORKSPACE_PATH_PATTERN } from '@umbraco-cms/backoffice/workspace';
5+
import type { UmbEntityModel, UmbEntityUnique } from '@umbraco-cms/backoffice/entity';
6+
7+
export const UMB_DICTIONARY_WORKSPACE_PATH = UMB_WORKSPACE_PATH_PATTERN.generateAbsolute({
8+
sectionName: UMB_TRANSLATION_SECTION_PATHNAME,
9+
entityType: UMB_DICTIONARY_ENTITY_TYPE,
10+
});
11+
12+
export const UMB_CREATE_DICTIONARY_WORKSPACE_PATH_PATTERN = new UmbPathPattern<{
13+
parentEntityType: UmbEntityModel['entityType'];
14+
parentUnique: UmbEntityUnique;
15+
}>('create/parent/:parentEntityType/:parentUnique', UMB_DICTIONARY_WORKSPACE_PATH);
16+
17+
export const UMB_EDIT_DICTIONARY_WORKSPACE_PATH_PATTERN = new UmbPathPattern<{
18+
unique: UmbEntityUnique;
19+
}>('edit/:unique', UMB_DICTIONARY_WORKSPACE_PATH);
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
export * from './constants.js';
2+
export * from './paths.js';
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { UMB_SECTION_PATH_PATTERN } from '@umbraco-cms/backoffice/section';
2+
3+
export const UMB_TRANSLATION_SECTION_PATHNAME = 'translation';
4+
export const UMB_TRANSLATION_SECTION_PATH = UMB_SECTION_PATH_PATTERN.generateAbsolute({
5+
sectionName: UMB_TRANSLATION_SECTION_PATHNAME,
6+
});

0 commit comments

Comments
 (0)