Skip to content

Commit

Permalink
[DONE] Some corrections on Video QUIZ (#1146)
Browse files Browse the repository at this point in the history
* Some corrections on Video QUIZ :
* Replace some b tags by strong
* Correct collapsed state of video completion accordion
* JS : replace "checkValidity" by "reportValidity" to use browser validation process and UI
* Comment some unused JS funcs in playlists
* Display question number on some help texts
* Code formatting
* Split update_questions in 2 functions for Flake8 compliance (less complexity)
  • Loading branch information
Badatos authored Jun 6, 2024
1 parent 02e0a60 commit 3fc3348
Show file tree
Hide file tree
Showing 30 changed files with 864 additions and 588 deletions.
2 changes: 1 addition & 1 deletion pod/ai_enhancement/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ def send_email_enhancement(video):
+ ", and is now available on %(site_title)s."
)
% {
"content_title": "<b>%s</b>" % video.title,
"content_title": "<strong>%s</strong>" % video.title,
"site_title": __TITLE_SITE__,
},
_("You will find it here:"),
Expand Down
4 changes: 2 additions & 2 deletions pod/ai_enhancement/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def send_enhancement_creation_request(
messages.add_message(
request,
messages.ERROR,
_("Something wrong... Status error: ")
_("Something wrong Status error: ")
+ creation_response["status"],
)
else:
Expand Down Expand Up @@ -202,7 +202,7 @@ def delete_enhancement_request(
messages.add_message(
request,
messages.ERROR,
_("Something wrong... Status error: ")
_("Something wrong Status error: ")
+ deletion_response["status"],
)
else:
Expand Down
48 changes: 22 additions & 26 deletions pod/completion/templates/video_completion.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<div class="accordion">
<div class="accordion-item">
<h2 class="accordion-header">
<button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#compContributors" aria-expanded="true" aria-controls="compContributors">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#compContributors" aria-expanded="false" aria-controls="compContributors">
{% trans 'Contributor(s)' %}
</button>
</h2>
Expand All @@ -51,7 +51,7 @@ <h2 class="accordion-header">
{% if request.user.is_staff %}
<div class="accordion-item">
<h2 class="accordion-header">
<button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#compSubtitles" aria-expanded="true" aria-controls="compSubtitles">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#compSubtitles" aria-expanded="false" aria-controls="compSubtitles">
{% trans 'Subtitle(s) and Caption(s)' %}
</button>
</h2>
Expand Down Expand Up @@ -80,7 +80,7 @@ <h2 class="accordion-header">

<div class="accordion-item">
<h2 class="accordion-header">
<button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#compDocument" aria-expanded="true" aria-controls="compDocument">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#compDocument" aria-expanded="false" aria-controls="compDocument">
{% trans 'Additional resource(s)' %}
</button>
</h2>
Expand All @@ -104,7 +104,7 @@ <h2 class="accordion-header">

<div class="accordion-item">
<h2 class="accordion-header">
<button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#compOverlay" aria-expanded="true" aria-controls="compOverlay">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#compOverlay" aria-expanded="false" aria-controls="compOverlay">
{% trans 'Overlay(s)' %}
</button>
</h2>
Expand All @@ -114,7 +114,7 @@ <h2 class="accordion-header">

<span id="form_overlay">
{% if form_overlay %}
{% include 'overlay/form_overlay.html' with form_overlay=form_overlay %}
{% include 'overlay/form_overlay.html' with form_overlay=form_overlay %}
{% endif %}
</span>
<form class="form_new completion" id="form_new_overlay" action="{% url 'video:completion:video_completion_overlay' slug=video.slug %}" method="POST">
Expand All @@ -129,28 +129,20 @@ <h2 class="accordion-header">
{% 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 class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#compQuiz" aria-expanded="false" aria-controls="compQuiz">
{% trans 'Quiz' %}
</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>
{% is_quiz_accessible video as is_quiz_accessible %}
{% if is_quiz_accessible %}
<a class="btn btn-primary btn-sm m-1" href="{% url 'quiz:video_quiz' video.slug %}" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{% trans "Answer the quiz" %}" role="button">
<i class="bi bi-controller pod-nav-link-icon mx-1" aria-hidden="true"></i>
<span class="ms-1 d-none d-md-inline">{% trans 'Answer the quiz' %}</span>
</a>
{% endif %}
{% include 'quiz/manage_quiz.html' %}
</div>
</div>
</div>
Expand Down Expand Up @@ -197,13 +189,17 @@ <h2 class="card-header card-title pod-card__title h4">{% trans "Help"%}</h2>
<ul class="list-group">
{% for vid in video.get_video_mp4 %}
<li class="list-group-item">
<label for="vid_{{vid.name}}">{{vid.name}}{% trans ":" %}</label>
<label for="vid_{{vid.name}}">
{% blocktrans with name=vid.name %}{{ name }}:{% endblocktrans %}
</label>
<input id="vid_{{vid.name}}" type="text" value="{% if request.is_secure %}https{% else %}http{% endif %}://{{ request.META.HTTP_HOST }}{{vid.source_file.url}}" readonly>
</li>
{% endfor %}
{% if video.is_video == False and video.get_video_mp3 %}
<li class="list-group-item">
<label for="aud_source_url">{{video.get_video_mp3.name}}{% trans ":" %}</label>
<label for="aud_source_url">
{% blocktrans with name=video.get_video_mp3.name %}{{ name }}:{% endblocktrans %}
</label>
<input id="aud_source_url" type="text" value="{% if request.is_secure %}https{% else %}http{% endif %}://{{ request.META.HTTP_HOST }}{{video.get_video_mp3.source_file.url}}" readonly>
</li>
{% endif %}
Expand Down Expand Up @@ -232,10 +228,10 @@ <h2 class="card-header card-title pod-card__title h4">{% trans "Help"%}</h2>
{% 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' %}
{% trans 'Quiz' %}
</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>
<p>{% trans 'A Quiz allow you to test the memorization and comprehension of your video.' %}</p>
</div>
</div>
{% endif %}
Expand Down
1 change: 1 addition & 0 deletions pod/completion/urls.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"""Esup-Pod Video completion urls."""
from django.conf.urls import url
from .views import video_completion
from .views import video_caption_maker
Expand Down
Binary file modified pod/locale/fr/LC_MESSAGES/django.mo
Binary file not shown.
Loading

0 comments on commit 3fc3348

Please sign in to comment.