1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2025-02-11 13:41:18 +00:00

Update questions

This commit is contained in:
Yohann D'ANELLO 2020-10-31 18:57:00 +01:00
parent 0d9c293443
commit d0007ee9b2
4 changed files with 52 additions and 20 deletions

View File

@ -102,7 +102,6 @@
<button class="btn btn-info" data-toggle="modal" data-target="#displaySolutionModal">{% trans "Display" %}</button> <button class="btn btn-info" data-toggle="modal" data-target="#displaySolutionModal">{% trans "Display" %}</button>
{% endif %} {% endif %}
</dd> </dd>
</dl>
{% if current_phase.phase_number == 2 %} {% if current_phase.phase_number == 2 %}
<div class="alert alert-info"> <div class="alert alert-info">
@ -113,6 +112,14 @@
{% endblocktrans %} {% endblocktrans %}
</div> </div>
{% for question in participation.questions.all %}
<dd class="col-md-9 text-truncate">{{ question.question }}</dd>
<dd class="col-md-3">
<button class="btn btn-primary" data-toggle="modal" data-target="#updateQuestion{{ forloop.counter }}Modal">{% trans "Change" %}</button>
</dd>
<hr>
{% endfor %}
{% if user.registration.participates %} {% if user.registration.participates %}
<button class="btn btn-success" data-toggle="modal" data-target="#addQuestionModal"> <button class="btn btn-success" data-toggle="modal" data-target="#addQuestionModal">
<i class="fas fa-plus-circle"></i> {% trans "Add a question" %} <i class="fas fa-plus-circle"></i> {% trans "Add a question" %}
@ -132,6 +139,7 @@
{% elif current_phase.phase_number == 4 %} {% elif current_phase.phase_number == 4 %}
{# TODO Send synthesis #} {# TODO Send synthesis #}
{% endif %} {% endif %}
</dl>
</div> </div>
</div> </div>
</div> </div>
@ -171,7 +179,17 @@
{% trans "Add question" as modal_title %} {% trans "Add question" as modal_title %}
{% trans "Add" as modal_button %} {% trans "Add" as modal_button %}
{% url "participation:add_question" pk=participation.pk as modal_action %} {% url "participation:add_question" pk=participation.pk as modal_action %}
{% include "base_modal.html" with modal_id="addQuestion" modal_button_type="success" %} {% include "base_modal.html" with modal_id="addQuestion" modal_button_type="success" %}
{% for question in participation.questions.all %}
{% trans "Update question" as modal_title %}
{% trans "Update" as modal_button %}
{% url "participation:update_question" pk=question.pk as modal_action %}
{% with number_str=forloop.counter|stringformat:"d" %}
{% with modal_id="updateQuestion"|add:number_str %}
{% include "base_modal.html" %}
{% endwith %}
{% endwith %}
{% endfor %}
{% endif %} {% endif %}
{% endblock %} {% endblock %}
@ -198,6 +216,14 @@
if (!modalBody.html().trim()) if (!modalBody.html().trim())
modalBody.load("{% url "participation:add_question" pk=participation.pk %} #form-content"); modalBody.load("{% url "participation:add_question" pk=participation.pk %} #form-content");
}); });
{% for question in participation.questions.all %}
$('button[data-target="#updateQuestion{{ forloop.counter }}Modal"]').click(function() {
let modalBody = $("#updateQuestion{{ forloop.counter }}Modal div.modal-body");
if (!modalBody.html().trim())
modalBody.load("{% url "participation:update_question" pk=question.pk %} #form-content");
});
{% endfor %}
{% endif %} {% endif %}
$('button[data-target="#uploadSolutionModal"]').click(function() { $('button[data-target="#uploadSolutionModal"]').click(function() {

View File

@ -25,7 +25,7 @@ urlpatterns = [
path("detail/<int:pk>/send-participation/", SetParticipationSendParticipationView.as_view(), path("detail/<int:pk>/send-participation/", SetParticipationSendParticipationView.as_view(),
name="participation_send_participation"), name="participation_send_participation"),
path("detail/<int:pk>/add-question/", CreateQuestionView.as_view(), name="add_question"), path("detail/<int:pk>/add-question/", CreateQuestionView.as_view(), name="add_question"),
path("update-question/<int:pk>/", CreateQuestionView.as_view(), name="update_question"), path("update-question/<int:pk>/", UpdateQuestionView.as_view(), name="update_question"),
path("calendar/", CalendarView.as_view(), name="calendar"), path("calendar/", CalendarView.as_view(), name="calendar"),
path("calendar/<int:pk>/", PhaseUpdateView.as_view(), name="update_phase"), path("calendar/<int:pk>/", PhaseUpdateView.as_view(), name="update_phase"),
path("chat/", TemplateView.as_view(template_name="participation/chat.html"), name="chat") path("chat/", TemplateView.as_view(template_name="participation/chat.html"), name="chat")

View File

@ -417,7 +417,7 @@ class UpdateQuestionView(LoginRequiredMixin, UpdateView):
form_class = QuestionForm form_class = QuestionForm
def dispatch(self, request, *args, **kwargs): def dispatch(self, request, *args, **kwargs):
self.object = self.get_object(**kwargs) self.object = self.get_object()
if not request.user.is_authenticated: if not request.user.is_authenticated:
return self.handle_no_permission() return self.handle_no_permission()
if request.user.registration.is_admin or \ if request.user.registration.is_admin or \

View File

@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Corres2math\n" "Project-Id-Version: Corres2math\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-10-31 18:04+0100\n" "POT-Creation-Date: 2020-10-31 18:56+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Yohann D'ANELLO <yohann.danello@animath.fr>\n" "Last-Translator: Yohann D'ANELLO <yohann.danello@animath.fr>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -325,7 +325,7 @@ msgid "Proposed solution:"
msgstr "Solution proposée :" msgstr "Solution proposée :"
#: apps/participation/templates/participation/participation_detail.html:27 #: apps/participation/templates/participation/participation_detail.html:27
#: apps/participation/templates/participation/participation_detail.html:154 #: apps/participation/templates/participation/participation_detail.html:162
#: apps/participation/templates/participation/upload_video.html:11 #: apps/participation/templates/participation/upload_video.html:11
#: apps/registration/templates/registration/upload_photo_authorization.html:18 #: apps/registration/templates/registration/upload_photo_authorization.html:18
#: apps/registration/templates/registration/user_detail.html:78 #: apps/registration/templates/registration/user_detail.html:78
@ -347,6 +347,7 @@ msgstr "Équipe qui a reçu votre solution :"
#: apps/participation/templates/participation/participation_detail.html:53 #: apps/participation/templates/participation/participation_detail.html:53
#: apps/participation/templates/participation/participation_detail.html:94 #: apps/participation/templates/participation/participation_detail.html:94
#: apps/participation/templates/participation/participation_detail.html:118
msgid "Change" msgid "Change"
msgstr "Modifier" msgstr "Modifier"
@ -387,7 +388,7 @@ msgstr "Solution reçue"
msgid "Team that sent you their solution:" msgid "Team that sent you their solution:"
msgstr "Équipe qui vous a envoyé leur solution :" msgstr "Équipe qui vous a envoyé leur solution :"
#: apps/participation/templates/participation/participation_detail.html:109 #: apps/participation/templates/participation/participation_detail.html:108
msgid "" msgid ""
"You received a solution about the same problem that you treated from another " "You received a solution about the same problem that you treated from another "
"team. You are now encouraged to see the video, then to ask from 3 to 6 " "team. You are now encouraged to see the video, then to ask from 3 to 6 "
@ -399,11 +400,11 @@ msgstr ""
"vidéo, puis à poser 3 à 6 questions à propos de la vidéo. Après cela, vous " "vidéo, puis à poser 3 à 6 questions à propos de la vidéo. Après cela, vous "
"serez invités à échanger avec l'autre équipe à propos de la solution." "serez invités à échanger avec l'autre équipe à propos de la solution."
#: apps/participation/templates/participation/participation_detail.html:118 #: apps/participation/templates/participation/participation_detail.html:125
msgid "Add a question" msgid "Add a question"
msgstr "Ajouter une question" msgstr "Ajouter une question"
#: apps/participation/templates/participation/participation_detail.html:123 #: apps/participation/templates/participation/participation_detail.html:130
#, python-format #, python-format
msgid "" msgid ""
"You sent your questions to the other team about their solution. When they " "You sent your questions to the other team about their solution. When they "
@ -422,12 +423,13 @@ msgstr ""
"client Element dédié : <a href=\"https://element.correspondances-maths.fr" "client Element dédié : <a href=\"https://element.correspondances-maths.fr"
"\">element.correpondances-maths.fr</a>" "\">element.correpondances-maths.fr</a>"
#: apps/participation/templates/participation/participation_detail.html:142 #: apps/participation/templates/participation/participation_detail.html:150
msgid "Define received video" msgid "Define received video"
msgstr "Définir la vidéo reçue" msgstr "Définir la vidéo reçue"
#: apps/participation/templates/participation/participation_detail.html:143 #: apps/participation/templates/participation/participation_detail.html:151
#: apps/participation/templates/participation/participation_detail.html:148 #: apps/participation/templates/participation/participation_detail.html:156
#: apps/participation/templates/participation/participation_detail.html:185
#: apps/participation/templates/participation/phase_form.html:11 #: apps/participation/templates/participation/phase_form.html:11
#: apps/participation/templates/participation/phase_list.html:18 #: apps/participation/templates/participation/phase_list.html:18
#: apps/participation/templates/participation/receive_participation_form.html:11 #: apps/participation/templates/participation/receive_participation_form.html:11
@ -441,32 +443,36 @@ msgstr "Définir la vidéo reçue"
msgid "Update" msgid "Update"
msgstr "Modifier" msgstr "Modifier"
#: apps/participation/templates/participation/participation_detail.html:147 #: apps/participation/templates/participation/participation_detail.html:155
msgid "Define team that receives your video" msgid "Define team that receives your video"
msgstr "Définir l'équipe qui recevra votre vidéo" msgstr "Définir l'équipe qui recevra votre vidéo"
#: apps/participation/templates/participation/participation_detail.html:153 #: apps/participation/templates/participation/participation_detail.html:161
msgid "Upload video" msgid "Upload video"
msgstr "Envoyer la vidéo" msgstr "Envoyer la vidéo"
#: apps/participation/templates/participation/participation_detail.html:157 #: apps/participation/templates/participation/participation_detail.html:165
#: apps/participation/templates/participation/participation_detail.html:164 #: apps/participation/templates/participation/participation_detail.html:172
msgid "Display solution" msgid "Display solution"
msgstr "Afficher la solution" msgstr "Afficher la solution"
#: apps/participation/templates/participation/participation_detail.html:158 #: apps/participation/templates/participation/participation_detail.html:166
#: apps/participation/templates/participation/participation_detail.html:165 #: apps/participation/templates/participation/participation_detail.html:173
msgid "This video platform is not supported yet." msgid "This video platform is not supported yet."
msgstr "La plateforme de cette vidéo n'est pas encore supportée." msgstr "La plateforme de cette vidéo n'est pas encore supportée."
#: apps/participation/templates/participation/participation_detail.html:171 #: apps/participation/templates/participation/participation_detail.html:179
msgid "Add question" msgid "Add question"
msgstr "Ajouter une question" msgstr "Ajouter une question"
#: apps/participation/templates/participation/participation_detail.html:172 #: apps/participation/templates/participation/participation_detail.html:180
msgid "Add" msgid "Add"
msgstr "Ajouter" msgstr "Ajouter"
#: apps/participation/templates/participation/participation_detail.html:184
msgid "Update question"
msgstr "Modifier une question"
#: apps/participation/templates/participation/phase_list.html:10 #: apps/participation/templates/participation/phase_list.html:10
#: templates/base.html:68 templates/base.html:70 templates/base.html:217 #: templates/base.html:68 templates/base.html:70 templates/base.html:217
msgid "Calendar" msgid "Calendar"