From 21194e373a289b529a0a98f70208c68a4c5a3d3c Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Thu, 28 Jul 2016 10:22:07 +0100 Subject: [PATCH] #484 add process actions for folder menus --- .../app/components/files/files.component.ts | 20 +++++++++++-------- .../src/models/content-action.model.ts | 14 +++++++++++++ 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/demo-shell-ng2/app/components/files/files.component.ts b/demo-shell-ng2/app/components/files/files.component.ts index 6d3cac70b3..88783fba5f 100644 --- a/demo-shell-ng2/app/components/files/files.component.ts +++ b/demo-shell-ng2/app/components/files/files.component.ts @@ -21,7 +21,9 @@ import { DOCUMENT_LIST_PROVIDERS, DocumentActionsService, DocumentList, - ContentActionModel, ContentActionHandler + ContentActionHandler, + DocumentActionModel, + FolderActionModel } from 'ng2-alfresco-documentlist'; import { MDL, @@ -129,14 +131,16 @@ export class FilesComponent implements OnInit { private setupBpmActions(actions: any[]) { actions.map(def => { - let action = new ContentActionModel(); - action.target = 'document'; - action.title = 'Activiti: ' + (def.name || 'Unknown process'); - action.handler = this.getBpmActionHandler(def); - this.documentList.actions.push(action); - }); + let documentAction = new DocumentActionModel(); + documentAction.title = 'Activiti: ' + (def.name || 'Unknown process'); + documentAction.handler = this.getBpmActionHandler(def); + this.documentList.actions.push(documentAction); - console.log(this.documentList.actions); + let folderAction = new FolderActionModel(); + folderAction.title = 'Activiti: ' + (def.name || 'Unknown process'); + folderAction.handler = this.getBpmActionHandler(def); + this.documentList.actions.push(folderAction); + }); } private getBpmActionHandler(processDefinition: any): ContentActionHandler { diff --git a/ng2-components/ng2-alfresco-documentlist/src/models/content-action.model.ts b/ng2-components/ng2-alfresco-documentlist/src/models/content-action.model.ts index fa568c8091..bf0a958f77 100644 --- a/ng2-components/ng2-alfresco-documentlist/src/models/content-action.model.ts +++ b/ng2-components/ng2-alfresco-documentlist/src/models/content-action.model.ts @@ -34,3 +34,17 @@ export class ContentActionModel { export interface ContentActionHandler { (obj: any, target?: any): any; } + +export class DocumentActionModel extends ContentActionModel { + constructor(json?: any) { + super(json); + this.target = 'document'; + } +} + +export class FolderActionModel extends ContentActionModel { + constructor(json?: any) { + super(json); + this.target = 'folder'; + } +}