127 lines
3.7 KiB
HTML
127 lines
3.7 KiB
HTML
{% extends "templates/base.html" %}
|
|
{% block title %}
|
|
{{ quiz.title if quiz.name else _("Quiz Details") }}
|
|
{% endblock %}
|
|
|
|
|
|
{% block content %}
|
|
<div class="common-page-style">
|
|
{{ Header() }}
|
|
<div class="container form-width">
|
|
{{ QuizForm(quiz) }}
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|
|
|
|
{% macro QuizForm(quiz) %}
|
|
<div id="quiz-form" {% if quiz.name %} data-name="{{ quiz.name }}" data-index="{{ quiz.questions | length }}" {% endif %}>
|
|
{{ QuizDetails(quiz) }}
|
|
{% if quiz.questions %}
|
|
<div class="field-group">
|
|
<div class="field-label mb-1">
|
|
{{ _("Questions") }}
|
|
</div>
|
|
<div class="common-card-style column-card px-3 py-0">
|
|
{% for question in quiz.questions %}
|
|
{{ Question(question, loop.index) }}
|
|
{% endfor %}
|
|
</div>
|
|
<button class="btn btn-secondary btn-sm btn-add-question mt-4">
|
|
{{ _("Add Question") }}
|
|
</button>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if quiz.name and not quiz.questions | length %}
|
|
{{ EmptyState() }}
|
|
{% endif %}
|
|
</div>
|
|
{% endmacro %}
|
|
|
|
|
|
{% macro Header() %}
|
|
<header class="sticky">
|
|
<div class="container form-width">
|
|
<div class="edit-header">
|
|
<div>
|
|
<div class="page-title">
|
|
{{ _("Quiz Details") }}
|
|
</div>
|
|
<div class="vertically-center small">
|
|
<a class="dark-links" href="/quizzes">
|
|
{{ _("Quiz List") }}
|
|
</a>
|
|
<img class="icon icon-sm mr-0" src="/assets/lms/icons/chevron-right.svg">
|
|
<span class="breadcrumb-destination">
|
|
{{ quiz.title if quiz.title else _("New Quiz") }}
|
|
</span>
|
|
</div>
|
|
</div>
|
|
|
|
{% if quiz.name %}
|
|
<div class="align-self-center">
|
|
<button class="btn btn-primary btn-sm btn-add-question">
|
|
{{ _("Add Question") }}
|
|
</button>
|
|
</div>
|
|
{% endif %}
|
|
|
|
</div>
|
|
</div>
|
|
</header>
|
|
{% endmacro %}
|
|
|
|
{% macro QuizDetails(quiz) %}
|
|
<div class="field-parent">
|
|
<div class="field-group">
|
|
<div>
|
|
<div class="field-label">
|
|
{{ _("Title") }}
|
|
</div>
|
|
<div class="field-description">
|
|
{{ _("Add a title for the quiz") }}
|
|
</div>
|
|
</div>
|
|
<div class="">
|
|
<input type="text" class="field-input" id="quiz-title" {% if quiz.name %} value="{{ quiz.title }}" data-title="{{ quiz.title }}" {% endif %}>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endmacro %}
|
|
|
|
{% macro Question(question, index) %}
|
|
{% set type = question.type if question.type else "Choices" %}
|
|
<div class="list-row question-row" role="button" data-question="{{ question.name }}">
|
|
<div class="flex clickable">
|
|
<span class="mr-1">
|
|
{{ index }}.
|
|
</span>
|
|
{{ question.question.split("\n")[0] }}
|
|
</div>
|
|
</div>
|
|
{% endmacro %}
|
|
|
|
{% macro EmptyState() %}
|
|
<article class="empty-state my-5">
|
|
<div class="text-center">
|
|
<div class="bold-heading">
|
|
{{ _("You have not added any question yet") }}
|
|
</div>
|
|
<div>
|
|
{{ _("Create and manage questions from here.") }}
|
|
</div>
|
|
<div class="mt-4">
|
|
<button class="btn btn-default btn-sm btn-add-question">
|
|
<span>
|
|
{{ _("Add Question") }}
|
|
</span>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</article>
|
|
{% endmacro %}
|
|
|
|
{%- block script %}
|
|
{{ super() }}
|
|
{{ include_script('controls.bundle.js') }}
|
|
{% endblock %} |