determine if tree item is folder, add actions to folder and root items
This commit is contained in:
@@ -13,6 +13,12 @@ export class UmbFileSystemTreeItemContext extends UmbTreeItemContextBase<FileSys
|
||||
super(host, (x: FileSystemTreeItemPresentationModel) => x.path);
|
||||
}
|
||||
|
||||
checkIfIsFolder() {
|
||||
if (this.getTreeItem()?.isFolder) {
|
||||
this.type = `${this.getTreeItem()?.type}-folder`;
|
||||
}
|
||||
}
|
||||
|
||||
constructPath(pathname: string, entityType: string, path: string) {
|
||||
return `section/${pathname}/workspace/${entityType}/edit/${encodeURIComponent(path).replace('.', '-')}`;
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ export class UmbFileSystemTreeItemElement extends UmbLitElement implements UmbTr
|
||||
public set item(value: FileSystemTreeItemPresentationModel | undefined) {
|
||||
this._item = value;
|
||||
this.#context.setTreeItem(value);
|
||||
this.#context.checkIfIsFolder();
|
||||
}
|
||||
|
||||
#context = new UmbFileSystemTreeItemContext(this);
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
import { PARTIAL_VIEW_ENTITY_TYPE, PARTIAL_VIEW_FOLDER_ENTITY_TYPE, PARTIAL_VIEW_REPOSITORY_ALIAS } from '../config.js';
|
||||
import {
|
||||
PARTIAL_VIEW_ENTITY_TYPE,
|
||||
PARTIAL_VIEW_FOLDER_ENTITY_TYPE,
|
||||
PARTIAL_VIEW_REPOSITORY_ALIAS,
|
||||
PARTIAL_VIEW_ROOT_ENTITY_TYPE,
|
||||
} from '../config.js';
|
||||
import { UmbCreateFromSnippetPartialViewAction } from './create/create-from-snippet.action.js';
|
||||
import { UmbCreateEmptyPartialViewAction } from './create/create-empty.action.js';
|
||||
import { UmbDeleteEntityAction } from '@umbraco-cms/backoffice/entity-action';
|
||||
@@ -38,7 +43,7 @@ const partialViewFolderActions: Array<ManifestEntityAction> = [
|
||||
repositoryAlias: PARTIAL_VIEW_REPOSITORY_ALIAS,
|
||||
},
|
||||
conditions: {
|
||||
entityTypes: [PARTIAL_VIEW_FOLDER_ENTITY_TYPE],
|
||||
entityTypes: [PARTIAL_VIEW_FOLDER_ENTITY_TYPE, PARTIAL_VIEW_ROOT_ENTITY_TYPE],
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -52,7 +57,7 @@ const partialViewFolderActions: Array<ManifestEntityAction> = [
|
||||
repositoryAlias: PARTIAL_VIEW_REPOSITORY_ALIAS,
|
||||
},
|
||||
conditions: {
|
||||
entityTypes: [PARTIAL_VIEW_FOLDER_ENTITY_TYPE],
|
||||
entityTypes: [PARTIAL_VIEW_FOLDER_ENTITY_TYPE, PARTIAL_VIEW_ROOT_ENTITY_TYPE],
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user