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

Rebase and move stuff to new comment-component

parent 729189de
Branches
Tags
No related merge requests found
......@@ -13,28 +13,6 @@ mat-toolbar {
background-color: #bbdefb;
}
.card-container {
background-color: #4dd0e1;
opacity: 0.7;
border-radius: 2px;
}
.outer-card {
border-radius: 8px;
}
mat-icon {
color: white;
}
.incorrect-icon {
color: white;
}
.correct-icon {
color: green;
}
mat-card-title {
margin: 0px;
}
import { Component, Input, OnInit } from '@angular/core';
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Location } from '@angular/common';
import { Comment } from '../../../models/comment';
......@@ -17,7 +17,6 @@ import { LanguageService } from '../../../services/util/language.service';
styleUrls: ['./comment-list.component.scss']
})
export class CommentListComponent implements OnInit {
userRoleTemp: any = UserRole.CREATOR;
userRole: UserRole;
user: User;
comments: Comment[];
......
<mat-card>
<mat-card-title>{{comment.subject}}</mat-card-title>
<mat-card class="card-container">
<div fxLayout="row" fxLayoutAlign="center center">
<mat-card-title>{{comment.subject}}</mat-card-title>
<span class="fill-remaining-space"></span>
<button mat-icon-button [disabled]="userRole === 0" (click)="setCorrect(comment)">
<mat-icon [ngClass]="{'correct-icon' : comment.correct === true}">check_circle</mat-icon>
</button>
</div>
<mat-divider></mat-divider>
<mat-card-content>
<p>{{comment.body}}</p>
......
mat-card {
margin-bottom: 20px;
background-color: #b2ebf2;
}
mat-card-content>:first-child {
margin-top: 20px;
}
mat-toolbar {
border-radius: 10px;
margin-bottom: 20px;
background-color: #bbdefb;
}
.card-container {
background-color: #4dd0e1;
opacity: 0.7;
border-radius: 2px;
}
.outer-card {
border-radius: 8px;
}
mat-icon {
color: white;
}
.incorrect-icon {
color: white;
}
.correct-icon {
color: green;
}
mat-card-title {
margin: 0px;
}
......@@ -4,7 +4,6 @@ import { UserRole } from '../../../models/user-roles.enum';
import { User } from '../../../models/user';
import { AuthenticationService } from '../../../services/http/authentication.service';
import { ActivatedRoute } from '@angular/router';
import { RoomService } from '../../../services/http/room.service';
import { Location } from '@angular/common';
import { CommentService } from '../../../services/http/comment.service';
import { NotificationService } from '../../../services/util/notification.service';
......@@ -18,16 +17,12 @@ import { LanguageService } from '../../../services/util/language.service';
})
export class CommentComponent implements OnInit {
@Input() comment: Comment;
userRoleTemp: any = UserRole.CREATOR;
userRole: UserRole;
user: User;
isLoading = true;
roomId: string;
roomShortId: string;
constructor(protected authenticationService: AuthenticationService,
private route: ActivatedRoute,
private roomService: RoomService,
private location: Location,
private commentService: CommentService,
private notification: NotificationService,
......@@ -38,14 +33,19 @@ export class CommentComponent implements OnInit {
ngOnInit() {
this.userRole = this.authenticationService.getRole();
this.user = this.authenticationService.getUser();
this.roomShortId = this.route.snapshot.paramMap.get('roomId');
this.roomId = localStorage.getItem(`roomId`);
this.translateService.use(localStorage.getItem('currentLang'));
}
setRead(comment: Comment): void {
this.commentService.updateComment(comment).subscribe();
}
setCorrect(comment: Comment): void {
comment.correct = !comment.correct;
this.commentService.updateComment(comment).subscribe();
console.log('is' + comment.correct);
}
delete(comment: Comment): void {
this.commentService.deleteComment(comment.id).subscribe(room => {
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