Skip to content

Commit

Permalink
Make button separated from rubric table
Browse files Browse the repository at this point in the history
  • Loading branch information
NeoHW committed Jul 14, 2024
1 parent c5ad013 commit 0ca6127
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 44 deletions.
Original file line number Diff line number Diff line change
@@ -1,58 +1,63 @@
<table class="table table-bordered desktop-view" [attr.aria-label]="getAriaLabel()">
<thead>
<tr>
<td></td>
<th *ngFor="let choice of questionDetails.rubricChoices" scope="col">{{ choice }}</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let rubricDescriptionRow of questionDetails.rubricDescriptions; let i = index;"
[ngClass]="{ 'row-answered': i < responseDetails.answer.length && responseDetails.answer[i] !== RUBRIC_ANSWER_NOT_CHOSEN }">
<th class="fw-normal" scope="row">{{ questionDetails.rubricSubQuestions[i] }}</th>
<td *ngFor="let rubricDescriptionCell of rubricDescriptionRow; let j = index;" class="text-secondary answer-cell" (click)="selectAnswer(i, j)">
<input
type="radio"
[disabled]="isDisabled"
[name]="getInputId(id, i, j, 'desktop')"
[id]="getInputId(id, i, j, 'desktop')"
[checked]="i < responseDetails.answer.length && responseDetails.answer[i] === j"
/>
<label [for]="getInputId(id, i, j, 'desktop')" (click)="$event.stopPropagation()">
{{ rubricDescriptionCell }}
</label>
</td>
</tr>
</tbody>
</table>
<div class="mobile-view" [attr.aria-label]="getAriaLabel()">
<div class="card" *ngFor="let rubricDescriptionRow of questionDetails.rubricDescriptions; let i = index;">
<div class="card-header bg-light">
{{ questionDetails.rubricSubQuestions[i] }}
</div>
<div class="card-body"
[ngClass]="{ 'row-answered': i < responseDetails.answer.length && responseDetails.answer[i] !== RUBRIC_ANSWER_NOT_CHOSEN }">
<div *ngFor="let rubricDescriptionCell of rubricDescriptionRow; let j = index;">
<label>
<div class="table-container">
<table class="table table-bordered desktop-view" [attr.aria-label]="getAriaLabel()">
<thead>
<tr>
<td></td>
<th *ngFor="let choice of questionDetails.rubricChoices" scope="col">{{ choice }}</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let rubricDescriptionRow of questionDetails.rubricDescriptions; let i = index;"
[ngClass]="{ 'row-answered': i < responseDetails.answer.length && responseDetails.answer[i] !== RUBRIC_ANSWER_NOT_CHOSEN }">
<th class="fw-normal" scope="row">{{ questionDetails.rubricSubQuestions[i] }}</th>
<td *ngFor="let rubricDescriptionCell of rubricDescriptionRow; let j = index;" class="text-secondary answer-cell" (click)="selectAnswer(i, j)">
<input
type="radio"
[disabled]="isDisabled"
(click)="selectAnswer(i, j)"
[name]="getInputId(id, i, j, 'mobile')"
[name]="getInputId(id, i, j, 'desktop')"
[id]="getInputId(id, i, j, 'desktop')"
[checked]="i < responseDetails.answer.length && responseDetails.answer[i] === j"
[attr.aria-label]="getAriaLabelForChoice(questionDetails.rubricChoices[j], rubricDescriptionCell, questionDetails.rubricSubQuestions[i])"
>
{{ getChoiceWithDescription(questionDetails.rubricChoices[j], rubricDescriptionCell) }}
</label>
/>
<label [for]="getInputId(id, i, j, 'desktop')" (click)="$event.stopPropagation()">
{{ rubricDescriptionCell }}
</label>
</td>
</tr>
</tbody>
</table>
<div class="mobile-view" [attr.aria-label]="getAriaLabel()">
<div class="card" *ngFor="let rubricDescriptionRow of questionDetails.rubricDescriptions; let i = index;">
<div class="card-header bg-light">
{{ questionDetails.rubricSubQuestions[i] }}
</div>
<div class="card-body"
[ngClass]="{ 'row-answered': i < responseDetails.answer.length && responseDetails.answer[i] !== RUBRIC_ANSWER_NOT_CHOSEN }">
<div *ngFor="let rubricDescriptionCell of rubricDescriptionRow; let j = index;">
<label>
<input
type="radio"
[disabled]="isDisabled"
(click)="selectAnswer(i, j)"
[name]="getInputId(id, i, j, 'mobile')"
[checked]="i < responseDetails.answer.length && responseDetails.answer[i] === j"
[attr.aria-label]="getAriaLabelForChoice(questionDetails.rubricChoices[j], rubricDescriptionCell, questionDetails.rubricSubQuestions[i])"
>
{{ getChoiceWithDescription(questionDetails.rubricChoices[j], rubricDescriptionCell) }}
</label>
</div>
</div>
</div>
</div>
</div>
<button

<div class="button-container">
<button
type="button"
title="Reset choices"
id="btn-reset"
name="button-reset"
class="btn btn-secondary"
(click)="confirmReset()">
Reset choices
</button>
Reset choices
</button>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,12 @@
display: none;
}
}

.table-container {
margin-bottom: 1.25em;
}

.button-container {
display: flex;
justify-content: flex-end;
}

0 comments on commit 0ca6127

Please sign in to comment.