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

Add favorite icon to comment-component, button for creator

parent 4421fd28
No related merge requests found
...@@ -5,6 +5,9 @@ ...@@ -5,6 +5,9 @@
<button mat-icon-button [disabled]="userRole === 0" (click)="setCorrect(comment)" [matTooltip]="comment.correct ? 'Antwort richtig' : null"> <button mat-icon-button [disabled]="userRole === 0" (click)="setCorrect(comment)" [matTooltip]="comment.correct ? 'Antwort richtig' : null">
<mat-icon [ngClass]="{'correct-icon' : comment.correct === true}">check_circle</mat-icon> <mat-icon [ngClass]="{'correct-icon' : comment.correct === true}">check_circle</mat-icon>
</button> </button>
<button mat-icon-button [disabled]="userRole === 0" (click)="setFavorite(comment)" [matTooltip]="comment.favorite ? 'mark as favorite' : 'mark as not favorite'">
<mat-icon [ngClass]="{'favorite-icon' : comment.favorite === true}">star</mat-icon>
</button>
<button mat-icon-button [disabled]="userRole === 0" (click)="setRead(comment)" [matTooltip]="comment.read ? 'mark me as unread' : 'mark me as read'"> <button mat-icon-button [disabled]="userRole === 0" (click)="setRead(comment)" [matTooltip]="comment.read ? 'mark me as unread' : 'mark me as read'">
<mat-icon [ngClass]="{'read-icon' : comment.read === true}">visibility</mat-icon> <mat-icon [ngClass]="{'read-icon' : comment.read === true}">visibility</mat-icon>
</button> </button>
......
...@@ -25,3 +25,7 @@ mat-icon { ...@@ -25,3 +25,7 @@ mat-icon {
.read-icon { .read-icon {
color: blue; color: blue;
} }
.favorite-icon {
color: #fdd835;
}
...@@ -43,6 +43,11 @@ export class CommentComponent implements OnInit { ...@@ -43,6 +43,11 @@ export class CommentComponent implements OnInit {
this.commentService.updateComment(comment).subscribe(); this.commentService.updateComment(comment).subscribe();
} }
setFavorite(comment: Comment): void {
comment.favorite = !comment.favorite;
this.commentService.updateComment(comment).subscribe();
}
delete(comment: Comment): void { delete(comment: Comment): void {
this.commentService.deleteComment(comment.id).subscribe(room => { this.commentService.deleteComment(comment.id).subscribe(room => {
this.notification.show(`Comment '${comment.subject}' successfully deleted.`); this.notification.show(`Comment '${comment.subject}' successfully deleted.`);
......
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