Commit fd13ac10 authored by Lukas Mauß's avatar Lukas Mauß

Link to single comment view in token dialogs

parent 0a4ce6e5
Pipeline #37053 passed with stages
in 8 minutes and 32 seconds
......@@ -4,7 +4,8 @@
<h3 class="oldtypo-h3">{{ 'room-page.session-id' | translate}}: {{room.shortId.slice(0, 4)}} {{room.shortId.slice(4, 8)}}</h3>
<mat-divider></mat-divider>
<div *ngIf="bonusTokens.length >= 1">
<div fxLayout="row" *ngFor="let bonusToken of bonusTokens; index as i" class="token">
<div fxLayout="row" *ngFor="let bonusToken of bonusTokens; index as i" class="token"
(click)="navToComment(bonusToken.commentId)">
<p tabindex="0">
{{bonusToken.token}}
</p>
......
......@@ -15,6 +15,7 @@ p {
}
.token {
cursor: pointer;
padding-left: 3%;
&:nth-child(even) {
background-color: var(--alt-dialog);
......
......@@ -7,6 +7,7 @@ import { RoomCreatorPageComponent } from '../../room-creator-page/room-creator-p
import { BonusDeleteComponent } from '../bonus-delete/bonus-delete.component';
import { NotificationService } from '../../../../services/util/notification.service';
import { TranslateService } from '@ngx-translate/core';
import { Router } from '@angular/router';
@Component({
selector: 'app-bonus-token',
......@@ -20,6 +21,7 @@ export class BonusTokenComponent implements OnInit {
constructor(private bonusTokenService: BonusTokenService,
public dialog: MatDialog,
protected router: Router,
private dialogRef: MatDialogRef<RoomCreatorPageComponent>,
private translationService: TranslateService,
private notificationService: NotificationService) {
......@@ -81,6 +83,12 @@ export class BonusTokenComponent implements OnInit {
});
}
navToComment(commentId: string) {
this.dialogRef.close();
const commentURL = `creator/room/${this.room.shortId}/comment/${commentId}`;
this.router.navigate([commentURL]);
}
/**
* Returns a lambda which closes the dialog on call.
*/
......
......@@ -2,7 +2,8 @@
<h2 class="oldtypo-h2" tabindex="0">{{'header.bonus-token' | translate }}</h2>
<mat-divider></mat-divider>
<div *ngIf="bonusTokensMixin.length >= 1">
<div fxLayout="column" *ngFor="let bonusToken of bonusTokensMixin">
<div fxLayout="column" class="tokens" *ngFor="let bonusToken of bonusTokensMixin; let i = index"
(click)="navToComment(i)">
<h2 class="token" tabindex="1">{{bonusToken.token}}</h2>
<h2 class="roomName">(&raquo;{{bonusToken.roomName}}&laquo;)</h2>
</div>
......
.token {
margin-bottom: 10px;
margin-top: 10px;
}
.roomName {
margin-top: 0;
margin: 0;
}
.tokens {
cursor: pointer;
margin: 20px 0;
}
h2 {
text-align: center;
}
......@@ -4,6 +4,7 @@ import { RoomService } from '../../../../services/http/room.service';
import { BonusToken } from '../../../../models/bonus-token';
import { BonusTokenRoomMixin } from '../../../../models/bonus-token-room-mixin';
import { MatDialogRef } from '@angular/material';
import { Router } from '@angular/router';
@Component({
selector: 'app-user-bonus-token',
......@@ -18,7 +19,8 @@ export class UserBonusTokenComponent implements OnInit {
constructor(
private bonusTokenService: BonusTokenService,
private roomService: RoomService,
private dialogRef: MatDialogRef<UserBonusTokenComponent>
private dialogRef: MatDialogRef<UserBonusTokenComponent>,
protected router: Router
) {
}
......@@ -38,6 +40,12 @@ export class UserBonusTokenComponent implements OnInit {
});
}
navToComment(index: number) {
this.dialogRef.close();
const commentURL = `participant/room/${this.bonusTokensMixin[index].roomShortId}/comment/${this.bonusTokens[index].commentId}`;
this.router.navigate([commentURL]);
}
/**
* Returns a lambda which closes the dialog on call.
*/
......
......@@ -3,7 +3,7 @@
<app-comment [comment]="comment" [userRole]="user.role"></app-comment>
</div>
<div fxLayout="row" fxLayoutAlign="center">
<mat-card class="answer">
<mat-card class="answer" *ngIf="!isStudent || answer">
<div *ngIf="(isStudent || !edit) && answer">
<markdown [data]="answer"></markdown>
<div fxLayout="row" fxLayoutAlign="end">
......
Markdown is supported
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