Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 35 additions & 9 deletions layouts/test/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -271,26 +271,52 @@ <h1>{{ $title }}</h1>
<div class="question-instructions">Select all that apply</div>
{{ else if eq $question.type "single-answer" }}
<div class="question-instructions">Select one answer</div>
{{ else if eq $question.type "true-false" }}
<div class="question-instructions">Select True or False</div>
{{ else if eq $question.type "short-answer" }}
<div class="question-instructions">Type your answer below</div>
{{ end }}
{{ end }}

{{ if or ( eq $question.type "single-answer") ( eq $question.type "multiple-answers" ) }}
{{ if eq $question.type "single-answer" }}
{{ range $optIndex, $option := $question.options }}
<div class="option">
<label>
{{ if eq $question.type "multiple-answers" }}
<input type="checkbox" name="selected_option_ids_{{ $question.id }}" value="{{ $option.id }}">
{{ else }}
<input type="radio" name="selected_option_ids_{{ $question.id }}" value="{{ $option.id }}">
{{ end }}
<span>{{ $option.text }}</span>
</label>
</div>
{{ end }}
{{ end }}

{{ if eq $question.type "multiple-answers" }}
{{ range $optIndex, $option := $question.options }}
<div class="option">
<label>
<input type="checkbox" name="selected_option_ids_{{ $question.id }}" value="{{ $option.id }}">
<span>{{ $option.text }}</span>
</label>
</div>
{{ end }}
{{ end }}

{{ else if (eq $question.type "short-answer") }}
{{ if eq $question.type "true-false" }}

<div class="option">
<label>
<input type="radio" name="selected_option_ids_{{ $question.id }}" value="true">
<span>True</span>
</label>
</div>
<div class="option">
<label>
<input type="radio" name="selected_option_ids_{{ $question.id }}" value="false">
<span>False</span>
</label>
</div>
{{ end }}

{{ if eq $question.type "short-answer" }}
<input type="text" name="answer_text_{{ $question.id }}" class="text-input"
placeholder="Type your answer here">
{{ end }}
Expand Down Expand Up @@ -349,9 +375,9 @@ <h1>{{ $title }}</h1>
{{ $tesAbsPath := .RelPermalink }}

<script>
const testId = {{$test.id}};
const testId = {{ $test.id }};
const testAbsPath = "{{$tesAbsPath}}";
const build = {{$build}};
const build = {{ $build }};


// Event Listeners
Expand Down Expand Up @@ -385,4 +411,4 @@ <h1>{{ $title }}</h1>

</script>

{{ end }}
{{ end }}