{% extends "templates/base.html" %} {% block title %} {{ quiz.title if quiz.name else _("Quiz Details") }} {% endblock %} {% block content %}
{{ Header() }}
{{ QuizForm(quiz) }}
{% endblock %} {% macro QuizForm(quiz) %}
{{ QuizDetails(quiz) }} {% if quiz.questions %}
{{ _("Questions") }}
{% for question in quiz.questions %} {{ Question(question, loop.index) }} {% endfor %}
{% endif %} {% if quiz.name and not quiz.questions | length %} {{ EmptyState() }} {% endif %}
{% endmacro %} {% macro Header() %}
{{ _("Quiz Details") }}
{{ _("Quiz List") }} {{ quiz.title if quiz.title else _("New Quiz") }}
{% if quiz.name %} {% endif %}
{% endmacro %} {% macro QuizDetails(quiz) %}
{{ _("Title") }}
{{ _("Add a title for the quiz") }}
{{ _("Max Attempts") }}
{{ _("Enter the maximum number of times a user can attempt this quiz") }}
{% set max_attempts = quiz.max_attempts if quiz.name else 1 %}
{% set show_answers = quiz.show_answers or not quiz.name %}
{% endmacro %} {% macro Question(question, index) %} {% set type = question.type if question.type else "Choices" %}
{{ index }}. {{ question.question.split("\n")[0] }}
{% endmacro %} {% macro EmptyState() %}
{{ _("You have not added any question yet") }}
{{ _("Create and manage questions from here.") }}
{% endmacro %} {%- block script %} {{ super() }} {{ include_script('controls.bundle.js') }} {% endblock %}