From 881a62bb77605b326bd76e52446ce243962f1867 Mon Sep 17 00:00:00 2001 From: Jens Ulferts Date: Thu, 13 Dec 2018 11:20:31 +0100 Subject: [PATCH] attachment list component modifyable by plugin --- .../wp-single-view/wp-single-view.component.ts | 6 ++++++ .../work-packages/wp-single-view/wp-single-view.html | 6 +++++- .../modules/attachments/openproject-attachments.module.ts | 3 ++- .../work_packages/openproject-work-packages.module.ts | 5 +++++ 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/components/work-packages/wp-single-view/wp-single-view.component.ts b/frontend/src/app/components/work-packages/wp-single-view/wp-single-view.component.ts index 054716d090..54c7b197b7 100644 --- a/frontend/src/app/components/work-packages/wp-single-view/wp-single-view.component.ts +++ b/frontend/src/app/components/work-packages/wp-single-view/wp-single-view.component.ts @@ -203,6 +203,12 @@ export class WorkPackageSingleViewComponent implements OnInit, OnDestroy { return this.hook.call('attributeGroupComponent', group, this.workPackage).pop() || null; } + public attachmentListComponent() { + // we take the last registered group component which means that + // plugins will have their say if they register for it. + return this.hook.call('workPackageAttachmentListComponent', this.workPackage).pop() || null; + } + public attachmentUploadComponent() { // we take the last registered group component which means that // plugins will have their say if they register for it. diff --git a/frontend/src/app/components/work-packages/wp-single-view/wp-single-view.html b/frontend/src/app/components/work-packages/wp-single-view/wp-single-view.html index f1e2628d76..71129e9b61 100644 --- a/frontend/src/app/components/work-packages/wp-single-view/wp-single-view.html +++ b/frontend/src/app/components/work-packages/wp-single-view/wp-single-view.html @@ -118,7 +118,11 @@ - + + + diff --git a/frontend/src/app/modules/attachments/openproject-attachments.module.ts b/frontend/src/app/modules/attachments/openproject-attachments.module.ts index ff99101e04..c8cf526f6b 100644 --- a/frontend/src/app/modules/attachments/openproject-attachments.module.ts +++ b/frontend/src/app/modules/attachments/openproject-attachments.module.ts @@ -46,7 +46,8 @@ import {AttachmentsUploadComponent} from "core-app/modules/attachments/attachmen ], entryComponents: [ AttachmentsComponent, - AttachmentsUploadComponent + AttachmentsUploadComponent, + AttachmentListComponent ], exports: [ AttachmentsUploadComponent, diff --git a/frontend/src/app/modules/work_packages/openproject-work-packages.module.ts b/frontend/src/app/modules/work_packages/openproject-work-packages.module.ts index 04227f3f75..6434b4ab7c 100644 --- a/frontend/src/app/modules/work_packages/openproject-work-packages.module.ts +++ b/frontend/src/app/modules/work_packages/openproject-work-packages.module.ts @@ -185,6 +185,7 @@ import {WorkPackagesListComponent} from "core-app/modules/work_packages/routing/ import {WorkPackageSplitViewComponent} from "core-app/modules/work_packages/routing/wp-split-view/wp-split-view.component"; import {WorkPackagesFullViewComponent} from "core-app/modules/work_packages/routing/wp-full-view/wp-full-view.component"; import {AttachmentsUploadComponent} from 'core-app/modules/attachments/attachments-upload/attachments-upload.component'; +import {AttachmentListComponent} from 'core-app/modules/attachments/attachment-list/attachment-list.component'; @NgModule({ imports: [ @@ -529,6 +530,10 @@ export class OpenprojectWorkPackagesModule { hookService.register('workPackageAttachmentUploadComponent', (workPackage:WorkPackageResource) => { return AttachmentsUploadComponent; }); + + hookService.register('workPackageAttachmentListComponent', (workPackage:WorkPackageResource) => { + return AttachmentListComponent; + }); }; } }