add paths

This commit is contained in:
Mads Rasmussen
2024-09-30 19:34:19 +02:00
parent 61c4ceecde
commit e2eb731db1
5 changed files with 33 additions and 5 deletions

View File

@@ -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<UmbDictionaryCollectionModel>, languages: Array<UmbLanguageDetailModel>) {
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`<a
style="font-weight:bold"
href="section/dictionary/workspace/dictionary/edit/${dictionary.unique}">
${dictionary.name}</a
> `,
value: html`<a style="font-weight:bold" href=${editPath}> ${dictionary.name}</a> `,
},
...languages.map((language) => {
return {

View File

@@ -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';

View File

@@ -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);

View File

@@ -1 +1,2 @@
export * from './constants.js';
export * from './paths.js';

View File

@@ -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,
});