diff --git a/src/app/components/shared/_dialogs/submit-comment/submit-comment.component.html b/src/app/components/shared/_dialogs/submit-comment/submit-comment.component.html index 0f9f90b06c6a5ef9f78021cb6ad947fd2a1d4c92..ac95224c073f242c673681e05e688c0f5763b55d 100644 --- a/src/app/components/shared/_dialogs/submit-comment/submit-comment.component.html +++ b/src/app/components/shared/_dialogs/submit-comment/submit-comment.component.html @@ -12,6 +12,8 @@ matAutosizeMinRows=2 matAutosizeMaxRows=5 maxlength="255" [formControl]="bodyForm"></textarea> <mat-hint align="end">{{commentBody.value.length}} / 255</mat-hint> </mat-form-field> + <button mat-raised-button color="warn" + (click)="onNoClick()">{{ 'comment-page.abort' | translate}}</button> <button mat-raised-button color="accent" (click)="closeDialog(commentSubject.value, commentBody.value)">{{ 'comment-page.send' | translate}}</button> </form> diff --git a/src/app/components/shared/_dialogs/submit-comment/submit-comment.component.ts b/src/app/components/shared/_dialogs/submit-comment/submit-comment.component.ts index 30f15e785fe4178da2990118e6a605d8b936b0e1..6e2f2fb70c95335c43892a35bbf823f87307f434 100644 --- a/src/app/components/shared/_dialogs/submit-comment/submit-comment.component.ts +++ b/src/app/components/shared/_dialogs/submit-comment/submit-comment.component.ts @@ -41,7 +41,7 @@ export class SubmitCommentComponent implements OnInit { } onNoClick(): void { - this.dialogRef.close('abort'); + this.dialogRef.close(); } checkInputData(subject: string, body: string): boolean { @@ -69,15 +69,13 @@ export class SubmitCommentComponent implements OnInit { } closeDialog(subject: string, body: string) { - this.checkInputData(subject, body); - const comment = new Comment(); - /* this.route.params.subscribe(params => { - comment.roomId = params['roomId']; - }); */ - comment.roomId = localStorage.getItem(`roomId`); - comment.subject = subject; - comment.body = body; - comment.userId = this.user.id; - this.dialogRef.close(comment); + if (this.checkInputData(subject, body) === true) { + const comment = new Comment(); + comment.roomId = localStorage.getItem(`roomId`); + comment.subject = subject; + comment.body = body; + comment.userId = this.user.id; + this.dialogRef.close(comment); + } } } diff --git a/src/app/components/shared/comment-page/comment-page.component.ts b/src/app/components/shared/comment-page/comment-page.component.ts index cb91f65b5aa91afd1c15c22cfab901a334db020d..bb09927e14b6cfbc1ad1c9cc155f9106a22622b8 100644 --- a/src/app/components/shared/comment-page/comment-page.component.ts +++ b/src/app/components/shared/comment-page/comment-page.component.ts @@ -29,8 +29,7 @@ export class CommentPageComponent implements OnInit { }); dialogRef.afterClosed() .subscribe(result => { - if (result !== null) { - console.log(result); + if (result) { this.send(result); } else { return; diff --git a/src/assets/i18n/creator/de.json b/src/assets/i18n/creator/de.json index 78570c21063ece697a2ab67ec4b6001fc6b86810..cb98ca172495a16d17897c26c4a3bc88a661a7c8 100644 --- a/src/assets/i18n/creator/de.json +++ b/src/assets/i18n/creator/de.json @@ -79,7 +79,7 @@ "enter-title": "Titel", "enter-comment": "Kommentar", "send": "Senden", - "back": "Zurück", + "abort": "Abbrechen", "error-comment": "Bitte geben Sie ein Kommentar ein!", "error-title": "Bitte geben Sie einen Titel ein!", "error-both-fields": "Bitte füllen Sie alle Felder aus!" diff --git a/src/assets/i18n/creator/en.json b/src/assets/i18n/creator/en.json index 6662ed0733589af62d3efed478910e88961e5457..8305ffed48a9732a60aa9caee257dab9713aa816 100644 --- a/src/assets/i18n/creator/en.json +++ b/src/assets/i18n/creator/en.json @@ -79,7 +79,7 @@ "enter-title": "Title", "enter-comment": "Comment", "send": "Send", - "back": "Back", + "abort": "Cancel", "error-title": "Please enter a title!", "error-comment": "Please enter a comment!", "error-both-fields": "Please fill in all fields!" diff --git a/src/assets/i18n/participant/de.json b/src/assets/i18n/participant/de.json index 358c5f19f771c86ca4facc674597ec4ac37e83f2..3fcb7955f22a480d855bfe221b55f99adad40b5e 100644 --- a/src/assets/i18n/participant/de.json +++ b/src/assets/i18n/participant/de.json @@ -18,7 +18,7 @@ "enter-title": "Titel", "enter-comment": "Kommentar", "send": "Senden", - "back": "Zurück", + "abort": "Abbrechen", "error-comment": "Bitte geben Sie ein Kommentar ein!", "error-title": "Bitte geben Sie einen Titel ein!", "error-both-fields": "Bitte füllen Sie alle Felder aus!" diff --git a/src/assets/i18n/participant/en.json b/src/assets/i18n/participant/en.json index d08c607724dc89d94e6fdf0f835406b66fcbd3b3..09757456ab43346d612675a26aed027681708a64 100644 --- a/src/assets/i18n/participant/en.json +++ b/src/assets/i18n/participant/en.json @@ -18,7 +18,7 @@ "enter-title": "Title", "enter-comment": "Comment", "send": "Send", - "back": "Back", + "abort": "Cancel", "error-title": "Please enter a title!", "error-comment": "Please enter a comment!", "error-both-fields": "Please fill in all fields!"