Skip to content

Commit

Permalink
fix: disable launch scorm test button if user is staff
Browse files Browse the repository at this point in the history
  • Loading branch information
satikaj committed Jun 6, 2024
1 parent f0ff40b commit 9bc48b0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@
</p>
</mat-card-content>
<mat-card-actions class="space-x-2">
<button mat-stroked-button (click)="launchScormPlayer()" [hidden]="attemptsLeft === 0">
<button
mat-stroked-button
(click)="launchScormPlayer()"
[hidden]="attemptsLeft === 0"
[disabled]="user.isStaff"
>
<mat-icon style="width: 20px; height: 20px; font-size: 20px" aria-label="Launch icon">
launch
</mat-icon>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Component, Input, OnChanges, SimpleChanges} from '@angular/core';
import {Task} from 'src/app/api/models/doubtfire-model';
import {Task, User, UserService} from 'src/app/api/models/doubtfire-model';
import {ScormExtensionModalService} from 'src/app/common/modals/scorm-extension-modal/scorm-extension-modal.service';

@Component({
Expand All @@ -10,8 +10,14 @@ import {ScormExtensionModalService} from 'src/app/common/modals/scorm-extension-
export class TaskScormCardComponent implements OnChanges {
@Input() task: Task;
attemptsLeft: number;
user: User;

constructor(private extensions: ScormExtensionModalService) {}
constructor(
private extensions: ScormExtensionModalService,
private userService: UserService,
) {
this.user = userService.currentUser;
}

ngOnChanges(changes: SimpleChanges) {
if (changes.task && changes.task.currentValue) {
Expand Down

0 comments on commit 9bc48b0

Please sign in to comment.