-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
251 additions
and
200 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
114 changes: 114 additions & 0 deletions
114
projects/gameboard-ui/src/app/core/components/feedback-form/feedback-form.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
<ng-container *ngIf="!isForceHidden"> | ||
<div class="d-flex align-items-center" tabindex="0" (click)="toggleShow()"> | ||
<fa-icon class="d-inline" [icon]="show ? faCaretDown : faCaretRight" size="lg"></fa-icon> | ||
<span> | ||
<h3 *ngIf="type == 'challenge'" class="d-inline">{{title}}</h3> | ||
<h2 *ngIf="type == 'game'" class="d-inline">{{title}}</h2> | ||
</span> | ||
</div> | ||
|
||
<form #form="ngForm" [ngFormOptions]="{updateOn: 'change'}" [hidden]="!show" class="pop-light p-4 mt-4"> | ||
|
||
<app-error-div [errors]="errors"></app-error-div> | ||
|
||
<div *ngIf="game?.feedbackTemplate?.message as message" | ||
class="mb-3 bg-light p-2 rounded d-flex justify-content-left"> | ||
<fa-icon [icon]="faExclamationCircle" class="pr-1"></fa-icon> | ||
<small><span class="font-weight-bold align-middle">{{message}}</span></small> | ||
</div> | ||
|
||
<div *ngFor="let q of feedbackForm.questions; let i = index" class="mb-4"> | ||
<label for="{{q.id}}"> | ||
{{i+1}}. {{q.prompt}} | ||
<span *ngIf="q.required" class="required">*</span> | ||
</label> | ||
|
||
<!-- Text --> | ||
<ng-container *ngIf="q.type == 'text'"> | ||
<textarea rows="1" type="text" class="form-control" id={{q.id}} name={{q.id}} [(ngModel)]="q.answer" | ||
[disabled]="feedbackForm.submitted!" maxlength={{characterLimit}} | ||
style="white-space: pre; overflow-wrap: normal; overflow-x: scroll; resize: none"></textarea> | ||
<small class="d-flex justify-content-end" | ||
[class]="q.answer?.length == characterLimit ? 'text-warning' : 'text-muted'"> | ||
{{characterLimit - (q.answer?.length ?? 0)}} | ||
</small> | ||
</ng-container> | ||
|
||
<!-- Likert --> | ||
<div *ngIf="q.type == 'likert'"> | ||
<small class="pr-2 text-dark">{{q.minLabel}}</small> | ||
<div id={{q.id}} class="btn-group" btnRadioGroup name={{q.id}} tabindex="0" [(ngModel)]="q.answer" | ||
[disabled]="feedbackForm.submitted!"> | ||
<label *ngFor="let i of options(q.min ?? 1, q.max ?? 1)" class="btn btn-outline-dark btn-sm m-0" | ||
btnRadio="{{i}}">{{i}} | ||
</label> | ||
</div> | ||
<small class="pl-2 text-dark">{{q.maxLabel}}</small> | ||
</div> | ||
|
||
<!-- Select one --> | ||
<ng-container *ngIf="q.type == 'selectOne'"> | ||
<!-- Dropdown --> | ||
<div *ngIf="q.display == 'dropdown'" id={{q.id}}> | ||
<select id="dropdown-{{q.id}}" class="btn btn-secondary" [(ngModel)]="q.answer" [name]="q.id"> | ||
<option ngDefaultControl [value]="''" class="dropdown-item" selected>---</option> | ||
<option *ngFor="let option of q.options" class="dropdown-item px-3" [disabled]="feedbackForm.submitted!" | ||
ngDefaultControl [value]="option" [selected]="q.answer == option">{{option}}</option> | ||
</select> | ||
</div> | ||
<!-- Radio buttons --> | ||
<div *ngIf="q.display != 'dropdown'" id={{q.id}}> | ||
<ng-container *ngFor="let option of q.options"> | ||
<div class="form-check"> | ||
<input class="form-check-input" type="radio" (change)="modifyMultipleAnswer(q, option, $event, true)" | ||
[checked]="q.answer && q.answer!.indexOf(option) > -1" [disabled]="feedbackForm.submitted!" | ||
id="check-{{q.id}}-{{option}}" [name]="q.id" [value]="option"> | ||
<label class="form-check-label" for="{{option}}">{{option}}{{q.specify && q.specify.key == option ? ": " + | ||
(q.specify.prompt ? q.specify.prompt : "") : "" }}</label> | ||
<br> | ||
<textarea *ngIf="q.specify && q.specify.key == option" rows="1" type="text" | ||
[disabled]="feedbackForm.submitted!" | ||
style="white-space: pre; overflow-wrap: normal; overflow-x: scroll; resize: none" | ||
(change)="modifySpecifiedAnswer(q, option, $event)" id="input-{{q.id}}-{{option}}"></textarea> | ||
</div> | ||
</ng-container> | ||
</div> | ||
</ng-container> | ||
|
||
<!-- Select all that apply --> | ||
<ng-container *ngIf="q.type == 'selectMany'"> | ||
<div id={{q.id}}> | ||
<ng-container *ngFor="let option of q.options"> | ||
<div class="form-check"> | ||
<input class="form-check-input" type="checkbox" (change)="modifyMultipleAnswer(q, option, $event)" | ||
[checked]="q.answer && q.answer!.indexOf(option) > -1" [disabled]="feedbackForm.submitted!" | ||
id="check-{{q.id}}-{{option}}" [name]="option" [value]="option"> | ||
<label class="form-check-label" for="{{option}}">{{option}}{{q.specify && q.specify.key == option ? ": " + | ||
(q.specify.prompt ? q.specify.prompt : "") : "" }}</label> | ||
<br> | ||
<textarea *ngIf="q.specify && q.specify.key == option" rows="1" type="text" | ||
[disabled]="feedbackForm.submitted!" | ||
style="white-space: pre; overflow-wrap: normal; overflow-x: scroll; resize: none" | ||
(change)="modifySpecifiedAnswer(q, option, $event)" id="input-{{q.id}}-{{option}}"></textarea> | ||
</div> | ||
</ng-container> | ||
</div> | ||
</ng-container> | ||
</div> | ||
|
||
<app-confirm-button btnClass="btn btn-sm btn-secondary" (confirm)="submit()" | ||
[disabled]="feedbackForm.submitted! || !feedbackForm.questions.length"> | ||
<fa-icon [icon]="faSubmit"></fa-icon> | ||
<span>{{feedbackForm.submitted ? "Submitted" : "Submit"}}</span> | ||
</app-confirm-button> | ||
<div class="mt-3 d-flex justify-content-between"> | ||
<small class="">Responses cannot be changed after clicking submit.</small> | ||
<small class="">{{status}}</small> | ||
</div> | ||
</form> | ||
|
||
<p [hidden]="show || !feedbackForm.submitted" class="p-4 text-center"> | ||
Thank you for submitting feedback! | ||
</p> | ||
|
||
</ng-container> |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.