{% extends 'shorts/exams.html' %}
{% block navigation %}
    {{ block.super }}
    {% include 'generic/exam_overview_headers.html' %}
{% endblock navigation %}

{% block content %}

    {% load thumbnail %}
    <div class="shorts">

        {% if exam.exam_mode %}
            <a href="{% url exam.get_app_name|add:':mark_overview' pk=exam.pk %}"><button>Mark exam</button></a>
            <a href="{% url 'shorts:mark_review' exam_pk=exam.pk sk=0 %}"><button>Review exam</button></a></p>
        {% endif %}

        <ol id="full-question-list" class="sortable">
            {% for question in questions.all %}

                <li data-question_pk={{question.pk}}>
                    <span class="flex-col">
                        <a href="{% url 'shorts:exam_question_detail' pk=exam.pk sk=forloop.counter0 %}">
                            {% for image in question.get_images %}
                                <img src="{{ image|thumbnail_url:'exam-list' }}" alt="thumbail" />
                            {% empty %}
                            No image added.
                            {% endfor %}
                        </a>
                    </span>
                    <span class="flex-col-4">
                        <span title="Best sample answer">
                        {% if question.get_best_sample_answer %}
                            {{ question.get_best_sample_answer }} (Score: {{question.get_best_sample_answer.score}})

                        {% else %}
                            No sample answer available. <a href='{% url "shorts:question_sample_answers" question.pk %}'>Add one now?</a>
                            
                        {% endif %}
                        </span>
                            
                        <br />
                        Examination: {{ question.get_examinations }},
                        {% if exam.exam_mode %}
                            <a href="{% url 'shorts:mark' exam_pk=exam.pk sk=forloop.counter0 %}">Mark</a>
                        {% endif %}
                        <span class="id"><a href="{% url 'shorts:question_detail' pk=question.pk %}">[id: {{question.pk}}]</a></span>
                    </span>
                </li>
            {% endfor %}
        </ol>
        <div>
            Author: {% for author in exam.author.all %}
                {{ author }},
            {% endfor %}
        </div>
        {% include 'generic/exam_footer.html' %}

    </div>
    {% include 'exam_overview_js.html' %}

{% endblock %}