vale981_fahrschule/templates/quiz.html
2014-04-29 20:27:42 +02:00

73 lines
2.1 KiB
HTML

{% extends 'quizzes.html' %}
<html lang="en">
<head>
<title>Fahrschule Examiner 0.1</title>
{% load staticfiles %}
<link rel="stylesheet" type="text/css" href="{% static 'css/quizz.css' %}" />
</head>
{% block header %}
{% if len >= 20 %}
<div style="font-size: 20px">{{ quiz.title }}</div>
{% else %}
{{quiz.title}}
{% endif %}
{% endblock %}
{% block main %}
{% if quiz.fragen.count == 0 %}
<br>
<h1 id="main_link" style="text-align: center" align="center">Keine Fragen vorhanden!</h1>
{% endif %}
<form action="/quiz/check/" name="quiz_form" method="post">{% csrf_token %}
<input type="hidden" name="user_log" value="{{ user.id }}">
<input type="hidden" name="quiz" value="{{ quiz.id }}">
{% for Frage in quiz.fragen.all %}
<table class="bordered" style="width: 100%"><tr><th colspan="10"><div id="frage">{{Frage.content}}</div></th>
<input type="hidden" name="frage{{ Frage.id }}" value="{{ Frage.id }}">
</tr>
<tr>
{% for aw in Frage.antworten.all %}
<td colspan="3"><label id="checklabel" for="aw_check{{ aw.id }}">
{% if aw.bild == "" %}{% else %}<img src="/media/{{ aw.bild }}" align="center" width="100"><br>{% endif %}
<input align="center" type="checkbox" id="aw_check{{ aw.id }}" name="aw_check{{ aw.id }}" class="aw_check[{{ Frage.id }}][]" />
{% if aw.bild == "" %}{{ aw.content }}{% else %}{% endif %}
</label>
</td>
<input type="hidden" name="antwort{{ Frage.id }}" value="{{ aw.id }}">
{% endfor %}
</tr></table><br>
{% endfor %}
<input type="submit" class="button" value="Abgeben"/>
</form>
<script>$("input:checkbox").click(function() {
if ($(this).is(":checked")) {
var group = "input:checkbox[class='" + $(this).attr("class") + "']";
$(group).prop("checked", false);
$(this).prop("checked", true);
} else {
$(this).prop("checked", false);
}
});</script>
{% endblock %}
</html>