194 lines
11 KiB
HTML
194 lines
11 KiB
HTML
{% extends 'base.html' %}
|
|
|
|
{% block content %}
|
|
|
|
<div class="container mx-auto px-4">
|
|
<div class="flex justify-between items-center mb-6">
|
|
<h1 class="text-2xl font-bold">{{ quiz.name }}</h1>
|
|
<div class="flex space-x-2">
|
|
{% if quiz.user_id == request.user %}
|
|
<a href="{% url 'library:edit_quiz' quiz.id %}" class=" text-white px-4 py-2 rounded-md text-sm lg:text-lg hover:scale-110 transition-colors">
|
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-7 text-gray-600">
|
|
<path stroke-linecap="round" stroke-linejoin="round" d="m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L10.582 16.07a4.5 4.5 0 0 1-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 0 1 1.13-1.897l8.932-8.931Zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0 1 15.75 21H5.25A2.25 2.25 0 0 1 3 18.75V8.25A2.25 2.25 0 0 1 5.25 6H10" />
|
|
</svg>
|
|
|
|
</a>
|
|
<a href="{% url 'library:delete_quiz' quiz.id %}" class=" text-white px-4 py-2 rounded-md text-sm lg:text-lg hover:scale-110 transition-colors">
|
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-7 text-gray-600">
|
|
<path stroke-linecap="round" stroke-linejoin="round" d="m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0" />
|
|
</svg>
|
|
</a>
|
|
{% endif %}
|
|
<a href="{% url 'library:copy_quiz' quiz.id %}" class="inline-flex items-center px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors duration-200">
|
|
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 mr-2" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4" />
|
|
</svg>
|
|
Quiz kopieren
|
|
</a>
|
|
</div>
|
|
</div>
|
|
|
|
{% if quiz.description %}
|
|
<p class="text-gray-600 mb-4">{{ quiz.description }}</p>
|
|
{% endif %}
|
|
<div class="flex justify-end mb-4">
|
|
{% if detail == True %}
|
|
|
|
<a href="{% url 'library:detail_quiz' quiz.id %}?show_answers=false">
|
|
<div class="flex items-center">
|
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6">
|
|
<path stroke-linecap="round" stroke-linejoin="round" d="M3.98 8.223A10.477 10.477 0 0 0 1.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.451 10.451 0 0 1 12 4.5c4.756 0 8.773 3.162 10.065 7.498a10.522 10.522 0 0 1-4.293 5.774M6.228 6.228 3 3m3.228 3.228 3.65 3.65m7.894 7.894L21 21m-3.228-3.228-3.65-3.65m0 0a3 3 0 1 0-4.243-4.243m4.242 4.242L9.88 9.88" />
|
|
</svg>
|
|
Antworten verstecken
|
|
</div>
|
|
|
|
</a>
|
|
{% else %}
|
|
|
|
<a href="{% url 'library:detail_quiz' quiz.id %}?show_answers=true">
|
|
<div class="flex items-center">
|
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6">
|
|
<path stroke-linecap="round" stroke-linejoin="round" d="M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z" />
|
|
<path stroke-linecap="round" stroke-linejoin="round" d="M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z" />
|
|
</svg>
|
|
Antworten anzeigen
|
|
</div>
|
|
|
|
</a>
|
|
|
|
{% endif %}
|
|
</div>
|
|
|
|
|
|
<div class="bg-white rounded-lg shadow-md border-blue-600 border-2 rounded-xl shadow-md">
|
|
<div class="border-b border-gray-200 p-4">
|
|
<div class="flex justify-between items-center">
|
|
<h2 class="text-xl font-semibold">Fragen</h2>
|
|
<div class="flex space-x-2">
|
|
{% if quiz.user_id == request.user %}
|
|
<a href="{% url 'library:new_question' %}?type=multiple_choice&quiz_id={{ quiz.id }}"
|
|
class="bg-blue-100 text-blue-800 px-4 py-2 rounded-md text-xs lg:text-lg hover:border-blue-600 border-2">
|
|
Multiple Choice
|
|
</a>
|
|
{% endif %}
|
|
{% if quiz.user_id == request.user %}
|
|
<a href="{% url 'library:new_question' %}?type=true_false&quiz_id={{ quiz.id }}"
|
|
class="bg-purple-100 text-purple-800 px-4 py-2 rounded-md text-xs lg:text-lg hover:border-blue-600 border-2">
|
|
Wahr/Falsch
|
|
</a>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{% if questions %}
|
|
|
|
<div class="divide-y divide-gray-200">
|
|
{% for question in questions %}
|
|
|
|
<div class="w-full rounded-xl p-4 hover:bg-gray-50">
|
|
{% if quiz.user_id == request.user %} <a class="block flex h-full w-full" href="{% url 'library:edit_question' question.id %}" > {% endif %}
|
|
<div class="flex justify-between items-start">
|
|
|
|
<div class="flex-grow">
|
|
<p class="font-medium">{{ question.data.question }}</p>
|
|
<div class="mt-1">
|
|
<span class="inline-flex items-center px-2 py-0.5 rounded text-xs font-medium {% if question.data.type == 'multiple_choice' %}bg-blue-100 text-blue-800{% else %}bg-purple-100 text-purple-800{% endif %}">
|
|
{% if question.data.type == 'multiple_choice' %}Multiple Choice{% else %}Wahr/Falsch{% endif %}
|
|
</span>
|
|
</div>
|
|
<div class="mt-2">
|
|
{% if detail %}
|
|
|
|
{% if question.data.type == 'multiple_choice' %}
|
|
<ul class="space-y-1 ">
|
|
{% for option in question.data.options %}
|
|
<li class="flex items-center text-sm">
|
|
{% if option.is_correct %}
|
|
<svg class="h-4 w-4 text-green-500 mr-1.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/>
|
|
</svg>
|
|
<span class="font-medium text-green-700">{{ option.value }}</span>
|
|
{% else %}
|
|
<svg class="h-4 w-4 text-gray-400 mr-1.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M18 12H6"/>
|
|
</svg>
|
|
<span class="text-gray-600">{{ option.value }}</span>
|
|
{% endif %}
|
|
</li>
|
|
{% endfor %}
|
|
</ul>
|
|
{% else %}
|
|
{% for option in question.data.options %}
|
|
{% if option.is_correct %}
|
|
<p class="text-sm">
|
|
<span class="text-gray-500">Richtige Antwort:</span>
|
|
<span class="ml-1 font-medium {% if option.value == "Wahr" %} text-green-700 {% else %}text-red-700{% endif %}">{{ option.value }}</span>
|
|
</p>
|
|
{% endif %}
|
|
{% endfor %}
|
|
|
|
{% endif %}
|
|
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="flex h-full space-x-2 ml-4 items-center">
|
|
|
|
<a href=" {% url 'library:delete_question' question.id %}"
|
|
class=" text-red-700 px-4 py-1 rounded hover:scale-110 ">
|
|
{% if quiz.user_id == request.user %}
|
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-7 text-gray-600">
|
|
<path stroke-linecap="round" stroke-linejoin="round" d="m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0" />
|
|
</svg>
|
|
{% endif %}
|
|
</a>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</a>
|
|
|
|
{% endfor %}
|
|
</div>
|
|
|
|
{% else %}
|
|
|
|
<div class="p-8 text-center">
|
|
<svg class="mx-auto h-12 w-12 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"/>
|
|
</svg>
|
|
<p class="mt-2 text-sm text-gray-500">Noch keine Fragen vorhanden. Erstellen Sie eine neue Frage, um loszulegen!</p>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<div class="flex justify-end">
|
|
{% if quiz.base_quiz %}
|
|
<p class="text-gray-600 mt-2 ">Bearbeitung:<span class="font-bold"> {{ quiz.user_id}}</span></p>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<div class="flex justify-end">
|
|
{% if quiz.base_quiz %}
|
|
<p class="text-gray-600 mt-2 ">Kopie von: <a href="{% url 'library:detail_quiz' quiz.base_quiz.id %}"><span class="font-bold">{{ quiz.base_quiz}}</span></a></p>
|
|
{% endif %}
|
|
</div>
|
|
<div class="flex justify-end">
|
|
{% if quiz.base_quiz %}
|
|
<p class="text-gray-600 mb-2">Autor:<span class="font-bold"> {{ quiz.base_quiz.user_id}}</span></p>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<div class="flex justify-end">
|
|
{% if quiz.credits %}
|
|
<p class="text-gray-600 mb-2">Credits:<span class="font-bold"> {{ quiz.credits }}</span></p>
|
|
{% endif %}
|
|
</div>
|
|
|
|
</div>
|
|
{% endblock %}
|