diff --git a/src/app/common/file-downloader/file-downloader.service.ts b/src/app/common/file-downloader/file-downloader.service.ts index ba49cd64d..f37330e4a 100644 --- a/src/app/common/file-downloader/file-downloader.service.ts +++ b/src/app/common/file-downloader/file-downloader.service.ts @@ -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}`); diff --git a/src/app/common/modals/comments-modal/comments-modal.coffee b/src/app/common/modals/comments-modal/comments-modal.coffee deleted file mode 100644 index 7ecd247bb..000000000 --- a/src/app/common/modals/comments-modal/comments-modal.coffee +++ /dev/null @@ -1,32 +0,0 @@ -angular.module("doubtfire.common.modals.comments-modal", []) -# -# Modal to contain an image used in user comments. -# -.factory("CommentsModal", ($modal) -> - CommentsModal = {} - CommentsModal.show = (commentResourceUrl, commentType) -> - $modal.open - templateUrl: 'common/modals/comments-modal/comments-modal.tpl.html' - controller: 'CommentsModalCtrl' - size: 'lg' - resolve: - commentResourceUrl: -> commentResourceUrl - commentType: -> commentType - CommentsModal -) -.controller("CommentsModalCtrl", ($scope, $modalInstance, $sce, commentResourceUrl, commentType, alertService, fileDownloaderService) -> - # $scope.commentResourceUrl = $sce.trustAsResourceUrl(commentResourceUrl) - $scope.commentType = commentType - $scope.close = -> - fileDownloaderService.releaseBlob($scope.rawResourceUrl) - $modalInstance.dismiss() - - fileDownloaderService.downloadBlob( - commentResourceUrl, - (url, response) -> - $scope.rawResourceUrl = url - $scope.commentResourceUrl = $sce.trustAsResourceUrl(url) - (error) -> - alertService.add('danger', "Error downloading comment: #{error}") - ) -) diff --git a/src/app/common/modals/comments-modal/comments-modal.component.html b/src/app/common/modals/comments-modal/comments-modal.component.html new file mode 100644 index 000000000..bd302b689 --- /dev/null +++ b/src/app/common/modals/comments-modal/comments-modal.component.html @@ -0,0 +1,10 @@ + \ No newline at end of file diff --git a/src/app/common/modals/comments-modal/comments-modal.component.scss b/src/app/common/modals/comments-modal/comments-modal.component.scss new file mode 100644 index 000000000..ea07f249e --- /dev/null +++ b/src/app/common/modals/comments-modal/comments-modal.component.scss @@ -0,0 +1,15 @@ +.modal-comment { + .image-comment { + width: 100%; + height: 100%; + align-content: center; + border-radius: 5px; + padding: 0; + border: none; + } + .pdf-comment { + width: 100%; + height: 80vh; + align-content: center; + } + } \ No newline at end of file diff --git a/src/app/common/modals/comments-modal/comments-modal.component.ts b/src/app/common/modals/comments-modal/comments-modal.component.ts new file mode 100644 index 000000000..07f855a35 --- /dev/null +++ b/src/app/common/modals/comments-modal/comments-modal.component.ts @@ -0,0 +1,23 @@ +import { Component, OnInit, Input, Inject} from '@angular/core'; +import { alertService } from 'src/app/ajs-upgraded-providers'; +import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; + +@Component({ + selector: 'comments-modal', + templateUrl: './comments-modal.component.html', + styleUrls: ['./comments-modal.component.scss'], +}) +export class CommentsModalComponent implements OnInit { + @Input() commentResourceUrl: string; + @Input() commentType: string; + + constructor( + @Inject(alertService) private alertService: any, + public dialogRef: MatDialogRef, + @Inject(MAT_DIALOG_DATA) public data: any, + ) {} + + ngOnInit(): void { + console.log('comments-model ngOnInit()'); + } +} \ No newline at end of file diff --git a/src/app/common/modals/comments-modal/comments-modal.scss b/src/app/common/modals/comments-modal/comments-modal.scss deleted file mode 100644 index 22ccacf4f..000000000 --- a/src/app/common/modals/comments-modal/comments-modal.scss +++ /dev/null @@ -1,15 +0,0 @@ -.modal-comment { - .image-comment { - width: 100%; - height: 100%; - align-content: center; - border-radius: 5px; - padding: 0; - border: none; - } - .pdf-comment { - width: 100%; - height: 80vh; - align-content: center; - } -} \ No newline at end of file diff --git a/src/app/common/modals/comments-modal/comments-modal.service.ts b/src/app/common/modals/comments-modal/comments-modal.service.ts new file mode 100644 index 000000000..657a54bc6 --- /dev/null +++ b/src/app/common/modals/comments-modal/comments-modal.service.ts @@ -0,0 +1,18 @@ +import { Injectable } from '@angular/core'; +import { MatDialogRef, MAT_DIALOG_DATA, MatDialog } from '@angular/material/dialog'; +import { CommentsModalComponent } from './comments-modal.component'; + +@Injectable({ + providedIn: 'root', +}) +export class CommentsModalService { + constructor(public dialog: MatDialog) {} + + public show(commentResourceUrl: string, commentType: string) { + let dialogRef: MatDialogRef; + dialogRef = this.dialog.open(CommentsModalComponent); + dialogRef.updateSize('100%', '100%'); + dialogRef.componentInstance.commentResourceUrl = commentResourceUrl; + dialogRef.componentInstance.commentType = commentType; + } +} \ No newline at end of file diff --git a/src/app/common/modals/comments-modal/comments-modal.tpl.html b/src/app/common/modals/comments-modal/comments-modal.tpl.html deleted file mode 100644 index 59985945f..000000000 --- a/src/app/common/modals/comments-modal/comments-modal.tpl.html +++ /dev/null @@ -1,10 +0,0 @@ -