make url friendly unique for file system tree items

This commit is contained in:
Mads Rasmussen
2023-03-24 13:12:48 +01:00
parent 9e624f3d49
commit 5b7e85423c

View File

@@ -1,10 +1,15 @@
import { UmbTreeItemContextBase } from '../tree-item-base/tree-item-base.context';
import { UmbControllerHostInterface } from '@umbraco-cms/backoffice/controller';
import { FileSystemTreeItemPresentationModel } from '@umbraco-cms/backoffice/backend-api';
import { urlFriendlyPathFromServerPath } from 'src/backoffice/templating/utils';
// TODO get unique method from an entity repository static method
export class UmbFileSystemTreeItemContext extends UmbTreeItemContextBase<FileSystemTreeItemPresentationModel> {
constructor(host: UmbControllerHostInterface, treeItem: FileSystemTreeItemPresentationModel) {
super(host, treeItem, (x: FileSystemTreeItemPresentationModel) => x.path);
}
constructPath(pathname: string, entityType: string, path: string) {
return `section/${pathname}/workspace/${entityType}/edit/${urlFriendlyPathFromServerPath(path)}`;
}
}