This repository was archived by the owner on Nov 6, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 6 files changed +38
-0
lines changed
src/packages/templating/templates Expand file tree Collapse file tree 6 files changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ export const UMB_TEMPLATE_ALLOW_DELETE_ACTION_CONDITION_ALIAS = 'Umb.Condition.Template.AllowDeleteAction' ;
Original file line number Diff line number Diff line change 1+ import { UMB_TEMPLATE_ALLOW_DELETE_ACTION_CONDITION_ALIAS } from './const.js' ;
2+
3+ export const manifest : UmbExtensionManifest = {
4+ type : 'condition' ,
5+ name : 'Template Allow Delete Action Condition' ,
6+ alias : UMB_TEMPLATE_ALLOW_DELETE_ACTION_CONDITION_ALIAS ,
7+ api : ( ) => import ( './template-allow-delete-action.condition.js' ) ,
8+ } ;
Original file line number Diff line number Diff line change 1+ import { UmbConditionBase } from '@umbraco-cms/backoffice/extension-registry' ;
2+ import { UMB_TREE_ITEM_CONTEXT } from '@umbraco-cms/backoffice/tree' ;
3+ import type { UmbConditionControllerArguments , UmbExtensionCondition } from '@umbraco-cms/backoffice/extension-api' ;
4+ import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api' ;
5+
6+ export class UmbTemplateAllowDeleteActionCondition extends UmbConditionBase < never > implements UmbExtensionCondition {
7+ constructor ( host : UmbControllerHost , args : UmbConditionControllerArguments < never > ) {
8+ super ( host , args ) ;
9+
10+ this . consumeContext ( UMB_TREE_ITEM_CONTEXT , ( context ) => {
11+ this . observe (
12+ context . hasChildren ,
13+ ( hasChildren ) => {
14+ this . permitted = hasChildren === false ;
15+ } ,
16+ '_templateAllowDeleteActionCondition' ,
17+ ) ;
18+ } ) ;
19+ }
20+ }
21+
22+ export { UmbTemplateAllowDeleteActionCondition as api } ;
Original file line number Diff line number Diff line change 1+ import { manifest as templateAllowDeleteActionCondition } from './allow-delete/manifest.js' ;
2+
3+ export const manifests : Array < UmbExtensionManifest > = [ templateAllowDeleteActionCondition ] ;
Original file line number Diff line number Diff line change 11import { UMB_TEMPLATE_DETAIL_REPOSITORY_ALIAS , UMB_TEMPLATE_ITEM_REPOSITORY_ALIAS } from '../repository/index.js' ;
22import { UMB_TEMPLATE_ENTITY_TYPE , UMB_TEMPLATE_ROOT_ENTITY_TYPE } from '../entity.js' ;
3+ import { UMB_TEMPLATE_ALLOW_DELETE_ACTION_CONDITION_ALIAS } from '../conditions/allow-delete/const.js' ;
34
45export const manifests : Array < UmbExtensionManifest > = [
56 {
@@ -26,5 +27,6 @@ export const manifests: Array<UmbExtensionManifest> = [
2627 detailRepositoryAlias : UMB_TEMPLATE_DETAIL_REPOSITORY_ALIAS ,
2728 itemRepositoryAlias : UMB_TEMPLATE_ITEM_REPOSITORY_ALIAS ,
2829 } ,
30+ conditions : [ { alias : UMB_TEMPLATE_ALLOW_DELETE_ACTION_CONDITION_ALIAS } ] ,
2931 } ,
3032] ;
Original file line number Diff line number Diff line change 1+ import { manifests as conditionsManifests } from './conditions/manifests.js' ;
12import { manifests as entityActionsManifests } from './entity-actions/manifests.js' ;
23import { manifests as menuManifests } from './menu/manifests.js' ;
34import { manifests as modalManifests } from './modals/manifests.js' ;
@@ -7,6 +8,7 @@ import { manifests as treeManifests } from './tree/manifests.js';
78import { manifests as workspaceManifests } from './workspace/manifests.js' ;
89
910export const manifests : Array < UmbExtensionManifest > = [
11+ ...conditionsManifests ,
1012 ...entityActionsManifests ,
1113 ...menuManifests ,
1214 ...modalManifests ,
You can’t perform that action at this time.
0 commit comments