diff --git a/src/app/components/pages/comment-create-page/comment-create-page.component.scss b/src/app/components/pages/comment-create-page/comment-create-page.component.scss index 0ca4a4971d6f02fba366e5d74b2233c196a38c70..d354757ab3770bb7c78f72cd1131db57c11c35e7 100644 --- a/src/app/components/pages/comment-create-page/comment-create-page.component.scss +++ b/src/app/components/pages/comment-create-page/comment-create-page.component.scss @@ -1,6 +1,4 @@ form { - display: block; - width: 100%; max-width: 800px; - margin-bottom: 50px; + width: 100%; } diff --git a/src/app/components/pages/comment-list/comment-list.component.html b/src/app/components/pages/comment-list/comment-list.component.html index 79ade9f83af464774ab782a49b871ec9917f8937..cff81768683c6b3789a516ac11a1c88293d1da0d 100644 --- a/src/app/components/pages/comment-list/comment-list.component.html +++ b/src/app/components/pages/comment-list/comment-list.component.html @@ -1,37 +1,31 @@ -<mat-card *ngFor="let comment of comments"> - <mat-card-header> - <mat-card-title>{{comment.subject}}</mat-card-title> - <mat-card-subtitle> - <span class="mat-caption">Submitted on {{ comment.creationTimestamp | date:'dd-MM-yyyy HH:mm:ss' }}</span> - </mat-card-subtitle> - </mat-card-header> - <mat-divider></mat-divider> - <mat-card-content> - <p>{{comment.body}}</p> - </mat-card-content> - <mat-divider></mat-divider> - <mat-card-actions *ngIf="userRole === userRoleTemp"> - <button mat-icon-button *ngIf="comment.read" color="primary" matTooltip="Mark as read" - (click)="setRead(comment)"> - <mat-icon>speaker_notes</mat-icon> - </button> - <button mat-icon-button *ngIf="!comment.read" color="warn" matTooltip="Mark as unread" - (click)="setRead(comment)"> - <mat-icon>speaker_notes_off</mat-icon> - </button> - <button mat-icon-button color="warn" matTooltip="Delete comment" - (click)="delete(comment)"> - <mat-icon>delete</mat-icon> - </button> - </mat-card-actions> - <mat-card-actions *ngIf="userRole !== userRoleTemp"> - <button mat-icon-button *ngIf="comment.read" color="primary" matTooltip="Mark as read" - (click)="setRead(comment)" disabled> - <mat-icon>speaker_notes</mat-icon> - </button> - <button mat-icon-button *ngIf="!comment.read" color="warn" matTooltip="Mark as unread" - (click)="setRead(comment)" disabled> - <mat-icon>speaker_notes_off</mat-icon> - </button> - </mat-card-actions> -</mat-card> +<div fxLayout="column" fxLayoutAlign="center" fxLayoutGap="20px"> + <div fxLayout="row" fxLayoutAlign="center" *ngFor="let comment of comments"> + <mat-card> + <mat-card-header> + <mat-card-title>{{comment.subject}}</mat-card-title> + <mat-card-subtitle> + <span class="mat-caption">Submitted on {{ comment.creationTimestamp | date:'dd-MM-yyyy HH:mm:ss' }}</span> + </mat-card-subtitle> + </mat-card-header> + <mat-divider></mat-divider> + <mat-card-content> + <p>{{comment.body}}</p> + </mat-card-content> + <mat-divider></mat-divider> + <mat-card-actions> + <button mat-icon-button *ngIf="comment.read" color="primary" matTooltip="Mark as read" + (click)="setRead(comment)"> + <mat-icon>speaker_notes</mat-icon> + </button> + <button mat-icon-button *ngIf="!comment.read" color="warn" matTooltip="Mark as unread" + (click)="setRead(comment)"> + <mat-icon>speaker_notes_off</mat-icon> + </button> + <button mat-icon-button color="warn" matTooltip="Delete comment" + (click)="delete(comment)"> + <mat-icon>delete</mat-icon> + </button> + </mat-card-actions> + </mat-card> + </div> +</div> diff --git a/src/app/components/pages/comment-list/comment-list.component.scss b/src/app/components/pages/comment-list/comment-list.component.scss index 54dc90c341033023d58d89f8c1089584866fb5c3..40cb245ebea5b38d5a5f9976864272ceabfe9227 100644 --- a/src/app/components/pages/comment-list/comment-list.component.scss +++ b/src/app/components/pages/comment-list/comment-list.component.scss @@ -1,7 +1,4 @@ mat-card { - margin-bottom: 20px; -} - -mat-card-content>:first-child { - margin-top: 20px; + max-width: 800px; + width: 100%; } diff --git a/src/app/components/pages/comment-list/comment-list.component.ts b/src/app/components/pages/comment-list/comment-list.component.ts index 7cad6d866109e435ddfec7a474bb10e939a069ba..a90f24a85392f454a4a334b9bceb0f8dac3c636c 100644 --- a/src/app/components/pages/comment-list/comment-list.component.ts +++ b/src/app/components/pages/comment-list/comment-list.component.ts @@ -5,9 +5,6 @@ import { Comment } from '../../../models/comment'; import { CommentService } from '../../../services/http/comment.service'; import { RoomService } from '../../../services/http/room.service'; import { NotificationService } from '../../../services/util/notification.service'; -import { AuthenticationService } from '../../../services/http/authentication.service'; -import { UserRole } from '../../../models/user-roles.enum'; -import { User } from '../../../models/user'; @Component({ selector: 'app-comment-list', @@ -15,23 +12,17 @@ import { User } from '../../../models/user'; styleUrls: ['./comment-list.component.scss'] }) export class CommentListComponent implements OnInit { - userRoleTemp: any = UserRole.CREATOR; - userRole: UserRole; - user: User; comments: Comment[]; isLoading = true; - constructor(protected authenticationService: AuthenticationService, - private route: ActivatedRoute, + constructor( private route: ActivatedRoute, private roomService: RoomService, private location: Location, private commentService: CommentService, - private notification: NotificationService) { + private notification: NotificationService ) { } ngOnInit() { - this.userRole = this.authenticationService.getRole(); - this.user = this.authenticationService.getUser(); this.route.params.subscribe(params => { this.getRoom(params['roomId']); }); @@ -63,8 +54,4 @@ export class CommentListComponent implements OnInit { this.notification.show(`Comment '${comment.subject}' successfully deleted.`); }); } - - goBack(): void { - this.location.back(); - } } diff --git a/src/app/components/pages/room-creator-page/room-creator-page.component.html b/src/app/components/pages/room-creator-page/room-creator-page.component.html index d691d5959ba28acdeb087c3aa7b44878a5045cce..dd0efdb7334333f5204583c0de3749dfa333b5c7 100644 --- a/src/app/components/pages/room-creator-page/room-creator-page.component.html +++ b/src/app/components/pages/room-creator-page/room-creator-page.component.html @@ -23,13 +23,15 @@ <mat-divider></mat-divider> <mat-card-actions> <button mat-button color="primary" matTooltip="Create new content" - routerLink="/creator/room/{{room.id}}/create-content"> + routerLink="/creator/room/{{ room.shortId }}/create-content"> Create content </button> - <button mat-button color="primary" matTooltip="See room comments" routerLink="/creator/room/{{room.id}}/comments"> + <button mat-button color="primary" matTooltip="See room comments" + routerLink="/creator/room/{{ room.shortId }}/comments"> Comments </button> - <button mat-button color="primary" matTooltip="See answer statistics" routerLink="/creator/room/{{room.id}}/answer-statistics"> + <button mat-button color="primary" matTooltip="See answer statistics" + routerLink="/creator/room/{{ room.shortId }}/answer-statistics"> Answer statistics </button> <button *ngIf="!modify" (click)="showEditDialog()" mat-button color="primary"> diff --git a/src/app/components/pages/room-participant-page/room-participant-page.component.html b/src/app/components/pages/room-participant-page/room-participant-page.component.html index e9444018f37a55ed511840d9b161e8dd0cfbea89..b75ff0e26851ec84f8f3bbc3add07496ec788ebc 100644 --- a/src/app/components/pages/room-participant-page/room-participant-page.component.html +++ b/src/app/components/pages/room-participant-page/room-participant-page.component.html @@ -27,7 +27,7 @@ </mat-grid-tile> </mat-grid-list> <mat-nav-list> - <mat-list-item matTooltip="Join question round" routerLink="/participant/room/{{ room.id }}/questions"> + <mat-list-item matTooltip="Join question round" routerLink="/participant/room/{{ room.shortId }}/questions"> Contents </mat-list-item> <mat-list-item matTooltip="See room comments"> diff --git a/src/app/services/http/comment.service.ts b/src/app/services/http/comment.service.ts index 2bd824827a0e1c5a5a571b991a4f7f2cca65a66e..f6c7ba96dd4c0310a029c54bf2fe296ec58cfdc5 100644 --- a/src/app/services/http/comment.service.ts +++ b/src/app/services/http/comment.service.ts @@ -16,8 +16,7 @@ export class CommentService extends BaseHttpService { private commentsUrl = '/comment'; private findCommentUrl = '/find'; - constructor( private http: HttpClient, - private authService: AuthenticationService ) { + constructor( private http: HttpClient ) { super(); } @@ -50,10 +49,9 @@ export class CommentService extends BaseHttpService { } updateComment(comment: Comment): Observable<any> { - const url = `${this.apiBaseUrl}${this.commentsUrl}/${comment.id} + '/'`; + const url = `${this.apiBaseUrl}${this.commentsUrl}/${comment.id}`; return this.http.put(url, { - ownerId: this.authService.getUser().id, - roomId: comment.roomId, subject: comment.subject, body: comment.body, read: !comment.read, + read: !comment.read }, httpOptions).pipe( tap(_ => ''), catchError(this.handleError<any>('updateComment'))