Merge branch '62-antwortenanzeige-bearbeiten' into 'master'
Resolve "Antwortenanzeige bearbeiten" Closes #62 See merge request enrichment-2024/qivip!28
This commit is contained in:
@@ -130,8 +130,8 @@ def delete_quiz(request, pk):
|
|||||||
def detail_quiz(request, pk):
|
def detail_quiz(request, pk):
|
||||||
#quiz = get_object_or_404(QivipQuiz, pk=pk, user_id=request.user)
|
#quiz = get_object_or_404(QivipQuiz, pk=pk, user_id=request.user)
|
||||||
quiz = get_object_or_404(QivipQuiz, pk=pk)
|
quiz = get_object_or_404(QivipQuiz, pk=pk)
|
||||||
|
show_answers = request.GET.get('show_answers', 'false').lower() == 'true'
|
||||||
questions = QivipQuestion.objects.filter(quiz_id=quiz)
|
questions = QivipQuestion.objects.filter(quiz_id=quiz)
|
||||||
|
|
||||||
# Parse JSON data for each question
|
# Parse JSON data for each question
|
||||||
for question in questions:
|
for question in questions:
|
||||||
if question.data:
|
if question.data:
|
||||||
@@ -139,7 +139,8 @@ def detail_quiz(request, pk):
|
|||||||
|
|
||||||
context = {
|
context = {
|
||||||
'quiz': quiz,
|
'quiz': quiz,
|
||||||
'questions': questions
|
'questions': questions,
|
||||||
|
'detail':show_answers,
|
||||||
}
|
}
|
||||||
return render(request, 'library/detail_quiz.html', context)
|
return render(request, 'library/detail_quiz.html', context)
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
|
|
||||||
<div class="container mx-auto px-4">
|
<div class="container mx-auto px-4">
|
||||||
<div class="flex justify-between items-center mb-6">
|
<div class="flex justify-between items-center mb-6">
|
||||||
<h1 class="text-2xl font-bold">{{ quiz.name }}</h1>
|
<h1 class="text-2xl font-bold">{{ quiz.name }}</h1>
|
||||||
@@ -28,7 +27,33 @@
|
|||||||
{% if quiz.description %}
|
{% if quiz.description %}
|
||||||
<p class="text-gray-600 mb-4">{{ quiz.description }}</p>
|
<p class="text-gray-600 mb-4">{{ quiz.description }}</p>
|
||||||
{% endif %}
|
{% 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="bg-white rounded-lg shadow-md border-blue-600 border-2 rounded-xl shadow-md">
|
||||||
@@ -69,6 +94,8 @@
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-2">
|
<div class="mt-2">
|
||||||
|
{% if detail %}
|
||||||
|
|
||||||
{% if question.data.type == 'multiple_choice' %}
|
{% if question.data.type == 'multiple_choice' %}
|
||||||
<ul class="space-y-1 ">
|
<ul class="space-y-1 ">
|
||||||
{% for option in question.data.options %}
|
{% for option in question.data.options %}
|
||||||
@@ -96,7 +123,12 @@
|
|||||||
</p>
|
</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user