Skip to content

Commit

Permalink
[DONE] Quiz feature (#1047)
Browse files Browse the repository at this point in the history
* Create Quiz application

* Include application in Pod & add USE_QUIZ setting

* Add Quiz & Question models + fix context processors

* Add UniqueChoiceQuestion model

* Improve models - add validators

* Add urls

* First version of quiz maker

* Improve quiz form

* Manage hidden inputs for question forms

* Manage POST request for quiz creation

* Fix POST create quiz

* Add video quiz page

* Add quiz deletion

* Add links in video completion & info

* Fix JS, handle authentification

* Add admin panel

* Handle maintenance

* Add translations

* Add pydoc & improve models

* Fix quiz edition

* Improve style for quiz creation page

* Fix quiz edition

* Improve video quiz styles

* Add utils function tests

* Auto review & add multiple choice question

* Add __init__ for quiz migrations

* Handle timestamps for quiz creation.

* Add timestamp management in video quiz page

* Remove Union type

* Improve utils UT

* Fix review

* Add model tests

* Fix select form styles

* Fix json.loads for calculate score in quiz submission & Improvements

* Add template tags tests

* Fix imports

* Add first version of README.md to help for adding a new type of question

* Add models tests

* improve util test for quiz

* Add tests for quiz views

* Add __init__.py file in tests folder

* Fix video_completion.html

* Fix translations
  • Loading branch information
AymericJak authored May 27, 2024
1 parent d5291c5 commit da43a2e
Show file tree
Hide file tree
Showing 38 changed files with 4,380 additions and 133 deletions.
76 changes: 60 additions & 16 deletions pod/completion/templates/video_completion.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,26 @@
{% extends 'base.html' %}
{% load i18n %}
{% load static %}
{% load video_quiz %}

{% block page_extra_head %}
<!-- media -->
<link rel="stylesheet" href="{% static 'css/completion.css' %}?ver={{VERSION}}">

<!-- media -->
<link rel="stylesheet" href="{% static 'css/completion.css' %}?ver={{VERSION}}">
{% endblock page_extra_head %}

{% block breadcrumbs %}
{{block.super}}
{{ block.super }}
<li class="breadcrumb-item"><a href="{% url 'video:dashboard' %}">{% trans "Dashboard" %}</a></li>
<li class="breadcrumb-item">
<a href="{% url 'video:video' slug=video.slug %}" title="{{video.title}}">
{{video.title|title|truncatechars:45}}
<a href="{% url 'video:video' slug=video.slug %}" title="{{ video.title }}">
{{ video.title|title|truncatechars:45 }}
</a>
</li>
<li class="breadcrumb-item active" aria-current="page">
{% trans "Video additions" %}
</li>
{% endblock %}

{% block page_content %}

<div class="accordion">
Expand Down Expand Up @@ -123,6 +125,36 @@ <h2 class="accordion-header">
</div>
</div>
</div>

{% if USE_QUIZ %}
<div class="accordion-item">
<h2 class="accordion-header">
<button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#compQuiz" aria-expanded="true" aria-controls="compQuiz">
{% trans 'Quizzes' %}
</button>
</h2>
<div id="compQuiz" class="accordion-collapse collapse">
<div class="accordion-body">
<p class="m-0">
{% is_quiz_exists video as is_quiz_exists %}
{% if is_quiz_exists %}
<a class="btn btn-secondary" href="{% url 'quiz:edit_quiz' video_slug=video.slug %}">{% trans 'Edit your quiz' %}</a>
<span class="form-text">{% trans 'To edit your quiz for this video.' %}</span>
{% else %}
<a class="btn btn-secondary" href="{% url 'quiz:add_quiz' video_slug=video.slug %}">{% trans 'Create a quiz' %}</a>
<span class="form-text">{% trans 'To create a quiz for this video.' %}</span>
{% endif %}
</p>
{% if is_quiz_exists %}
<p>
<a class="btn btn-danger" href="{% url 'quiz:remove_quiz' video_slug=video.slug %}">{% trans 'Delete your quiz' %}</a>
<span class="form-text">{% trans 'To delete your quiz for this video.' %}</span>
</p>
{% endif %}
</div>
</div>
</div>
{% endif %}
{% endif %}
</div>
{% endblock page_content %}
Expand All @@ -143,19 +175,19 @@ <h2 class="card-header card-title pod-card__title h4">
<h2 class="card-header card-title pod-card__title h4">{% trans "Help"%}</h2>
<div class="card-body">
<div id="contributor-info">
<button class="btn btn-link rounded-0 pod-btn" id="heading-1" data-bs-toggle="collapse" data-bs-target="#collapse-1" aria-expanded="false" aria-controls="collapse-1">
<button class="btn btn-link rounded-0 pod-btn" id="heading-1" data-bs-toggle="collapse" data-bs-target="#collapse-contributor" aria-expanded="false" aria-controls="collapse-contributor">
{% trans 'Contributor(s)' %}
</button>
<div id="collapse-1" class="collapse card-text small">
<div id="collapse-contributor" class="collapse card-text small">
<p>{% trans 'List of people related to this video.' %}</p>
<p>{% trans 'A contributor must at least have a name and a role. You can also join the email of this contributor as well as a link (professional website for example).' %}</p>
</div>
</div>
<div id="track-info">
<button class="btn btn-link rounded-0 pod-btn" id="heading-2" data-bs-toggle="collapse" data-bs-target="#collapse-2" aria-expanded="false" aria-controls="collapse-2">
<button class="btn btn-link rounded-0 pod-btn" id="heading-2" data-bs-toggle="collapse" data-bs-target="#collapse-track" aria-expanded="false" aria-controls="collapse-track">
{% trans 'Subtitle(s) and Caption(s)' %}
</button>
<div id="collapse-2" class="collapse card-text small">
<div id="collapse-track" class="collapse card-text small">
<p>{% trans 'Subtitle(s) and/or captions(s) related to this video.' %}</p>
<!-- <p>{% trans 'Several web sites allows you to subtitle or caption videos (for example: Amara)' %}</p> -->
<p>{% trans 'You can add several subtitle or caption files to a single video (for example, in order to subtitle or caption this video in several languages' %}</p>
Expand All @@ -179,26 +211,38 @@ <h2 class="card-header card-title pod-card__title h4">{% trans "Help"%}</h2>
</div>
</div>
<div id="document-info">
<button class="btn btn-link rounded-0 pod-btn" id="heading-3" data-bs-toggle="collapse" data-bs-target="#collapse-3" aria-expanded="false" aria-controls="collapse-3">
<button class="btn btn-link rounded-0 pod-btn" id="heading-3" data-bs-toggle="collapse" data-bs-target="#collapse-document" aria-expanded="false" aria-controls="collapse-document">
{% trans 'Additional resource(s)' %}
</button>
<div id="collapse-3" class="collapse card-text small">
<div id="collapse-document" class="collapse card-text small">
<p>{% trans 'Document(s) related to this video. These documents will be downloadable by users.' %}</p>
<p>{% trans 'Be careful, not to be confused with enrichment. These documents are attached to the video, not integrated.' %}</p>
</div>
</div>
<div id="overlay-info">
<button class="btn btn-link rounded-0 pod-btn" id="heading-4" data-bs-toggle="collapse" data-bs-target="#collapse-4" aria-expanded="false" aria-controls="collapse-4">
<button class="btn btn-link rounded-0 pod-btn" id="heading-4" data-bs-toggle="collapse" data-bs-target="#collapse-overlay" aria-expanded="false" aria-controls="collapse-overlay">
{% trans 'Overlay(s)' %}
</button>
<div id="collapse-4" class="collapse card-text small">
<div id="collapse-overlay" class="collapse card-text small">
<p>{% trans 'Overlay allows you to display text (with ou without html tag) over the video at specific times and positions.' %}</p>
<p>{% trans 'You can add a solid background or a transparent background to the text you want to display with the option "Show background"' %}</p>
</div>
</div>
<!-- Quiz -->
{% if USE_QUIZ %}
<div id="quiz-info">
<button class="btn btn-link rounded-0 pod-btn" id="heading-5" data-bs-toggle="collapse" data-bs-target="#collapse-quiz" aria-expanded="false" aria-controls="collapse-quiz">
{% trans 'Quizzes' %}
</button>
<div id="collapse-quiz" class="collapse card-text small">
<p>{% trans 'Quizzes allow you to test the memorization and comprehension of your video.' %}</p>
</div>
</div>
{% endif %}
</div>
</div>
{% endblock page_aside %}

{% block more_script %}
<script src="{% static 'js/completion.js' %}?ver={{VERSION}}"></script>
{% endblock more_script %}
<script src="{% static 'js/completion.js' %}?ver={{VERSION}}"></script>
{% endblock more_script %}
Binary file modified pod/locale/fr/LC_MESSAGES/django.mo
Binary file not shown.
Loading

0 comments on commit da43a2e

Please sign in to comment.