diff --git a/src/app/components/creator/_dialogs/room-delete/room-delete.component.ts b/src/app/components/creator/_dialogs/room-delete/room-delete.component.ts index 35b03c1e74bb83be00061ddf184a92bc0a47c175..347e0d56f05efd4749371de98449cffc24f97567 100644 --- a/src/app/components/creator/_dialogs/room-delete/room-delete.component.ts +++ b/src/app/components/creator/_dialogs/room-delete/room-delete.component.ts @@ -1,7 +1,7 @@ import { Component, Inject, OnInit } from '@angular/core'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material'; -import { RoomCreateComponent } from '../../../shared/_dialogs/room-create/room-create.component'; import { Room } from '../../../../models/room'; +import { RoomEditComponent } from '../room-edit/room-edit.component'; @Component({ selector: 'app-room-delete', @@ -11,7 +11,7 @@ import { Room } from '../../../../models/room'; export class RoomDeleteComponent implements OnInit { room: Room; - constructor( public dialogRef: MatDialogRef<RoomCreateComponent>, + constructor(public dialogRef: MatDialogRef<RoomEditComponent>, @Inject(MAT_DIALOG_DATA) public data: any) { } diff --git a/src/app/components/shared/_dialogs/delete-comment/delete-comment.component.html b/src/app/components/shared/_dialogs/delete-comment/delete-comment.component.html index 834b5d8e7dcb2637091e89804b885ad5bb84eed9..507aa32b9064e21e298f06fae87754c6ad8c7e10 100644 --- a/src/app/components/shared/_dialogs/delete-comment/delete-comment.component.html +++ b/src/app/components/shared/_dialogs/delete-comment/delete-comment.component.html @@ -1,3 +1,10 @@ -<p> - delete-comment works! -</p> +<h3>{{ 'room-page.sure' | translate }}</h3> +<p>{{ 'comment-page.really' | translate }}</p> +<div fxLayout="row" fxLayoutAlign="center" fxLayoutGap="10px"> + <button mat-raised-button color="primary" (click)="close('abort')"> + {{ 'content.abort' | translate }} + </button> + <button mat-raised-button color="warn" (click)="close('delete')"> + {{ 'content.delete' | translate }} + </button> +</div> diff --git a/src/app/components/shared/_dialogs/delete-comment/delete-comment.component.ts b/src/app/components/shared/_dialogs/delete-comment/delete-comment.component.ts index bb62152c9523b9ac863247d913a20b94302c1ec4..5ef4d2db61b903c17c30bad20608d0f600f6f62b 100644 --- a/src/app/components/shared/_dialogs/delete-comment/delete-comment.component.ts +++ b/src/app/components/shared/_dialogs/delete-comment/delete-comment.component.ts @@ -1,4 +1,6 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, Inject, OnInit } from '@angular/core'; +import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material'; +import { CommentListComponent } from '../../comment-list/comment-list.component'; @Component({ selector: 'app-delete-comment', @@ -7,9 +9,14 @@ import { Component, OnInit } from '@angular/core'; }) export class DeleteCommentComponent implements OnInit { - constructor() { } + constructor(public dialogRef: MatDialogRef<CommentListComponent>, + @Inject(MAT_DIALOG_DATA) public data: any) { } ngOnInit() { } + close(type: string): void { + this.dialogRef.close(type); + } + } diff --git a/src/app/components/shared/comment-list/comment-list.component.html b/src/app/components/shared/comment-list/comment-list.component.html index fdb59baaff69bfe4619b312e00df13de83266dcd..f485ff15a2e7de416a94538de0e9fb7d5055e3f1 100644 --- a/src/app/components/shared/comment-list/comment-list.component.html +++ b/src/app/components/shared/comment-list/comment-list.component.html @@ -49,7 +49,7 @@ <button mat-icon-button (focus)="hideCommentsList=false" (click)="sortTimeStamp()"> <mat-icon>remove</mat-icon> </button> - <button mat-icon-button *ngIf="userRole === 1" (focus)="hideCommentsList=false" (click)="deleteComments()"> + <button mat-icon-button *ngIf="userRole === 1" (focus)="hideCommentsList=false" (click)="openDeletionRoomDialog()"> <mat-icon color="warn">delete</mat-icon> </button> </div> diff --git a/src/app/components/shared/comment-list/comment-list.component.ts b/src/app/components/shared/comment-list/comment-list.component.ts index cb4e62089f42b925e4f7829dbd751950dd779b2d..07252e03cfef15ac7929811d73fc5c3d5eb3d9a3 100644 --- a/src/app/components/shared/comment-list/comment-list.component.ts +++ b/src/app/components/shared/comment-list/comment-list.component.ts @@ -13,6 +13,7 @@ import { AuthenticationService } from '../../../services/http/authentication.ser import { Room } from '../../../models/room'; import { RoomService } from '../../../services/http/room.service'; import { CommentExportComponent } from '../../creator/_dialogs/comment-export/comment-export.component'; +import { DeleteCommentComponent } from '../_dialogs/delete-comment/delete-comment.component'; @Component({ selector: 'app-comment-list', @@ -157,6 +158,18 @@ export class CommentListComponent implements OnInit { }); } + openDeletionRoomDialog(): void { + const dialogRef = this.dialog.open(DeleteCommentComponent, { + width: '400px' + }); + dialogRef.afterClosed() + .subscribe(result => { + if (result === 'delete') { + this.deleteComments(); + } + }); + } + send(comment: Comment): void { this.wsCommentService.add(comment); } diff --git a/src/app/components/shared/shared.module.ts b/src/app/components/shared/shared.module.ts index a36d768cf5dc6ab23239b8d67f2c26e4271f7bb7..a9794f95e51dab8d055ab39e69be14851b14b245 100644 --- a/src/app/components/shared/shared.module.ts +++ b/src/app/components/shared/shared.module.ts @@ -81,7 +81,8 @@ import { DeleteCommentComponent } from './_dialogs/delete-comment/delete-comment LoginComponent, StatisticHelpComponent, CreateCommentComponent, - PresentCommentComponent + PresentCommentComponent, + DeleteCommentComponent ] }) export class SharedModule { diff --git a/src/assets/i18n/creator/de.json b/src/assets/i18n/creator/de.json index 33ff55162314538d6e44f3c5c537f38b0bbf12b9..f8053c9b01c7760ee7d7997016b8f88c1c69e377 100644 --- a/src/assets/i18n/creator/de.json +++ b/src/assets/i18n/creator/de.json @@ -90,7 +90,8 @@ "delimiter": "Bitte wählen Sie ein Format!", "comma": "Microsoft Excel", "semicolon": "Standard CSV", - "export": "Exportieren" + "export": "Exportieren", + "really": "Wollen sie wirklich alle Kommentare dieser Session löschen?" }, "comment-list-page": { "search": "Suchen", diff --git a/src/assets/i18n/creator/en.json b/src/assets/i18n/creator/en.json index cc25158a4f28fd20ad4a0c2ffbed41a6aa8dbacb..9b4e87f108a3c15867d65ee8314a8c2a697f8c4e 100644 --- a/src/assets/i18n/creator/en.json +++ b/src/assets/i18n/creator/en.json @@ -90,7 +90,8 @@ "delimiter": "Please choose a format!", "comma": "Microsoft Excel", "semicolon": "Standard CSV", - "export": "Export" + "export": "Export", + "really": "Do you really want to delete all comments of this session?" }, "comment-list-page": { "search": "Search",