Skip to content

Commit

Permalink
refactor: migrate the comments-modal - update functions in TypeScript…
Browse files Browse the repository at this point in the history
… files
  • Loading branch information
s223749059 committed Apr 4, 2024
1 parent 53f10d6 commit b37b725
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/app/common/file-downloader/file-downloader.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ export class FileDownloaderService {

downloadLink.click();
downloadLink.parentNode.removeChild(downloadLink);

this.alerts.add('info', 'File downloaded.', 3000);
},
(error: any) => {
this.alerts.add('danger', `Error downloading file - ${error}`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,12 @@ export class PdfImageCommentComponent implements OnInit, OnDestroy {
}

public openCommentsModal() {
if (this.resourceUrl) {
if (this.comment.commentType == 'image') {
this.commentsModalRef.show(this.resourceUrl, this.comment.commentType);
} else {
this.downloadCommentResource(this.openCommentsModal.bind(this));
if (this.comment.commentType === 'pdf') {
this.fileDownloaderService.downloadFile(this.comment.attachmentUrl, "view.pdf");
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,10 @@ export class TaskCommentsViewerComponent implements OnChanges, OnInit {
document.querySelector(`#comment-${commentID}`).scrollIntoView();
}

openCommentsModal(comment: TaskComment) {
/*openCommentsModal(comment: TaskComment) {
const resourceUrl = comment.attachmentUrl;
this.commentsModalRef.show(resourceUrl, comment.commentType);
}
}*/

shouldShowAuthorIcon(commentType: string) {
return !(commentType === 'extension' || commentType === 'status' || commentType == 'assessment');
Expand Down

0 comments on commit b37b725

Please sign in to comment.