diff --git a/src/app/components/creator/_dialogs/bonus-delete/bonus-delete.component.html b/src/app/components/creator/_dialogs/bonus-delete/bonus-delete.component.html index a1dd80b05386de871d3083c2287ec891644ffe61..f4a72c073fa736bf85aa43cc7ca252ad83a7d5a1 100644 --- a/src/app/components/creator/_dialogs/bonus-delete/bonus-delete.component.html +++ b/src/app/components/creator/_dialogs/bonus-delete/bonus-delete.component.html @@ -1,6 +1,6 @@ <h1>{{ 'room-page.sure' | translate }}</h1> <mat-divider></mat-divider> -<p>{{ 'room-page.really-delete-comments' | translate }}</p> +<p>{{reallyDeleteText}}</p> <app-dialog-action-buttons buttonsLabelSection="content" confirmButtonLabel="delete" diff --git a/src/app/components/creator/_dialogs/bonus-delete/bonus-delete.component.scss b/src/app/components/creator/_dialogs/bonus-delete/bonus-delete.component.scss index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..38598a42d50ca42c7768bd03a7bbc60cd23aa3fb 100644 --- a/src/app/components/creator/_dialogs/bonus-delete/bonus-delete.component.scss +++ b/src/app/components/creator/_dialogs/bonus-delete/bonus-delete.component.scss @@ -0,0 +1,3 @@ +h1,h2,h3,p { + color: var(--on-surface); +} diff --git a/src/app/components/creator/_dialogs/bonus-delete/bonus-delete.component.ts b/src/app/components/creator/_dialogs/bonus-delete/bonus-delete.component.ts index 2fbda4c08434ed90318edd78c1edfcf04b9f0f09..b17e0c0ad7f592d76233335e6f134997c6fe2985 100644 --- a/src/app/components/creator/_dialogs/bonus-delete/bonus-delete.component.ts +++ b/src/app/components/creator/_dialogs/bonus-delete/bonus-delete.component.ts @@ -13,7 +13,8 @@ import { BonusTokenComponent } from '../bonus-token/bonus-token.component'; export class BonusDeleteComponent implements OnInit { confirmButtonType: DialogConfirmActionButtonType = DialogConfirmActionButtonType.Alert; - + multipleBonuses: boolean; + reallyDeleteText: string; constructor(public dialogRef: MatDialogRef<BonusTokenComponent>, @Inject(MAT_DIALOG_DATA) public data: any, @@ -22,9 +23,16 @@ export class BonusDeleteComponent implements OnInit { ngOnInit() { - this.translationService.get('room-page.really-delete-bonuses').subscribe(msg => { - this.liveAnnouncer.announce(msg); - }); + if (!this.multipleBonuses) { + this.translationService.get('room-page.really-delete-bonus').subscribe(msg => { + this.reallyDeleteText = msg; + }); + } else { + this.translationService.get('room-page.really-delete-bonuses').subscribe(msg => { + this.reallyDeleteText = msg; + }); + } + this.liveAnnouncer.announce(this.reallyDeleteText); } /** diff --git a/src/app/components/creator/_dialogs/bonus-token/bonus-token.component.html b/src/app/components/creator/_dialogs/bonus-token/bonus-token.component.html index 75e538eeac8e705037c2d4882abdd4f4bbcdad36..05ed912f67f70423ccd324837de6a052235846a3 100644 --- a/src/app/components/creator/_dialogs/bonus-token/bonus-token.component.html +++ b/src/app/components/creator/_dialogs/bonus-token/bonus-token.component.html @@ -7,7 +7,7 @@ {{bonusToken.token}} </h2> <span class="fill-remaining-space"></span> - <button mat-icon-button> + <button mat-icon-button (click)="openDeleteSingleBonusDialog(bonusToken.userId, bonusToken.commentId)"> <mat-icon>close</mat-icon> </button> </div> diff --git a/src/app/components/creator/_dialogs/bonus-token/bonus-token.component.scss b/src/app/components/creator/_dialogs/bonus-token/bonus-token.component.scss index 735efd776ac11b9e8f272745b9719c96e24a8994..a0c5e2f43baf773ce1a15572e32ba94c6c71cccc 100644 --- a/src/app/components/creator/_dialogs/bonus-token/bonus-token.component.scss +++ b/src/app/components/creator/_dialogs/bonus-token/bonus-token.component.scss @@ -1,4 +1,4 @@ -h1,h2,h3,h4,h5,p{ +h1,h2,h3 { color: var(--on-surface); } diff --git a/src/app/components/creator/_dialogs/bonus-token/bonus-token.component.ts b/src/app/components/creator/_dialogs/bonus-token/bonus-token.component.ts index f344c203b2d5f872d757df4317ff80baee30fd98..232ab36e24481676c0c05884f8ae4de33654b233 100644 --- a/src/app/components/creator/_dialogs/bonus-token/bonus-token.component.ts +++ b/src/app/components/creator/_dialogs/bonus-token/bonus-token.component.ts @@ -1,8 +1,9 @@ import { Component, OnInit } from '@angular/core'; import { BonusTokenService } from '../../../../services/http/bonus-token.service'; import { BonusToken } from '../../../../models/bonus-token'; -import { MatDialogRef } from '@angular/material'; +import { MatDialog, MatDialogRef } from '@angular/material'; import { RoomCreatorPageComponent } from '../../room-creator-page/room-creator-page.component'; +import { BonusDeleteComponent } from '../bonus-delete/bonus-delete.component'; @Component({ selector: 'app-bonus-token', @@ -14,6 +15,7 @@ export class BonusTokenComponent implements OnInit { bonusTokens: BonusToken[] = []; constructor(private bonusTokenService: BonusTokenService, + public dialog: MatDialog, private dialogRef: MatDialogRef<RoomCreatorPageComponent>) { } @@ -23,6 +25,23 @@ export class BonusTokenComponent implements OnInit { }); } + openDeleteSingleBonusDialog(userId: string, commentId: string): void { + const dialogRef = this.dialog.open(BonusDeleteComponent, { + width: '400px' + }); + dialogRef.componentInstance.multipleBonuses = false; + dialogRef.afterClosed() + .subscribe(result => { + if (result === 'delete') { + this.deleteBonus(userId, commentId); + } + }); + } + + deleteBonus(userId: string, commentId: string): void { + // Delete bonus via bonus-token-service + } + /** * Returns a lambda which closes the dialog on call. */ diff --git a/src/app/components/creator/creator.module.ts b/src/app/components/creator/creator.module.ts index 73602de17683d0b896f7717ce5238184de2daac9..1fe4402d87b550bdcc06fbfb55e203eb12e7b1e5 100644 --- a/src/app/components/creator/creator.module.ts +++ b/src/app/components/creator/creator.module.ts @@ -85,7 +85,8 @@ import { BonusDeleteComponent } from './_dialogs/bonus-delete/bonus-delete.compo CommentSettingsComponent, ModeratorDeleteComponent, DeleteCommentsComponent, - DeleteCommentComponent + DeleteCommentComponent, + BonusDeleteComponent ] }) export class CreatorModule { diff --git a/src/assets/i18n/creator/de.json b/src/assets/i18n/creator/de.json index a4b228af23e833339957edf13236376b56a5ded5..9257e794cce0fe86d6727d54f1741b54a9890909 100644 --- a/src/assets/i18n/creator/de.json +++ b/src/assets/i18n/creator/de.json @@ -216,7 +216,9 @@ "correct/wrong": "Richtig/Falsch", "score": "Score", "timestamp": "Zeitstempel", - "token": "Bonus-Token" + "token": "Bonus-Token", + "really-delete-bonus": "Willst du diesen Token wirklich löschen?", + "really-delete-bonuses": "Willst du wirklich alle Tokens dieser Sitzung löschen?" }, "session": { "a11y-description": "Gib eine Beschreibung für die Sitzung ein.", diff --git a/src/assets/i18n/creator/en.json b/src/assets/i18n/creator/en.json index 5d832d5ab88520ec2ecafdcf9d2000ee6ead75d9..bc69ed1643cdebfc32cf5ae9eece48744c92a238 100644 --- a/src/assets/i18n/creator/en.json +++ b/src/assets/i18n/creator/en.json @@ -217,7 +217,9 @@ "correct/wrong": "Correct/Wrong", "score": "Score", "timestamp": "Timestamp", - "token": "Bonus token" + "token": "Bonus token", + "really-delete-bonus": "Do you really want to delete this token?", + "really-delete-bonuses": "Do you really want to delete all tokens of this session?" }, "session": { "a11y-description": "Enter a description for the session",