|
|
@ -110,7 +110,7 @@ export class WorkPackageAttachmentsController { |
|
|
|
// Reload the work package after attachments are uploaded to
|
|
|
|
// Reload the work package after attachments are uploaded to
|
|
|
|
// provide the correct links, in e.g., the description
|
|
|
|
// provide the correct links, in e.g., the description
|
|
|
|
this.wpCacheService.loadWorkPackage(<number> wp.id, true); |
|
|
|
this.wpCacheService.loadWorkPackage(<number> wp.id, true); |
|
|
|
}) |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -125,7 +125,7 @@ export class WorkPackageAttachmentsController { |
|
|
|
if (this.files.length > 0) { |
|
|
|
if (this.files.length > 0) { |
|
|
|
this.wpAttachments.upload(this.workPackage, this.files).then(() => { |
|
|
|
this.wpAttachments.upload(this.workPackage, this.files).then(() => { |
|
|
|
this.files = []; |
|
|
|
this.files = []; |
|
|
|
this.attachmentsChanged(); |
|
|
|
this.workPackage.updateAttachments(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
@ -146,7 +146,7 @@ export class WorkPackageAttachmentsController { |
|
|
|
if (!this.workPackage.isNew) { |
|
|
|
if (!this.workPackage.isNew) { |
|
|
|
if (file._type === 'Attachment') { |
|
|
|
if (file._type === 'Attachment') { |
|
|
|
file.delete() |
|
|
|
file.delete() |
|
|
|
.then(() => this.attachmentsChanged()) |
|
|
|
.then(() => this.workPackage.updateAttachments()) |
|
|
|
.catch(error => { |
|
|
|
.catch(error => { |
|
|
|
this.wpNotificationsService.handleErrorResponse(error, this.workPackage); |
|
|
|
this.wpNotificationsService.handleErrorResponse(error, this.workPackage); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -176,13 +176,6 @@ export class WorkPackageAttachmentsController { |
|
|
|
this.filterFiles(files); |
|
|
|
this.filterFiles(files); |
|
|
|
this.upload(); |
|
|
|
this.upload(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Update the work package links affected by attachments: activities and attachments themselves |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
protected attachmentsChanged() { |
|
|
|
|
|
|
|
this.workPackage.updateLinkedResources('attachments', 'activities'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function wpAttachmentsDirective():ng.IDirective { |
|
|
|
function wpAttachmentsDirective():ng.IDirective { |
|
|
|