1
0
This commit is contained in:
2025-12-22 03:19:48 +01:00
parent d6bd08d11f
commit f1c93c47b6
16 changed files with 288 additions and 31 deletions

View File

@@ -2,7 +2,10 @@
{% block content %}
<style>
.filter-section { margin-bottom: 20px; }
.filter-section {
margin-bottom: 20px;
}
.tag-chip {
display: inline-block;
padding: 5px 12px;
@@ -14,13 +17,16 @@
font-size: 14px;
transition: background 0.2s;
}
.tag-chip.active {
background: #4CAF50;
color: white;
}
.tag-chip:hover {
background: #d5d5d5;
}
.tag-chip.active:hover {
background: #45a049;
}
@@ -29,18 +35,19 @@
<h1>Quiz Application</h1>
<div class="filter-section">
<a href="{% url 'create_quiz' %}" class="tag-chip" style="background: #2196F3; color: white;">+ New Quiz</a>
<a href="?tag=" class="tag-chip {% if not current_tag %}active{% endif %}">All</a>
{% for tag in tags %}
<a href="?tag={{ tag.slug }}" class="tag-chip {% if current_tag == tag.slug %}active{% endif %}">
{{ tag.name }}
</a>
<a href="?tag={{ tag.slug }}" class="tag-chip {% if current_tag == tag.slug %}active{% endif %}">
{{ tag.name }}
</a>
{% endfor %}
</div>
<div class="progress">
<div class="progress-bar" style="width: {% if total_questions > 0 %}{{ answered_count|floatformat:0 }}{% else %}0{% endif %}%"></div>
<div class="progress-bar"
style="width: {% if total_questions > 0 %}{{ answered_count|floatformat:0 }}{% else %}0{% endif %}%"></div>
</div>
<p>Besvarade frågor: {{ answered_count }} / {{ total_questions }}</p>
<div id="quiz-container" hx-get="{% url 'next_question' %}" hx-trigger="load"></div>
{% endblock %}
{% endblock %}

View File

@@ -0,0 +1,64 @@
{% extends "base.html" %}
{% block content %}
<style>
.form-group {
margin-bottom: 20px;
}
label {
display: block;
margin-bottom: 5px;
font-weight: bold;
}
.form-control {
width: 100%;
padding: 8px;
border: 1px solid #ddd;
border-radius: 4px;
}
.btn {
background: #4CAF50;
color: white;
padding: 10px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
}
.btn:hover {
background: #45a049;
}
</style>
<h1>Create New Quiz</h1>
<form method="post">
{% csrf_token %}
<div class="form-group">
<label for="{{ form.course.id_for_label }}">Course:</label>
{{ form.course }}
</div>
<div class="form-group">
<label for="{{ form.tags.id_for_label }}">Tags:</label>
{{ form.tags }}
<small style="color: grey; display: block; margin-top: 5px;">Hold Ctrl (or Cmd) to select multiple tags.</small>
</div>
<div class="form-group">
<label for="{{ form.question_type.id_for_label }}">Question Type:</label>
{{ form.question_type }}
<small style="color: grey; display: block; margin-top: 5px;">Hold Ctrl (or Cmd) to select multiple
types.</small>
</div>
<button type="submit" class="btn">Start Quiz</button>
</form>
<p><a href="{% url 'index' %}">Back to Dashboard</a></p>
{% endblock %}