Skip to content
Snippets Groups Projects
Commit 6b760cb0 authored by Mohammad Alayoub's avatar Mohammad Alayoub
Browse files

used the generic action buttons for the confirm dialog

parent 93771bad
Branches
Tags
No related merge requests found
......@@ -172,7 +172,7 @@ export class TopicCloudAdministrationComponent implements OnInit {
});
confirmDialogRef.afterClosed().subscribe(result => {
if (result === true) {
if (result === 'delete') {
this.deleteKeyword(keyword.keywordID);
}
});
......
<h2 mat-dialog-title>{{'topic-cloud-confirm-dialog.confirm' | translate}}</h2>
<h2 mat-dialog-title>{{'topic-cloud-confirm-dialog.sure' | translate}}</h2>
<mat-divider></mat-divider>
<p>{{'topic-cloud-confirm-dialog.will-be-deleted' | translate }} '{{data.topic}}'.</p>
<div mat-dialog-actions align="end">
<!-- <div mat-dialog-actions align="end">
<button class="primary" mat-raised-button [mat-dialog-close]="false">
{{'topic-cloud-confirm-dialog.cancel' | translate}}</button>
<button class="warn" mat-raised-button [mat-dialog-close]="true">
{{'topic-cloud-confirm-dialog.delete' | translate}}
</button>
</div>
</div> -->
<app-dialog-action-buttons
buttonsLabelSection="topic-cloud-confirm-dialog"
confirmButtonLabel="delete"
[confirmButtonType]=confirmButtonType
[cancelButtonClickAction]="buildCloseDialogActionCallback()"
[confirmButtonClickAction]="buildDeleteAccountActionCallback()"
></app-dialog-action-buttons>
\ No newline at end of file
import { Component, Inject, OnInit } from '@angular/core';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { DialogConfirmActionButtonType } from '../../dialog/dialog-action-buttons/dialog-action-buttons.component';
import { TranslateService } from '@ngx-translate/core';
@Component({
selector: 'app-topic-cloud-confirm-dialog',
......@@ -8,8 +10,11 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
})
export class TopicCloudConfirmDialogComponent implements OnInit {
confirmButtonType: DialogConfirmActionButtonType = DialogConfirmActionButtonType.Alert;
constructor(
public confirmDialogRef: MatDialogRef<TopicCloudConfirmDialogComponent>,
private translationService: TranslateService,
@Inject(MAT_DIALOG_DATA) public data: DialogData) { }
ngOnInit(): void {
......@@ -19,6 +24,23 @@ export class TopicCloudConfirmDialogComponent implements OnInit {
this.confirmDialogRef.close();
}
close(type: string): void {
this.confirmDialogRef.close(type);
}
/**
* Returns a lambda which closes the dialog on call.
*/
buildCloseDialogActionCallback(): () => void {
return () => this.close('abort');
}
/**
* Returns a lambda which executes the dialog dedicated action on call.
*/
buildDeleteAccountActionCallback(): () => void {
return () => this.close('delete');
}
}
export interface DialogData {
......
......@@ -232,7 +232,7 @@
"topic-cloud-confirm-dialog": {
"cancel": "Abbrechen",
"delete": "Löschen",
"confirm": "Sind Sie sicher?",
"sure": "Sind Sie sicher?",
"will-be-deleted": "Thema wird gelöscht"
},
"dialog-comment": {
......
......@@ -240,7 +240,7 @@
"topic-cloud-confirm-dialog":{
"cancel": "Cancel",
"delete": "Delete",
"confirm": "Are you sure?",
"sure": "Are you sure?",
"will-be-deleted": "Topic will be deleted"
},
"dialog-comment":{
......
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