94 lines
5.0 KiB
HTML
94 lines
5.0 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">{% if question %}Frage bearbeiten{% else %}Neue Eingabe Frage{% endif %}</h1>
|
|
<a href="{% url 'library:detail_quiz' quiz.id %}"
|
|
class="bg-gray-100 text-gray-700 px-4 py-2 rounded-md hover:bg-gray-200 transition-colors">
|
|
Zurück zum Quiz
|
|
</a>
|
|
</div>
|
|
|
|
<div class="bg-white rounded-lg shadow-md p-6 border-blue-600 border-2 rounded-xl shadow-md">
|
|
<form method="post" class="space-y-6" enctype="multipart/form-data">
|
|
{% csrf_token %}
|
|
|
|
<!-- Question Text -->
|
|
<div>
|
|
<label for="question" class="block text-sm font-medium text-gray-700">Frage</label>
|
|
<div class="mt-1">
|
|
<textarea name="question" id="question" rows="4"
|
|
class="shadow-sm focus:ring-blue-500 focus:border-blue-500 block w-full sm:text-sm border-gray-300 rounded-md"
|
|
required>{{ question.data.question }}</textarea>
|
|
</div>
|
|
</div>
|
|
|
|
{% if image %}
|
|
<img src="{{ image.image.url }}" style="max-width: 100px;" alt="Bild der Frage">
|
|
<label for="reset_image">
|
|
<input type="checkbox" name="reset_ques_image" id="reset_ques_image">
|
|
Bild zurücksetzen
|
|
</label>
|
|
{% endif %}
|
|
<div>
|
|
<label class="font-bold" for="question_image">Bild:</label>
|
|
<input class="bg-blue-200 p-2 m-2 rounded-lg border-2 border-blue-400" type="file" name="question_image" id="question_image">
|
|
</div>
|
|
|
|
<!-- Eingabe -->
|
|
{% if question and question.data.options %}
|
|
{% for option in question.data.options %}
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700 mb-2">Richtige Antwort</label>
|
|
<div class="flex space-x-4">
|
|
<textarea name="correct_answer" rows="2"
|
|
class="shadow-sm focus:ring-blue-500 focus:border-blue-500 flex-grow sm:text-sm border-gray-300 rounded-md"
|
|
required>{{ option.value }}</textarea>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
{% endfor %}
|
|
{% else %}
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700 mb-2">Richtige Antwort</label>
|
|
<div class="flex space-x-4">
|
|
<textarea name="correct_answer" rows="2"
|
|
class="shadow-sm focus:ring-blue-500 focus:border-blue-500 flex-grow sm:text-sm border-gray-300 rounded-md"
|
|
required></textarea>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
{% endif %}
|
|
|
|
|
|
<div class="p-4">
|
|
<label class="font-bold" for="time_per_question">Zeit pro Frage:</label>
|
|
<select name="time_per_question" id="time_per_question">
|
|
<option value="10" {% if standard_time_per_question == "10" or time_per_question == "10" %}selected{% endif %}>10 Sekunden</option>
|
|
<option value="20" {% if standard_time_per_question == "20" or time_per_question == "20" %}selected{% endif %}>20 Sekunden</option>
|
|
<option value="30" {% if standard_time_per_question == "30" or time_per_question == "30" %}selected{% endif %}>30 Sekunden</option>
|
|
<option value="45" {% if standard_time_per_question == "45" or time_per_question == "45" %}selected{% endif %}>45 Sekunden</option>
|
|
<option value="60" {% if standard_time_per_question == "60" or time_per_question == "60" %}selected{% endif %}>1 Minute</option>
|
|
<option value="120" {% if standard_time_per_question == "120" or time_per_question == "120" %}selected{% endif %}>2 Minuten</option>
|
|
<option value="300" {% if standard_time_per_question == "300" or time_per_question == "300" %}selected{% endif %}>5 Minuten</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="flex justify-end space-x-3">
|
|
<a href="{% url 'library:detail_quiz' quiz.id %}"
|
|
class="inline-flex items-center px-4 py-2 border border-gray-300 shadow-sm text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500">
|
|
Abbrechen
|
|
</a>
|
|
<button type="submit"
|
|
class="inline-flex items-center px-4 py-2 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500">
|
|
{% if question %}Speichern{% else %}Erstellen{% endif %}
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|