{% extends "exoral/base.html" %}

{% load static %}

{% block content %}
<div class="container">
  <nav aria-label="breadcrumb">
    <ol class="breadcrumb">
      <li class="breadcrumb-item" aria-current="page"><a href="{% url 'exoral:home' %}">Testate</a></li>
      <li class="breadcrumb-item" aria-current="page"><a href="{% url 'exoral:testat-detail' testat.pk %}">{{ testat }}</a></li>
      <li class="breadcrumb-item active" aria-current="page">{{ pruefer }}</li>
      <li class="breadcrumb-item" aria-current="page">
        <a href="{% url 'exoral:frage-create' testat.pk pruefer.pk %}">neue Frage hinzufügen</a>
      </li>
    </ol>
  </nav>

  {% for frage in fragen %}
  <div class="card mb-2">
    <div class="card-body">
      <div class="row">
        <div class="col">
          <small class="text-muted">{{ frage.datum }}</small>
        </div>
        <div class="col text-right">
          <small>Score: {{ frage.punkte }}</small>
          {% if not frage.abgestimmt %}
          <a href="{% url 'exoral:upvote-frage' frage.pk %}"><img src="{% static "img/icons/plus-square.svg" %}"></a>
          {% else %}
          <a href="{% url 'exoral:downvote-frage' frage.pk %}"><img src="{% static "img/icons/dash-square.svg" %}"></a>
          {% endif %}
        </div>
      </div>
      <p class="card-text">{{ frage.text }}</p>

      {% if frage.antwort %}
      <a data-toggle="collapse" href="#antwort_{{ frage.pk }}" role="button" aria-expanded="false">Antwort</a>
      <div class="collapse" id="antwort_{{ frage.pk }}">
        <p>{{ frage.antwort }}</p>
      </div>
      {% endif %}
    </div>
  </div>
  {% empty %}
  <p>
    Keine Fragen vorhanden.
  </p>
  {% endfor %}
</div>
{% endblock content %}
