attachment list component modifyable by plugin

pull/6940/head
Jens Ulferts 6 years ago
parent 6d611a9019
commit 881a62bb77
No known key found for this signature in database
GPG Key ID: 3CAA4B1182CF5308
  1. 6
      frontend/src/app/components/work-packages/wp-single-view/wp-single-view.component.ts
  2. 6
      frontend/src/app/components/work-packages/wp-single-view/wp-single-view.html
  3. 3
      frontend/src/app/modules/attachments/openproject-attachments.module.ts
  4. 5
      frontend/src/app/modules/work_packages/openproject-work-packages.module.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.

@ -118,7 +118,11 @@
</div>
</div>
<attachment-list [resource]="workPackage" [selfDestroy]="true"></attachment-list>
<ndc-dynamic [ndcDynamicComponent]="attachmentListComponent()"
[ndcDynamicInputs]="{ resource: workPackage,
selfDestroy: true }">
</ndc-dynamic>
<ndc-dynamic [ndcDynamicComponent]="attachmentUploadComponent()"
[ndcDynamicInputs]="{ resource: workPackage }">
</ndc-dynamic>

@ -46,7 +46,8 @@ import {AttachmentsUploadComponent} from "core-app/modules/attachments/attachmen
],
entryComponents: [
AttachmentsComponent,
AttachmentsUploadComponent
AttachmentsUploadComponent,
AttachmentListComponent
],
exports: [
AttachmentsUploadComponent,

@ -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;
});
};
}
}

Loading…
Cancel
Save