diff --git a/src/app/comment-list/comment-list.component.html b/src/app/comment-list/comment-list.component.html index 7671a21e6cda93a814274358c147599aa7b0afc4..cafb9025695298a4c7f411d1e682f026ecc64df3 100644 --- a/src/app/comment-list/comment-list.component.html +++ b/src/app/comment-list/comment-list.component.html @@ -7,7 +7,7 @@ {{comment.body}} - <div class="body-buttons" fxLayout="Column" fxLayoutGap="5px" fxLayoutAlign="end"> + <div class="body-buttons" *ngIf="userRole === CREATOR"> <button *ngIf="!comment.read" mat-fab color="warn" matTooltip="Is not read" (click)="setRead(comment)"> <mat-icon>clear</mat-icon> </button> @@ -27,6 +27,6 @@ </mat-card><br> </div> - <button class="back-button" mat-raised-button color="primary" (click)="goBack()">Back</button> + <button *ngIf="userRole === CREATOR" mat-raised-button color="primary" (click)="goBack()">Back</button> </div> </div> diff --git a/src/app/comment-list/comment-list.component.scss b/src/app/comment-list/comment-list.component.scss index 45057a7719fe6aada402b81e05fd18986682f48c..0d4877e4dc4ae6d404ac0687f79aa18ea06898c2 100644 --- a/src/app/comment-list/comment-list.component.scss +++ b/src/app/comment-list/comment-list.component.scss @@ -16,10 +16,6 @@ mat-card:hover { background: #F44336; } -.back-button { - min-width: 800px; -} - .body-buttons { position: absolute; top: 10%; diff --git a/src/app/comment-list/comment-list.component.ts b/src/app/comment-list/comment-list.component.ts index 0061a746200fb840a2d9f8e36cd5c8c6c5fa48c7..de4812b5c953a3a6f683bb11d400565a4b2e3c61 100644 --- a/src/app/comment-list/comment-list.component.ts +++ b/src/app/comment-list/comment-list.component.ts @@ -5,6 +5,8 @@ import { Comment } from '../comment'; import { CommentService } from '../comment.service'; import { RoomService } from '../room.service'; import { NotificationService } from '../notification.service'; +import { AuthenticationService } from '../authentication.service'; +import { UserRole } from '../user-roles.enum'; @Component({ selector: 'app-comment-list', @@ -12,9 +14,11 @@ import { NotificationService } from '../notification.service'; styleUrls: ['./comment-list.component.scss'] }) export class CommentListComponent implements OnInit { + userRole: UserRole; comments: Comment[]; constructor( + protected authenticationService: AuthenticationService, private route: ActivatedRoute, private roomService: RoomService, private location: Location, @@ -22,6 +26,7 @@ export class CommentListComponent implements OnInit { private notification: NotificationService) { } ngOnInit() { + this.userRole = this.authenticationService.getRole(); this.route.params.subscribe(params => { this.getRoom(params['roomId']); }); diff --git a/src/app/create-comment/create-comment.component.html b/src/app/create-comment/create-comment.component.html index f7d2ed8e86d7409a75c75b42f06ac815a06b462b..8d68d8f90fdbea5f7dffd87b577218ad3a0421af 100644 --- a/src/app/create-comment/create-comment.component.html +++ b/src/app/create-comment/create-comment.component.html @@ -1,14 +1,18 @@ -<div fxLayout="column" fxLayoutAlign="center" fxLayoutGap="10"> - <form> - <mat-form-field class="input-block"> - <input matInput #commentSubject type="text" maxlength="24" placeholder="Choose a title"> - </mat-form-field> - <mat-form-field class="input-block"> - <input matInput #commentBody> - <textarea matInput placeholder="Add your comment"></textarea> - </mat-form-field> +<div fxLayout="row" fxLayoutAlign="center"> + <div fxLayout="column" fxLayoutGap="20"> + <form> + <mat-form-field class="input-block"> + <input matInput #commentSubject type="text" maxlength="24" placeholder="Choose a title"> + </mat-form-field> + <mat-form-field class="input-block"> + <input matInput #commentBody> + <textarea matInput placeholder="Add your comment"></textarea> + </mat-form-field> - <button mat-raised-button color="primary" (click)="goBack()">Back</button> - <button mat-raised-button color="primary" (click)="send(commentSubject.value, commentBody.value)">Send</button> - </form> + <button mat-raised-button color="primary" (click)="goBack()">Back</button> + <button mat-raised-button color="primary" (click)="send(commentSubject.value, commentBody.value)">Send</button> + </form> + </div> </div> + +<app-comment-list></app-comment-list> diff --git a/src/app/create-comment/create-comment.component.scss b/src/app/create-comment/create-comment.component.scss index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..086556915ce665c4afe7ea59451348bd45a53ed2 100644 --- a/src/app/create-comment/create-comment.component.scss +++ b/src/app/create-comment/create-comment.component.scss @@ -0,0 +1,5 @@ +form { + min-width: 800px; + justify-content: center; + margin-bottom: 50px; +} diff --git a/src/app/create-comment/create-comment.component.ts b/src/app/create-comment/create-comment.component.ts index 73e69402cc3109f3681a5616058c05b157ad297e..056a72ea80f68911baf1c712d436e613b910af64 100644 --- a/src/app/create-comment/create-comment.component.ts +++ b/src/app/create-comment/create-comment.component.ts @@ -4,9 +4,8 @@ import { Location } from '@angular/common'; import { Room } from '../room'; import { Comment } from '../comment'; import { RoomService } from '../room.service'; -import { CommentService} from '../comment.service'; +import { CommentService } from '../comment.service'; import { NotificationService } from '../notification.service'; -import { Router } from '@angular/router'; @Component({ selector: 'app-create-comment', @@ -17,7 +16,6 @@ export class CreateCommentComponent implements OnInit { @Input() room: Room; constructor( - private router: Router, private route: ActivatedRoute, private roomService: RoomService, private commentService: CommentService, @@ -46,7 +44,6 @@ export class CreateCommentComponent implements OnInit { body: body, creationTimestamp: new Date(Date.now()) } as Comment).subscribe(() => { - this.router.navigate([`/participant/room/${this.room.id}`]); this.notification.show(`Comment '${subject}' successfully created.`); }); }