First Commit
This commit is contained in:
commit
ce0758fbbb
496 changed files with 52062 additions and 0 deletions
21
templates/games/quiz/create_quiz.html
Normal file
21
templates/games/quiz/create_quiz.html
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
{% extends 'layout.html' %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container">
|
||||
<h2>Créer un quiz</h2>
|
||||
<ul class="breadcrumbs">
|
||||
<li><a href="{% url 'portal_games' %}">Portail de jeux</a> »</li>
|
||||
<li><a href="{% url 'quiz_home' %}">Quiz</a> »</li>
|
||||
<li>Créer un quiz</li>
|
||||
</ul>
|
||||
<p>
|
||||
Créez un quiz pour tester les connaissances des autres membres de la communauté. Vous pouvez ajouter autant de questions que vous le souhaitez, et pour chaque question, autant de réponses que vous le souhaitez. Pour chaque question, une seule réponse est correcte.
|
||||
</p>
|
||||
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
<button type="submit" class="btn btn-add">Créer le quiz et ajouter des réponses</button>
|
||||
</form>
|
||||
</div>
|
||||
{% endblock %}
|
||||
51
templates/games/quiz/create_responses_quiz.html
Normal file
51
templates/games/quiz/create_responses_quiz.html
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
{% extends 'layout.html' %}
|
||||
{% load static %}
|
||||
|
||||
{% block extrajs %}
|
||||
<script src="{% static 'js/games/quiz.js' %}" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container">
|
||||
<h2>{{ quiz.name }}</h2>
|
||||
<ul class="breadcrumbs">
|
||||
<li><a href="{% url 'portal_games' %}">Portail de jeux</a> »</li>
|
||||
<li><a href="{% url 'quiz_home' %}">Quiz</a> »</li>
|
||||
<li><a href="{% url 'quiz' quiz.id %}">{{ quiz.name }}</a> »</li>
|
||||
<li>Création</li>
|
||||
</ul>
|
||||
<p>
|
||||
Créez des questions pour votre quiz. Pour chaque question, vous pouvez ajouter autant de réponses que vous le souhaitez. Pour chaque question, une seule réponse est correcte.
|
||||
</p>
|
||||
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
<div id="questions"></div>
|
||||
<a class="btn btn-default btn-small" id="add-ask">Ajouter une question</a>
|
||||
<button type="submit" class="btn btn-add">Mettre à jour le quiz</button>
|
||||
</form>
|
||||
<h3>Questions existantes pour le quiz</h3>
|
||||
<table class="quiz">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Question</th>
|
||||
<th>Réponses</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for question in quiz.questions.all %}
|
||||
<tr>
|
||||
<td>{{ question.question }}</td>
|
||||
<td>
|
||||
<ul>
|
||||
{% for choice in question.choices.all %}
|
||||
<li style="{% if choice.is_correct %}color:green;{% else %}color:orange;{% endif %}">{{ choice.choice }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% endblock %}
|
||||
71
templates/games/quiz/home.html
Normal file
71
templates/games/quiz/home.html
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
{% extends 'layout.html' %}
|
||||
{% load custom_filters %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container">
|
||||
<h2>Liste des quiz</h2>
|
||||
<ul class="breadcrumbs">
|
||||
<li><a href="{% url 'portal_games' %}">Portail de jeux</a> »</li>
|
||||
<li>Quiz</li>
|
||||
</ul>
|
||||
{% if request.user.is_authenticated %}
|
||||
<a href="{% url 'create_quiz' %}" class="btn btn-primary">Créer un quiz</a>
|
||||
{% endif %}
|
||||
{% if pending_quizes_count > 0 %}
|
||||
<a href="/admin/quiz/quiz/" class="btn btn-warning">Activer {{ pending_quizes_count }} quizes</a>
|
||||
{% endif %}
|
||||
<div class="row">
|
||||
{% for quiz in quizes %}
|
||||
<div class="col-5">
|
||||
<div class="card-game {% if not quiz.is_active %}deactivate{% endif %}">
|
||||
<div class="header">
|
||||
<h3>
|
||||
<a href="{% url 'quiz' quiz.id %}">{{ quiz.name }}</a>
|
||||
{% if not quiz.is_active %}
|
||||
<span style="color:red">Non Publié</span>
|
||||
{% endif %}
|
||||
</h3>
|
||||
{% if quiz.id in user_scores %}
|
||||
<span>Mon score: {{ user_scores|get_item:quiz.id }}/{{ quiz.questions.count }}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="body">
|
||||
<p>{{ quiz.description }}</p>
|
||||
<p>{{ quiz.questions.count }} questions</p>
|
||||
</div>
|
||||
<div class="footer">Créé par <span class="{{ quiz.author.username_decoration }}">{{ quiz.author }}</span> le {{ quiz.created }}</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<h3>Mes quiz</h3>
|
||||
<table class="quiz">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Nom</th>
|
||||
<th>Créé le</th>
|
||||
<th>Statut</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for my_quiz in my_quizes %}
|
||||
<tr>
|
||||
<td><a href="{% url 'quiz' my_quiz.id %}">{{ my_quiz.name }}</a></td>
|
||||
<td>{{ my_quiz.created }}</td>
|
||||
<td>
|
||||
{% if my_quiz.is_active %}
|
||||
<span style="color:green"">Publié</span>
|
||||
{% else %}
|
||||
<span style="color:orangered"">Non Publié</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
<a href="{% url 'create_responses_quiz' my_quiz.id %}">Modifier</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% endblock %}
|
||||
41
templates/games/quiz/quiz.html
Normal file
41
templates/games/quiz/quiz.html
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
{% extends 'layout.html' %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container">
|
||||
<h2 class="quiz-title">{{ quiz.name }}</h2>
|
||||
<ul class="breadcrumbs">
|
||||
<li><a href="{% url 'portal_games' %}">Portail de jeux</a> »</li>
|
||||
<li><a href="{% url 'quiz_home' %}">Quiz</a> »</li>
|
||||
<li>{{ quiz.name }}</li>
|
||||
</ul>
|
||||
|
||||
<form method="post" class="quiz-form">
|
||||
{% csrf_token %}
|
||||
{% for question in questions %}
|
||||
<div class="quiz-question">
|
||||
<div class="question-header">Question {{ forloop.counter }}</div>
|
||||
<div class="question-content">
|
||||
<h3>{{ question.question }}</h3>
|
||||
<div class="choices-container">
|
||||
{% for choice in question.choices.all %}
|
||||
<div class="choice-item">
|
||||
<input type="radio"
|
||||
name="question_{{ question.id }}"
|
||||
value="{{ choice.id }}"
|
||||
id="choice_{{ choice.id }}"
|
||||
required>
|
||||
<label for="choice_{{ choice.id }}">
|
||||
{{ choice.choice }}
|
||||
</label>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
<div class="submit-container">
|
||||
<button type="submit" class="submit-button">Valider mes réponses</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
{% endblock %}
|
||||
62
templates/games/quiz/result.html
Normal file
62
templates/games/quiz/result.html
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
{% extends 'layout.html' %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container">
|
||||
<h2>{{ user_quiz.quiz.name }}</h2>
|
||||
<ul class="breadcrumbs">
|
||||
<li><a href="{% url 'portal_games' %}">Portail de jeux</a> »</li>
|
||||
<li><a href="{% url 'quiz_home' %}">Quiz</a> »</li>
|
||||
<li><a href="{% url 'quiz' user_quiz.quiz.id %}">{{ user_quiz.quiz.name }}</a> »</li>
|
||||
<li>Résultas</li>
|
||||
</ul>
|
||||
<div class="quiz-result-card">
|
||||
<!-- Progress Circle -->
|
||||
<div class="progress-circle-container">
|
||||
<div class="progress-circle">
|
||||
<svg viewBox="0 0 36 36" class="circular-chart">
|
||||
<!-- Cercle de fond -->
|
||||
<path d="M18 2.0845
|
||||
a 15.9155 15.9155 0 0 1 0 31.831
|
||||
a 15.9155 15.9155 0 0 1 0 -31.831"
|
||||
stroke="#eee"
|
||||
fill="none"
|
||||
stroke-width="3"/>
|
||||
<!-- Cercle de progression -->
|
||||
<path d="M18 2.0845
|
||||
a 15.9155 15.9155 0 0 1 0 31.831
|
||||
a 15.9155 15.9155 0 0 1 0 -31.831"
|
||||
stroke-dasharray="{{ percentage }}, 100"
|
||||
class="progress-path {% if percentage >= 75 %}high{% elif percentage >= 50 %}medium{% else %}low{% endif %}"
|
||||
fill="none"
|
||||
stroke-width="3"/>
|
||||
</svg>
|
||||
<div class="percentage-text">
|
||||
{{ percentage|floatformat:0 }}%
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Score Details -->
|
||||
<div class="score-details">
|
||||
<h3>Score final</h3>
|
||||
<div class="score-number {% if percentage >= 75 %}high{% elif percentage >= 50 %}medium{% else %}low{% endif %}">
|
||||
{{ user_quiz.score }} / {{ total_questions }}
|
||||
</div>
|
||||
<p class="score-message">
|
||||
{% if percentage >= 75 %}
|
||||
🎉 Excellent travail !
|
||||
{% elif percentage >= 50 %}
|
||||
🎯 Bon effort !
|
||||
{% else %}
|
||||
💪 Continue tes efforts !
|
||||
{% endif %}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- Actions -->
|
||||
<div class="actions">
|
||||
<a href="{% url 'quiz_home' %}" class="btn btn-large">Retour aux quiz</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
Loading…
Add table
Add a link
Reference in a new issue