Skip to content
Snippets Groups Projects
Commit 5cfc9a14 authored by Lukas Mauß's avatar Lukas Mauß
Browse files

Add functionality to new dialog component

parent cc95b5f3
No related merge requests found
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) {
}
......
<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>
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);
}
}
......@@ -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>
......
......@@ -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);
}
......
......@@ -81,7 +81,8 @@ import { DeleteCommentComponent } from './_dialogs/delete-comment/delete-comment
LoginComponent,
StatisticHelpComponent,
CreateCommentComponent,
PresentCommentComponent
PresentCommentComponent,
DeleteCommentComponent
]
})
export class SharedModule {
......
......@@ -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",
......
......@@ -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",
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment