131 lines
4.1 KiB
HTML
131 lines
4.1 KiB
HTML
{% if attempts_exceeded %}
|
|
<div class="">
|
|
<h2 class="mt-3">
|
|
{{ quiz.title }}
|
|
</h2>
|
|
<div class="alert alert-info medium mb-0">
|
|
{{ _("You have already exceeded the maximum number of attempts allowed for this quiz.") }}
|
|
{{ _("Your latest score is {0}.").format(last_attempt_score) }}
|
|
</div>
|
|
</div>
|
|
|
|
{% else %}
|
|
<div class="">
|
|
<div id="start-banner" class="common-card-style column-card align-items-center">
|
|
|
|
<div class="text-center my-10">
|
|
<div class="bold-heading" id="quiz-title" data-name="{{ quiz.name }}" data-max-attempts="{{ quiz.max_attempts }}">
|
|
{{ quiz.title }}
|
|
</div>
|
|
|
|
<div class="">
|
|
{{ _("This quiz consists of {0} questions.").format(quiz.questions | length) }}
|
|
</div>
|
|
|
|
{% if quiz.max_attempts %}
|
|
{% set suffix = "times" if quiz.max_attempts > 1 else "time" %}
|
|
<div class="alert alert-info medium">
|
|
{{ _("This quiz can only be taken {0} {1}. If you attempt the quiz but leave the page before submitting,
|
|
the quiz will be automatically submitted.").format(quiz.max_attempts, suffix) }}
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if quiz.time %}
|
|
<div class="alert alert-info medium">
|
|
{{ _("The quiz has a time limit. For each question you will be given {0} seconds.").format(quiz.time) }}
|
|
</div>
|
|
{% endif %}
|
|
|
|
<button class="btn btn-secondary btn-sm btn-start-quiz mt-4">
|
|
{{ _("Start the Quiz") }}
|
|
</button>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
<form id="quiz-form" class="common-card-style column-card hide">
|
|
<div class="questions">
|
|
{% for question in quiz.questions %}
|
|
{% set instruction = _("Choose all answers that apply") if question.type == "Choices" and question.multiple else _("Choose one answer") if question.type == "Choices" else _("Enter the correct answer") %}
|
|
|
|
<div class="question hide" data-name="{{ question.name }}" data-type="{{ question.type }}"
|
|
data-multi="{{ question.multiple }}" data-qt-index="{{ loop.index }}">
|
|
<div>
|
|
<div class="question-number">
|
|
{{ _("Question ") }}{{ loop.index }}: {{ instruction }}</div>
|
|
<div class="question-text">
|
|
{{ question.question }}
|
|
</div>
|
|
</div>
|
|
|
|
{% if question.type == "Choices" %}
|
|
{% set options = [question.option_1, question.option_2, question.option_3, question.option_4] %}
|
|
{% for option in options %}
|
|
{% if option %}
|
|
<div class="mb-2">
|
|
<div class="custom-checkbox">
|
|
<label class="option-row">
|
|
<input class="option" value="{{ option | urlencode }}"
|
|
{% if question.multiple %} type="checkbox" {% else %} type="radio" name="{{ question.question | urlencode }}" {% endif %}>
|
|
<div class="option-text">{{ frappe.utils.md_to_html(option) }}</div>
|
|
</label>
|
|
</div>
|
|
|
|
{% set explanation = question['explanation_' + loop.index | string] %}
|
|
{% if explanation %}
|
|
<small class="explanation ml-10 hide">{{ explanation }}</small>
|
|
{% endif %}
|
|
</div>
|
|
{% endif %}
|
|
{% endfor %}
|
|
|
|
{% else %}
|
|
<div class="control-input-wrapper">
|
|
<div class="control-input">
|
|
<textarea type="text" autocomplete="off" class="input-with-feedback form-control bold possibility mt-4" style="height: 150px;" spellcheck="false"></textarea>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
|
|
<div class="quiz-footer">
|
|
<span>
|
|
{{ _("Question") }}
|
|
<span class="current-question">1</span>
|
|
{{ _("of") }}
|
|
{{ quiz.questions | length }}
|
|
</span>
|
|
|
|
{% if quiz.time %}
|
|
<div class="progress timer w-75" data-time="{{ quiz.time }}">
|
|
<div class="progress-bar" role="progressbar" aria-valuenow="100" aria-valuemin="0"
|
|
aria-valuemax="100"style="width:100%">
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
|
|
<button class="btn btn-secondary btn-sm pull-right" id="check" disabled>
|
|
{{ _("Check") }}
|
|
</button>
|
|
<div class="btn btn-secondary btn-sm hide" id="next">
|
|
{{ _("Next Question") }}
|
|
</div>
|
|
<div class="btn btn-secondary btn-sm hide" id="summary">
|
|
{{ _("Submit") }}
|
|
</div>
|
|
<small id="submission-message" class="font-weight-bold hide">
|
|
{{ _("Please join the course to submit the Quiz.") }}
|
|
</small>
|
|
<div class="btn btn-secondary btn-sm hide" id="try-again">
|
|
{{ _("Try Again") }}
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
{% endif %}
|