mirror of
https://github.com/ae-utbm/sith.git
synced 2026-09-09 22:09:14 +00:00
Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
db44e4bd02 | ||
|
|
8de4d9a4d0 | ||
|
|
e960625933 | ||
|
|
80f113eaf6 | ||
|
|
35a55ff95a
|
||
|
|
00cae33a33
|
||
|
|
4bfcb6a267
|
@@ -15,9 +15,6 @@
|
||||
{% endblock %}
|
||||
{% else %}
|
||||
{% extends "core/base.jinja" %}
|
||||
{% block additional_css %}
|
||||
<link rel="stylesheet" href="{{ static("club/list.scss") }}">
|
||||
{% endblock %}
|
||||
{% block description -%}
|
||||
{% trans %}The list of all clubs existing at UTBM.{% endtrans %}
|
||||
{%- endblock %}
|
||||
@@ -26,6 +23,12 @@
|
||||
{%- endblock %}
|
||||
{% endif %}
|
||||
|
||||
{% block additional_css %}
|
||||
{% if not is_fragment %}
|
||||
<link rel="stylesheet" href="{{ static("club/list.scss") }}">
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% from "core/macros.jinja" import paginate_htmx %}
|
||||
|
||||
{% block content %}
|
||||
@@ -33,15 +36,17 @@
|
||||
<h3>{% trans %}Filters{% endtrans %}</h3>
|
||||
<form
|
||||
id="club-list-filters"
|
||||
hx-get="{{ url("club:club_list") }}"
|
||||
method="GET"
|
||||
hx-action="{{ url("club:club_list") }}"
|
||||
hx-target="#content"
|
||||
hx-swap="outerHtml"
|
||||
hx-swap="innerHTML"
|
||||
hx-push-url="true"
|
||||
hx-disable="find input, find button"
|
||||
>
|
||||
<div class="row gap-4x">
|
||||
{{ form }}
|
||||
</div>
|
||||
<button type="submit" class="btn btn-blue margin-bottom">
|
||||
<button class="btn btn-blue margin-bottom">
|
||||
<i class="fa fa-magnifying-glass"></i>{% trans %}Search{% endtrans %}
|
||||
</button>
|
||||
</form>
|
||||
|
||||
@@ -70,7 +70,6 @@ htmx.registerExtension("aria-busy", {
|
||||
});
|
||||
|
||||
htmx.config.transitions = true;
|
||||
|
||||
Object.assign(window, { htmx });
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
{%- endblock %}"
|
||||
>
|
||||
<meta property="og:site_name" content="Association des Étudiants de l'UTBM" />
|
||||
<meta property="og:locale" content="fr_FR" />
|
||||
<meta property="og:locale:alternate" content="en_GB" />
|
||||
{% block metatags %}
|
||||
<meta property="og:url" content="{{ request.build_absolute_uri() }}" />
|
||||
<meta property="og:type" content="website" />
|
||||
|
||||
@@ -4,15 +4,11 @@
|
||||
{% trans %}Delete confirmation{% endtrans %}
|
||||
{% endblock %}
|
||||
|
||||
{% if is_fragment %}
|
||||
|
||||
{# Don't display tabs and errors #}
|
||||
{% block tabs %}
|
||||
{% endblock %}
|
||||
{% block errors %}
|
||||
{% endblock %}
|
||||
|
||||
{% endif %}
|
||||
{# Don't display tabs and errors #}
|
||||
{% block tabs %}
|
||||
{% endblock %}
|
||||
{% block errors %}
|
||||
{% endblock %}
|
||||
|
||||
{% block file %}
|
||||
<h2>{% trans %}Delete confirmation{% endtrans %}</h2>
|
||||
@@ -23,30 +19,32 @@
|
||||
{% set action = current %}
|
||||
{% endif %}
|
||||
|
||||
<form action="{{ action }}" method="post">
|
||||
<p>{% trans obj=object %}Are you sure you want to delete "{{ obj }}"?{% endtrans %}</p>
|
||||
<form
|
||||
method="post"
|
||||
{% if is_fragment %}
|
||||
hx-action="{{ action }}"
|
||||
hx-target="#content"
|
||||
hx-swap="innerHTML"
|
||||
{% else %}
|
||||
action="{{ action }}"
|
||||
{% endif %}
|
||||
>
|
||||
{% csrf_token %}
|
||||
|
||||
<p>{% trans obj=object %}Are you sure you want to delete "{{ obj }}"?{% endtrans %}</p>
|
||||
<button
|
||||
{% if is_fragment %}
|
||||
hx-post="{{ action }}"
|
||||
hx-target="#content"
|
||||
hx-swap="outerHtml"
|
||||
{% endif %}
|
||||
>{% trans %}Confirm{% endtrans %}</button>
|
||||
|
||||
<button
|
||||
{% if is_fragment %}
|
||||
hx-get="{{ previous }}"
|
||||
hx-target="#content"
|
||||
hx-swap="outerHtml"
|
||||
{% else %}
|
||||
action="window.history.back()"
|
||||
{% endif %}
|
||||
>{% trans %}Cancel{% endtrans %}</button>
|
||||
|
||||
<input type="submit" value="{% trans %}Confirm{% endtrans %}" />
|
||||
</form>
|
||||
<form
|
||||
method="get"
|
||||
{% if is_fragment %}
|
||||
hx-action="{{ previous }}"
|
||||
hx-target="#content"
|
||||
hx-swap="innerHTML"
|
||||
{% else %}
|
||||
action="javascript:history.back();"
|
||||
{% endif %}
|
||||
>
|
||||
<input type="submit" name="cancel" value="{% trans %}Cancel{% endtrans %}" />
|
||||
</form>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
||||
@@ -39,13 +39,13 @@
|
||||
<p><button
|
||||
hx-get="{{ url('core:file_moderate', file_id=f.id) }}"
|
||||
hx-target="#content"
|
||||
hx-swap="outerHtml"
|
||||
hx-swap="innerHTML"
|
||||
>{% trans %}Moderate{% endtrans %}</button> -
|
||||
{% set current_page = url('core:file_moderation') + "?page=" + page_obj.number | string %}
|
||||
<button
|
||||
hx-get="{{ url('core:file_delete', file_id=f.id) }}?next={{ current_page | urlencode }}&previous={{ current_page | urlencode }}"
|
||||
hx-target="#file-{{ loop.index }}"
|
||||
hx-swap="outerHtml"
|
||||
hx-swap="innerHTML"
|
||||
>{% trans %}Delete{% endtrans %}</button></p>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
+6
-22
@@ -21,7 +21,7 @@
|
||||
# Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
#
|
||||
from django.urls import path, re_path, register_converter
|
||||
from django.urls import path, register_converter
|
||||
from django.views.generic import RedirectView
|
||||
|
||||
from com.views import NewsListView
|
||||
@@ -193,27 +193,11 @@ urlpatterns = [
|
||||
name="user_gift_delete",
|
||||
),
|
||||
# File views
|
||||
re_path(r"^file/$", FileListView.as_view(), name="file_list"),
|
||||
re_path(
|
||||
r"^file/(?P<file_id>[0-9]+)/$",
|
||||
FileView.as_view(),
|
||||
name="file_detail",
|
||||
),
|
||||
re_path(
|
||||
r"^file/(?P<file_id>[0-9]+)/edit/$",
|
||||
FileEditView.as_view(),
|
||||
name="file_edit",
|
||||
),
|
||||
re_path(
|
||||
r"^file/(?P<file_id>[0-9]+)/prop/$",
|
||||
FileEditPropView.as_view(),
|
||||
name="file_prop",
|
||||
),
|
||||
re_path(
|
||||
r"^file/(?P<file_id>[0-9]+)/delete/$",
|
||||
FileDeleteView.as_view(),
|
||||
name="file_delete",
|
||||
),
|
||||
path("file/", FileListView.as_view(), name="file_list"),
|
||||
path("file/<int:file_id>/", FileView.as_view(), name="file_detail"),
|
||||
path("file/<int:file_id>/edit/", FileEditView.as_view(), name="file_edit"),
|
||||
path("file/<int:file_id>/prop/", FileEditPropView.as_view(), name="file_prop"),
|
||||
path("file/<int:file_id>/delete/", FileDeleteView.as_view(), name="file_delete"),
|
||||
path("file/moderation/", FileModerationView.as_view(), name="file_moderation"),
|
||||
path(
|
||||
"file/<int:file_id>/moderate/", FileModerateView.as_view(), name="file_moderate"
|
||||
|
||||
+2
-9
@@ -356,15 +356,8 @@ class FileDeleteView(AllowFragment, CanEditPropMixin, DeleteView):
|
||||
if "next" in self.request.GET:
|
||||
return self.request.GET["next"]
|
||||
if self.object.parent is None:
|
||||
return reverse(
|
||||
"core:file_list",
|
||||
)
|
||||
return reverse(
|
||||
"core:file_detail",
|
||||
kwargs={
|
||||
"file_id": self.object.parent.id,
|
||||
},
|
||||
)
|
||||
return reverse("core:file_list")
|
||||
return reverse("core:file_detail", kwargs={"file_id": self.object.parent.id})
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
kwargs = super().get_context_data(**kwargs)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2026-09-08 23:36+0200\n"
|
||||
"POT-Creation-Date: 2026-09-09 07:21+0200\n"
|
||||
"PO-Revision-Date: 2016-07-18\n"
|
||||
"Last-Translator: Maréchal <thomas.girod@utbm.fr\n"
|
||||
"Language-Team: AE info <ae.info@utbm.fr>\n"
|
||||
@@ -5852,9 +5852,15 @@ msgstr "les groupes pouvant créer des cotisations"
|
||||
msgid "Timetable generator"
|
||||
msgstr "Générateur d'emploi du temps"
|
||||
|
||||
#: timetable/templates/timetable/generator.jinja
|
||||
msgid "Get a nice schedule from the raw text in your student file"
|
||||
msgstr ""
|
||||
"Générez un joli emploi du temps à partir du texte brut de votre dossier "
|
||||
"étudiant"
|
||||
|
||||
#: timetable/templates/timetable/generator.jinja
|
||||
msgid ""
|
||||
"Wrong timetable format. Make sure you copied if from your student folder."
|
||||
"Wrong timetable format. Make sure you copied it from your student folder."
|
||||
msgstr ""
|
||||
"Mauvais format d'emploi du temps. Assurez-vous que vous l'avez copié depuis "
|
||||
"votre dossier étudiant."
|
||||
@@ -5863,6 +5869,10 @@ msgstr ""
|
||||
msgid "Incorrect row"
|
||||
msgstr "Ligne incorrecte"
|
||||
|
||||
#: timetable/templates/timetable/generator.jinja
|
||||
msgid "Paste your schedule (without the header)"
|
||||
msgstr "Colle ton emploi du temps (sans l'entête)"
|
||||
|
||||
#: timetable/templates/timetable/generator.jinja
|
||||
msgid "Generate"
|
||||
msgstr "Générer"
|
||||
|
||||
+3
-18
@@ -26,7 +26,6 @@ from django.conf import settings
|
||||
from django.core import validators
|
||||
from django.db import models
|
||||
from django.db.models import Exists, OuterRef
|
||||
from django.db.models.query_utils import Q
|
||||
from django.urls import reverse
|
||||
from django.utils import timezone
|
||||
from django.utils.functional import cached_property
|
||||
@@ -126,11 +125,7 @@ class UE(models.Model):
|
||||
Returns:
|
||||
True if the user has already posted a comment on this UE, else False.
|
||||
"""
|
||||
self._has_user_commented = getattr(self, "_has_user_commented", {})
|
||||
self._has_user_commented[user] = self._has_user_commented.get(
|
||||
user, self.comments.filter(author=user).exists()
|
||||
)
|
||||
return self._has_user_commented[user]
|
||||
return self.comments.filter(author=user).exists()
|
||||
|
||||
@cached_property
|
||||
def grade_global_average(self):
|
||||
@@ -160,17 +155,7 @@ class UECommentQuerySet(models.QuerySet):
|
||||
# so he can view non-moderated comments
|
||||
return self
|
||||
if user.has_perm("pedagogy.view_uecomment"):
|
||||
return self.filter(
|
||||
Q(reports=None)
|
||||
| Q(author=user)
|
||||
| Q(
|
||||
Exists(
|
||||
UECommentReport.objects.filter(
|
||||
comment=OuterRef("pk"), reporter=user
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
return self.filter(reports=None)
|
||||
return self.filter(author=user)
|
||||
|
||||
def annotate_is_reported(self) -> Self:
|
||||
@@ -272,7 +257,7 @@ class UEResult(models.Model):
|
||||
|
||||
|
||||
class UECommentReport(models.Model):
|
||||
"""Report an inappropriate comment."""
|
||||
"""Report an inapropriate comment."""
|
||||
|
||||
comment = models.ForeignKey(
|
||||
UEComment,
|
||||
|
||||
@@ -69,7 +69,6 @@ $pedagogy-white-text: #f0f0f0;
|
||||
input[type="checkbox"] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
margin-top: 10px;
|
||||
margin-bottom: 0;
|
||||
color: white;
|
||||
@@ -129,14 +128,14 @@ $pedagogy-white-text: #f0f0f0;
|
||||
grid-area: hours-the;
|
||||
}
|
||||
|
||||
.leave-comment-not-allowed {
|
||||
#leave_comment_not_allowed {
|
||||
p {
|
||||
text-align: center;
|
||||
color: red;
|
||||
}
|
||||
}
|
||||
|
||||
.leave-comment {
|
||||
#leave_comment {
|
||||
.leave-comment-grid-container {
|
||||
display: grid;
|
||||
grid-template-columns: 270px auto;
|
||||
@@ -169,6 +168,10 @@ $pedagogy-white-text: #f0f0f0;
|
||||
.input-stars {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
input[type="submit"] {
|
||||
float: right;
|
||||
}
|
||||
}
|
||||
|
||||
.ue-details-container {
|
||||
@@ -330,9 +333,8 @@ $pedagogy-white-text: #f0f0f0;
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
.action {
|
||||
.actions {
|
||||
float: right;
|
||||
margin-top: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -400,7 +402,6 @@ $pedagogy-white-text: #f0f0f0;
|
||||
|
||||
a {
|
||||
color: $pedagogy-white-text;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
@@ -443,9 +444,3 @@ details.accordion>.accordion-content {
|
||||
border-color: $pedagogy-orange;
|
||||
border-right: none;
|
||||
}
|
||||
|
||||
.buttons {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
<form
|
||||
class="report-form"
|
||||
hx-post="{{ request.get_full_path() }}"
|
||||
hx-target="this"
|
||||
hx-swap="outerHTML"
|
||||
hx-disable="button input[type='submit']"
|
||||
hx-trigger="submit"
|
||||
>
|
||||
{% csrf_token %}
|
||||
{{ form.non_field_errors() }}
|
||||
{{ form.reason.errors }}
|
||||
{{ form.reason }}
|
||||
|
||||
{# Hidden fields #}
|
||||
{{ form.reporter }}
|
||||
{{ form.comment }}
|
||||
|
||||
<div class="buttons">
|
||||
<button
|
||||
class="btn btn-red left"
|
||||
hx-get="{{ ue_detail_url }}"
|
||||
hx-target="closest form"
|
||||
hx-swap="outerHTML"
|
||||
>
|
||||
{% trans %}Cancel{% endtrans %}
|
||||
</button>
|
||||
|
||||
<input class="btn btn-green" type="submit" value="{% trans %}Report{% endtrans %}" />
|
||||
|
||||
</div>
|
||||
</form>
|
||||
@@ -1,71 +0,0 @@
|
||||
<div class="leave-comment">
|
||||
{% if form.is_creation %}
|
||||
<details class="accordion" id="leave_comment" {% if form.errors %}open{% endif %}>
|
||||
<summary>{% trans %}Leave comment{% endtrans %}</summary>
|
||||
<div class="accordion-content">
|
||||
{% endif %}
|
||||
<form
|
||||
hx-post="{{ action }}"
|
||||
hx-target="closest .leave-comment"
|
||||
hx-swap="outerHTML"
|
||||
hx-disabled-elt="find input[type='submit']"
|
||||
>
|
||||
{% csrf_token %}
|
||||
<div class="leave-comment-grid-container">
|
||||
<div class="form-stars">
|
||||
{{ form.non_field_errors() }}
|
||||
{{ form.author.errors }}
|
||||
{{ form.ue.errors }}
|
||||
|
||||
{{ form.author }}
|
||||
{{ form.ue }}
|
||||
|
||||
<div class="input-stars">
|
||||
<label for="{{ form.grade_global.id_for_label }}">{{ form.grade_global.label }} :</label>
|
||||
{{ form.grade_global.errors }}
|
||||
{{ form.grade_global }}
|
||||
</div>
|
||||
|
||||
<div class="input-stars">
|
||||
<label for="{{ form.grade_utility.id_for_label }}">{{ form.grade_utility.label }} :</label>
|
||||
{{ form.grade_utility.errors }}
|
||||
{{ form.grade_utility }}
|
||||
</div>
|
||||
|
||||
<div class="input-stars">
|
||||
<label for="{{ form.grade_interest.id_for_label }}">{{ form.grade_interest.label }} :</label>
|
||||
{{ form.grade_interest.errors }}
|
||||
{{ form.grade_interest }}
|
||||
</div>
|
||||
|
||||
<div class="input-stars">
|
||||
<label for="{{ form.grade_teaching.id_for_label }}">{{ form.grade_teaching.label }} :</label>
|
||||
{{ form.grade_teaching.errors }}
|
||||
{{ form.grade_teaching }}
|
||||
</div>
|
||||
|
||||
<div class="input-stars">
|
||||
<label for="{{ form.grade_work_load.id_for_label }}">{{ form.grade_work_load.label }} :</label>
|
||||
{{ form.grade_work_load.errors }}
|
||||
{{ form.grade_work_load }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-comment">
|
||||
<label for="{{ form.comment.id_for_label }}">{{ form.comment.label }} :</label>
|
||||
{{ form.comment.errors }}
|
||||
{{ form.comment }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="buttons">
|
||||
<input type="submit" value="{% trans %}Comment{% endtrans %}" />
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{% if form.is_creation %}
|
||||
</div>
|
||||
</details>
|
||||
{% endif %}
|
||||
|
||||
<br>
|
||||
|
||||
</div>
|
||||
@@ -1,91 +0,0 @@
|
||||
{% from "pedagogy/macros.jinja" import display_star %}
|
||||
{% from "core/macros.jinja" import user_profile_link %}
|
||||
|
||||
{% if comments %}
|
||||
<h2>{% trans %}Comments{% endtrans %}</h2>
|
||||
<br>
|
||||
{% endif %}
|
||||
|
||||
<section>
|
||||
{% for comment in comments %}
|
||||
|
||||
<div id="comment-{{ comment.id }}" class="comment-container">
|
||||
|
||||
<div class="grade-block">
|
||||
<div class="grade-type">
|
||||
<p>{% trans %}Global grade{% endtrans %}</p>
|
||||
<p>{% trans %}Utility{% endtrans %}</p>
|
||||
<p>{% trans %}Interest{% endtrans %}</p>
|
||||
<p>{% trans %}Teaching{% endtrans %}</p>
|
||||
<p>{% trans %}Work load{% endtrans %}</p>
|
||||
</div>
|
||||
<div class="grade-stars">
|
||||
<p>{{ display_star(comment.grade_global) }}</p>
|
||||
<p>{{ display_star(comment.grade_utility) }}</p>
|
||||
<p>{{ display_star(comment.grade_interest) }}</p>
|
||||
<p>{{ display_star(comment.grade_teaching) }}</p>
|
||||
<p>{{ display_star(comment.grade_work_load) }}</p>
|
||||
</div>
|
||||
<div class="grade-extension"></div>
|
||||
</div>
|
||||
|
||||
<div class="comment">
|
||||
<div class="anchor">
|
||||
<a href="{{ url('pedagogy:ue_detail', ue_id=ue.id) }}#comment-{{ comment.id }}"><i class="fa fa-paragraph"></i></a>
|
||||
</div>
|
||||
{{ comment.comment|markdown }}
|
||||
</div>
|
||||
|
||||
<div class="info">
|
||||
{% if comment.is_reported %}
|
||||
<p class="status-reported">
|
||||
{% trans %}This comment has been reported{% endtrans %}
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
{% if comment.author_id == user.id or user.has_perm("pedagogy.change_comment") %}
|
||||
<button
|
||||
class="btn btn-orange action"
|
||||
hx-get="{{ url('pedagogy:comment_update', comment_id=comment.id) }}"
|
||||
hx-swap="outerHTML"
|
||||
hx-target="#comment-{{ comment.id }}"
|
||||
>
|
||||
<i class="fa fa-pencil"></i> {% trans %}Edit{% endtrans %}
|
||||
</button>
|
||||
{% endif %}
|
||||
{% if comment.author_id == user.id or user.has_perm("pedagogy.delete_comment") %}
|
||||
<form class="action"
|
||||
hx-post="{{ url('pedagogy:comment_delete', comment_id=comment.id) }}"
|
||||
hx-confirm='{% trans obj=object %}Are you sure you want to delete "{{ obj }}"?{% endtrans %}'
|
||||
hx-swap="outerHTML"
|
||||
hx-target="#comment-{{ comment.id }}"
|
||||
>
|
||||
{% csrf_token %}
|
||||
<button class="btn btn-red action">
|
||||
<i class="fa fa-trash-can"></i> {% trans %}Delete{% endtrans %}
|
||||
</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="comment-end-bar">
|
||||
<div class="report">
|
||||
<p>
|
||||
<a
|
||||
hx-get="{{ url('pedagogy:comment_report', comment_id=comment.id) }}"
|
||||
hx-swap="outerHTML"
|
||||
hx-target="#comment-{{ comment.id }}"
|
||||
>
|
||||
{% trans %}Report this comment{% endtrans %}
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="date"><p>{{ comment.publish_date.strftime('%d/%m/%Y') }}</p></div>
|
||||
|
||||
<div class="author"><p>{{ user_profile_link(comment.author) }}</p></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{% endfor %}
|
||||
</section>
|
||||
@@ -1,10 +0,0 @@
|
||||
{% if object.has_user_already_commented(user) %}
|
||||
<div class="leave-comment-not-allowed">
|
||||
<p>{% trans %}You already posted a comment on this UE. If you want to comment again, please modify or delete your previous comment.{% endtrans %}</p>
|
||||
</div>
|
||||
<br>
|
||||
{% endif %}
|
||||
|
||||
{% if not object.has_user_already_commented(user) and user.has_perm("pedagogy.add_uecomment") %}
|
||||
{{ add_comment_form }}
|
||||
{% endif %}
|
||||
@@ -1,27 +0,0 @@
|
||||
<div class="ue-details-container">
|
||||
<div class="grade">
|
||||
<p>{% trans %}Global grade{% endtrans %}</p>
|
||||
<p>{% trans %}Utility{% endtrans %}</p>
|
||||
<p>{% trans %}Interest{% endtrans %}</p>
|
||||
<p>{% trans %}Teaching{% endtrans %}</p>
|
||||
<p>{% trans %}Work load{% endtrans %}</p>
|
||||
</div>
|
||||
<div class="grade-stars">
|
||||
<p>{{ display_star(object.grade_global_average) }}</p>
|
||||
<p>{{ display_star(object.grade_utility_average) }}</p>
|
||||
<p>{{ display_star(object.grade_interest_average) }}</p>
|
||||
<p>{{ display_star(object.grade_teaching_average) }}</p>
|
||||
<p>{{ display_star(object.grade_work_load_average) }}</p>
|
||||
</div>
|
||||
<div class="ue-infos">
|
||||
<p><b>{% trans %}Objectives{% endtrans %}</b></p>
|
||||
<p>{{ object.objectives|markdown }}</p>
|
||||
<p><b>{% trans %}Program{% endtrans %}</b></p>
|
||||
<p>{{ object.program|markdown }}</p>
|
||||
<p><b>{% trans %}Earned skills{% endtrans %}</b></p>
|
||||
<p>{{ object.skills|markdown }}</p>
|
||||
<p><b>{% trans %}Key concepts{% endtrans %}</b></p>
|
||||
<p>{{ object.key_concepts|markdown }}</p>
|
||||
<p><b>{% trans %}UE manager: {% endtrans %}</b>{{ object.manager }}</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,91 +1,220 @@
|
||||
{% extends "core/base.jinja" %}
|
||||
{% from "core/macros.jinja" import user_profile_link %}
|
||||
{% from "pedagogy/macros.jinja" import display_star %}
|
||||
|
||||
{% if is_fragment %}
|
||||
{% block additional_css %}
|
||||
<link rel="stylesheet" href="{{ static('pedagogy/css/pedagogy.scss') }}">
|
||||
{% endblock %}
|
||||
|
||||
<hx-partial id="ue-grade">
|
||||
{% include "pedagogy/fragments/ue_details/grade.jinja" %}
|
||||
</hx-partial>
|
||||
{% block title %}
|
||||
{% trans %}UE Details{% endtrans %}
|
||||
{% endblock %}
|
||||
|
||||
<hx-partial id="comment-form">
|
||||
{% include "pedagogy/fragments/ue_details/form.jinja" %}
|
||||
</hx-partial>
|
||||
{% block content %}
|
||||
<div class="pedagogy">
|
||||
<div id="ue_detail">
|
||||
<button onclick='(function(){
|
||||
// If comes from the guide page, go back with history
|
||||
if (document.referrer.replace(/\?(.+)/gm,"").endsWith(`{{ url("pedagogy:guide") }}`)){
|
||||
window.history.back();
|
||||
return;
|
||||
}
|
||||
// Simply goes to the guide page
|
||||
window.location.href = `{{ url("pedagogy:guide") }}`;
|
||||
})()' hidden>{% trans %}Back{% endtrans %}</button>
|
||||
|
||||
<hx-partial id="comments" hx-swap="innerMorph">
|
||||
{% include "pedagogy/fragments/ue_details/comments.jinja" %}
|
||||
</hx-partial>
|
||||
|
||||
{% else %}
|
||||
{% extends "core/base.jinja" %}
|
||||
|
||||
{% block additional_css %}
|
||||
<link rel="stylesheet" href="{{ static('pedagogy/css/pedagogy.scss') }}">
|
||||
{% endblock %}
|
||||
|
||||
{% block title %}
|
||||
{% trans %}UE Details{% endtrans %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<div class="pedagogy">
|
||||
<div id="ue_detail">
|
||||
<button onclick='(function(){
|
||||
// If comes from the guide page, go back with history
|
||||
if (document.referrer.replace(/\?(.+)/gm,"").endsWith(`{{ url("pedagogy:guide") }}`)){
|
||||
window.history.back();
|
||||
return;
|
||||
}
|
||||
// Simply goes to the guide page
|
||||
window.location.href = `{{ url("pedagogy:guide") }}`;
|
||||
})()' hidden>{% trans %}Back{% endtrans %}</button>
|
||||
|
||||
<h1>{{ object.code }} - {{ object.title }}</h1>
|
||||
<br>
|
||||
<div class="ue-quick-info-container">
|
||||
<div class="hours-cm">
|
||||
<b>{% trans %}CM: {% endtrans %}</b>{{ object.hours_CM }}
|
||||
</div>
|
||||
<div class="hours-td">
|
||||
<b>{% trans %}TD: {% endtrans %}</b>{{ object.hours_TD }}
|
||||
</div>
|
||||
<div class="hours-tp">
|
||||
<b>{% trans %}TP: {% endtrans %}</b>{{ object.hours_TP }}
|
||||
</div>
|
||||
<div class="hours-te">
|
||||
<b>{% trans %}TE: {% endtrans %}</b>{{ object.hours_TE }}
|
||||
</div>
|
||||
<div class="hours-the">
|
||||
<b>{% trans %}THE: {% endtrans %}</b>{{ object.hours_THE }}
|
||||
</div>
|
||||
|
||||
<div class="department">
|
||||
{{ object.department }}
|
||||
</div>
|
||||
<div class="credit-type">
|
||||
{{ object.credit_type }}
|
||||
</div>
|
||||
<div class="semester">
|
||||
{{ object.get_semester_display() }}
|
||||
</div>
|
||||
<h1>{{ object.code }} - {{ object.title }}</h1>
|
||||
<br>
|
||||
<div class="ue-quick-info-container">
|
||||
<div class="hours-cm">
|
||||
<b>{% trans %}CM: {% endtrans %}</b>{{ object.hours_CM }}
|
||||
</div>
|
||||
<div class="hours-td">
|
||||
<b>{% trans %}TD: {% endtrans %}</b>{{ object.hours_TD }}
|
||||
</div>
|
||||
<div class="hours-tp">
|
||||
<b>{% trans %}TP: {% endtrans %}</b>{{ object.hours_TP }}
|
||||
</div>
|
||||
<div class="hours-te">
|
||||
<b>{% trans %}TE: {% endtrans %}</b>{{ object.hours_TE }}
|
||||
</div>
|
||||
<div class="hours-the">
|
||||
<b>{% trans %}THE: {% endtrans %}</b>{{ object.hours_THE }}
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<div id="ue-grade">
|
||||
{% include "pedagogy/fragments/ue_details/grade.jinja" %}
|
||||
<div class="department">
|
||||
{{ object.department }}
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<div id="comment-form">
|
||||
{% include "pedagogy/fragments/ue_details/form.jinja" %}
|
||||
<div class="credit-type">
|
||||
{{ object.credit_type }}
|
||||
</div>
|
||||
|
||||
<div id="comments">
|
||||
{% include "pedagogy/fragments/ue_details/comments.jinja" %}
|
||||
<div class="semester">
|
||||
{{ object.get_semester_display() }}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<div class="ue-details-container">
|
||||
<div class="grade">
|
||||
<p>{% trans %}Global grade{% endtrans %}</p>
|
||||
<p>{% trans %}Utility{% endtrans %}</p>
|
||||
<p>{% trans %}Interest{% endtrans %}</p>
|
||||
<p>{% trans %}Teaching{% endtrans %}</p>
|
||||
<p>{% trans %}Work load{% endtrans %}</p>
|
||||
</div>
|
||||
<div class="grade-stars">
|
||||
<p>{{ display_star(object.grade_global_average) }}</p>
|
||||
<p>{{ display_star(object.grade_utility_average) }}</p>
|
||||
<p>{{ display_star(object.grade_interest_average) }}</p>
|
||||
<p>{{ display_star(object.grade_teaching_average) }}</p>
|
||||
<p>{{ display_star(object.grade_work_load_average) }}</p>
|
||||
</div>
|
||||
<div class="ue-infos">
|
||||
<p><b>{% trans %}Objectives{% endtrans %}</b></p>
|
||||
<p>{{ object.objectives|markdown }}</p>
|
||||
<p><b>{% trans %}Program{% endtrans %}</b></p>
|
||||
<p>{{ object.program|markdown }}</p>
|
||||
<p><b>{% trans %}Earned skills{% endtrans %}</b></p>
|
||||
<p>{{ object.skills|markdown }}</p>
|
||||
<p><b>{% trans %}Key concepts{% endtrans %}</b></p>
|
||||
<p>{{ object.key_concepts|markdown }}</p>
|
||||
<p><b>{% trans %}UE manager: {% endtrans %}</b>{{ object.manager }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
{% if object.has_user_already_commented(user) %}
|
||||
<div id="leave_comment_not_allowed">
|
||||
<p>{% trans %}You already posted a comment on this UE. If you want to comment again, please modify or delete your previous comment.{% endtrans %}</p>
|
||||
</div>
|
||||
{% elif user.has_perm("pedagogy.add_uecomment") %}
|
||||
<details class="accordion" id="leave_comment" {% if form.errors %}open{%endif%}>
|
||||
<summary>{% trans %}Leave comment{% endtrans %}</summary>
|
||||
<div class="accordion-content">
|
||||
<form action="{{ url('pedagogy:ue_detail', ue_id=object.id) }}" method="post" enctype="multipart/form-data">
|
||||
{% csrf_token %}
|
||||
<div class="leave-comment-grid-container">
|
||||
<div class="form-stars">
|
||||
{{ form.non_field_errors() }}
|
||||
{{ form.author.errors }}
|
||||
{{ form.ue.errors }}
|
||||
|
||||
{{ form.author }}
|
||||
{{ form.ue }}
|
||||
|
||||
<div class="input-stars">
|
||||
<label for="{{ form.grade_global.id_for_label }}">{{ form.grade_global.label }} :</label>
|
||||
{{ form.grade_global.errors }}
|
||||
{{ form.grade_global }}
|
||||
</div>
|
||||
|
||||
<div class="input-stars">
|
||||
<label for="{{ form.grade_utility.id_for_label }}">{{ form.grade_utility.label }} :</label>
|
||||
{{ form.grade_utility.errors }}
|
||||
{{ form.grade_utility }}
|
||||
</div>
|
||||
|
||||
<div class="input-stars">
|
||||
<label for="{{ form.grade_interest.id_for_label }}">{{ form.grade_interest.label }} :</label>
|
||||
{{ form.grade_interest.errors }}
|
||||
{{ form.grade_interest }}
|
||||
</div>
|
||||
|
||||
<div class="input-stars">
|
||||
<label for="{{ form.grade_teaching.id_for_label }}">{{ form.grade_teaching.label }} :</label>
|
||||
{{ form.grade_teaching.errors }}
|
||||
{{ form.grade_teaching }}
|
||||
</div>
|
||||
|
||||
<div class="input-stars">
|
||||
<label for="{{ form.grade_work_load.id_for_label }}">{{ form.grade_work_load.label }} :</label>
|
||||
{{ form.grade_work_load.errors }}
|
||||
{{ form.grade_work_load }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-comment">
|
||||
<label for="{{ form.comment.id_for_label }}">{{ form.comment.label }} :</label>
|
||||
{{ form.comment.errors }}
|
||||
{{ form.comment }}
|
||||
</div>
|
||||
</div>
|
||||
<p><input type="submit" value="{% trans %}Comment{% endtrans %}" /></p>
|
||||
</form>
|
||||
</div>
|
||||
</details>
|
||||
{% endif %}
|
||||
<br>
|
||||
|
||||
{% if comments %}
|
||||
<h2>{% trans %}Comments{% endtrans %}</h2>
|
||||
{% for comment in comments %}
|
||||
<div id="{{ comment.id }}" class="comment-container">
|
||||
|
||||
<div class="grade-block">
|
||||
<div class="grade-type">
|
||||
<p>{% trans %}Global grade{% endtrans %}</p>
|
||||
<p>{% trans %}Utility{% endtrans %}</p>
|
||||
<p>{% trans %}Interest{% endtrans %}</p>
|
||||
<p>{% trans %}Teaching{% endtrans %}</p>
|
||||
<p>{% trans %}Work load{% endtrans %}</p>
|
||||
</div>
|
||||
<div class="grade-stars">
|
||||
<p>{{ display_star(comment.grade_global) }}</p>
|
||||
<p>{{ display_star(comment.grade_utility) }}</p>
|
||||
<p>{{ display_star(comment.grade_interest) }}</p>
|
||||
<p>{{ display_star(comment.grade_teaching) }}</p>
|
||||
<p>{{ display_star(comment.grade_work_load) }}</p>
|
||||
</div>
|
||||
<div class="grade-extension"></div>
|
||||
</div>
|
||||
|
||||
<div class="comment">
|
||||
<div class="anchor">
|
||||
<a href="{{ url('pedagogy:ue_detail', ue_id=ue.id) }}#{{ comment.id }}"><i class="fa fa-paragraph"></i></a>
|
||||
</div>
|
||||
{{ comment.comment|markdown }}
|
||||
</div>
|
||||
|
||||
<div class="info">
|
||||
{% if comment.is_reported %}
|
||||
<p class="status-reported">
|
||||
{% trans %}This comment has been reported{% endtrans %}
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
{% if comment.author_id == user.id or user.has_perm("pedagogy.change_comment") %}
|
||||
<p class="actions">
|
||||
<a href="{{ url('pedagogy:comment_update', comment_id=comment.id) }}">
|
||||
{% trans %}Edit{% endtrans %}
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if comment.author_id == user.id or user.has_perm("pedagogy.delete_comment") %}
|
||||
<a href="{{ url('pedagogy:comment_delete', comment_id=comment.id) }}">
|
||||
{% trans %}Delete{% endtrans %}
|
||||
</a>
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="comment-end-bar">
|
||||
<div class="report">
|
||||
<p>
|
||||
<a href="{{ url('pedagogy:comment_report', comment_id=comment.id) }}">
|
||||
{% trans %}Report this comment{% endtrans %}
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="date"><p>{{ comment.publish_date.strftime('%d/%m/%Y') }}</p></div>
|
||||
|
||||
<div class="author"><p>{{ user_profile_link(comment.author) }}</p></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
+2
-8
@@ -24,13 +24,12 @@
|
||||
from django.urls import path
|
||||
|
||||
from pedagogy.views import (
|
||||
UECommentCreateView,
|
||||
UECommentDeleteView,
|
||||
UECommentReportCreateView,
|
||||
UECommentUpdateView,
|
||||
UECreateView,
|
||||
UEDeleteView,
|
||||
UEDetailView,
|
||||
UEDetailFormView,
|
||||
UEGuideView,
|
||||
UEModerationFormView,
|
||||
UEUpdateView,
|
||||
@@ -39,12 +38,7 @@ from pedagogy.views import (
|
||||
urlpatterns = [
|
||||
# Urls displaying the actual application for visitors
|
||||
path("", UEGuideView.as_view(), name="guide"),
|
||||
path("ue/<int:ue_id>/", UEDetailView.as_view(), name="ue_detail"),
|
||||
path(
|
||||
"ue/<int:ue_id>/comment",
|
||||
UECommentCreateView.as_view(),
|
||||
name="comment_create",
|
||||
),
|
||||
path("ue/<int:ue_id>/", UEDetailFormView.as_view(), name="ue_detail"),
|
||||
path(
|
||||
"comment/<int:comment_id>/edit/",
|
||||
UECommentUpdateView.as_view(),
|
||||
|
||||
+36
-73
@@ -16,7 +16,7 @@
|
||||
# details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along with
|
||||
# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
||||
# this program; if not, write to the Free Sofware Foundation, Inc., 59 Temple
|
||||
# Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
#
|
||||
@@ -26,11 +26,9 @@ from django.contrib.auth.mixins import PermissionRequiredMixin
|
||||
from django.db.models import Exists, OuterRef
|
||||
from django.shortcuts import get_object_or_404
|
||||
from django.urls import reverse, reverse_lazy
|
||||
from django.utils.functional import cached_property
|
||||
from django.views.generic import (
|
||||
CreateView,
|
||||
DeleteView,
|
||||
DetailView,
|
||||
FormView,
|
||||
TemplateView,
|
||||
UpdateView,
|
||||
@@ -38,7 +36,7 @@ from django.views.generic import (
|
||||
|
||||
from core.auth.mixins import PermissionOrAuthorRequiredMixin
|
||||
from core.models import Notification, User
|
||||
from core.views.mixins import AllowFragment, FragmentMixin, UseFragmentsMixin
|
||||
from core.views import DetailFormView
|
||||
from pedagogy.forms import (
|
||||
UECommentForm,
|
||||
UECommentModerationForm,
|
||||
@@ -48,56 +46,37 @@ from pedagogy.forms import (
|
||||
from pedagogy.models import UE, UEComment, UECommentReport
|
||||
|
||||
|
||||
class UECommentCreateView(PermissionRequiredMixin, FragmentMixin, CreateView):
|
||||
model = UEComment
|
||||
template_name = "pedagogy/fragments/ue_comment_form.jinja"
|
||||
form_class = UECommentForm
|
||||
permission_required = "pedagogy.add_uecomment"
|
||||
object = None # Avoid initialisation bug with FragmentMixin
|
||||
class UEDetailFormView(PermissionRequiredMixin, DetailFormView):
|
||||
"""Display every comment of an UE and detailed infos about it.
|
||||
|
||||
@cached_property
|
||||
def ue(self):
|
||||
return get_object_or_404(UE, id=self.kwargs.get("ue_id"))
|
||||
Allow to comment the UE.
|
||||
"""
|
||||
|
||||
model = UE
|
||||
pk_url_kwarg = "ue_id"
|
||||
template_name = "pedagogy/ue_detail.jinja"
|
||||
form_class = UECommentForm
|
||||
permission_required = "pedagogy.view_ue"
|
||||
|
||||
def has_permission(self):
|
||||
if self.ue.has_user_already_commented(self.request.user):
|
||||
if self.request.method == "POST" and not self.request.user.has_perm(
|
||||
"pedagogy.add_uecomment"
|
||||
):
|
||||
# if it's a POST request, the user is trying to add a new UEComment
|
||||
# thus he also needs the "add_uecomment" permission
|
||||
return False
|
||||
return super().has_permission()
|
||||
|
||||
def get_form_kwargs(self):
|
||||
kwargs = super().get_form_kwargs()
|
||||
kwargs["author_id"] = self.request.user.id
|
||||
kwargs["ue_id"] = self.ue.id
|
||||
kwargs["ue_id"] = self.object.id
|
||||
kwargs["is_creation"] = True
|
||||
return kwargs
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
return super().get_context_data(**kwargs) | {
|
||||
"action": reverse("pedagogy:comment_create", kwargs={"ue_id": self.ue.id}),
|
||||
"object": self.ue,
|
||||
}
|
||||
|
||||
def get_success_url(self):
|
||||
return reverse("pedagogy:ue_detail", kwargs={"ue_id": self.ue.id})
|
||||
|
||||
|
||||
class UEDetailView(
|
||||
PermissionRequiredMixin, UseFragmentsMixin, AllowFragment, DetailView
|
||||
):
|
||||
"""Display every comment of an UE and detailed infos about it."""
|
||||
|
||||
model = UE
|
||||
pk_url_kwarg = "ue_id"
|
||||
template_name = "pedagogy/ue_detail.jinja"
|
||||
permission_required = "pedagogy.view_ue"
|
||||
fragments = {
|
||||
"add_comment_form": UECommentCreateView,
|
||||
}
|
||||
|
||||
def get_fragment_data(self):
|
||||
return {
|
||||
"add_comment_form": {"ue_id": self.object.id},
|
||||
}
|
||||
def form_valid(self, form):
|
||||
form.save()
|
||||
return super().form_valid(form)
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
return super().get_context_data(**kwargs) | {
|
||||
@@ -106,17 +85,22 @@ class UEDetailView(
|
||||
.annotate_is_reported()
|
||||
.select_related("author")
|
||||
.order_by("-publish_date")
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
def get_success_url(self):
|
||||
# once the new ue comment has been saved
|
||||
# redirect to the same page we are currently
|
||||
return self.request.path
|
||||
|
||||
class UECommentUpdateView(PermissionOrAuthorRequiredMixin, AllowFragment, UpdateView):
|
||||
|
||||
class UECommentUpdateView(PermissionOrAuthorRequiredMixin, UpdateView):
|
||||
"""Allow edit of a given comment."""
|
||||
|
||||
model = UEComment
|
||||
form_class = UECommentForm
|
||||
pk_url_kwarg = "comment_id"
|
||||
template_name = "pedagogy/fragments/ue_comment_form.jinja"
|
||||
template_name = "core/edit.jinja"
|
||||
permission_required = "pedagogy.change_uecomment"
|
||||
author_field = "author"
|
||||
|
||||
@@ -127,18 +111,11 @@ class UECommentUpdateView(PermissionOrAuthorRequiredMixin, AllowFragment, Update
|
||||
kwargs["is_creation"] = False
|
||||
return kwargs
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
return super().get_context_data(**kwargs) | {
|
||||
"action": reverse(
|
||||
"pedagogy:comment_update", kwargs={"comment_id": self.object.id}
|
||||
)
|
||||
}
|
||||
|
||||
def get_success_url(self):
|
||||
return reverse("pedagogy:ue_detail", kwargs={"ue_id": self.object.ue.id})
|
||||
return reverse("pedagogy:ue_detail", kwargs={"ue_id": self.object.ue_id})
|
||||
|
||||
|
||||
class UECommentDeleteView(PermissionOrAuthorRequiredMixin, AllowFragment, DeleteView):
|
||||
class UECommentDeleteView(PermissionOrAuthorRequiredMixin, DeleteView):
|
||||
"""Allow to delete a given comment."""
|
||||
|
||||
model = UEComment
|
||||
@@ -147,13 +124,8 @@ class UECommentDeleteView(PermissionOrAuthorRequiredMixin, AllowFragment, Delete
|
||||
permission_required = "pedagogy.delete_uecomment"
|
||||
author_field = "author"
|
||||
|
||||
def form_valid(self, form):
|
||||
response = super().form_valid(form)
|
||||
response.headers["HX-Trigger"] = "CommentUpdate"
|
||||
return response
|
||||
|
||||
def get_success_url(self):
|
||||
return reverse("pedagogy:ue_detail", kwargs={"ue_id": self.object.ue.id})
|
||||
return reverse("pedagogy:ue_detail", kwargs={"ue_id": self.object.ue_id})
|
||||
|
||||
|
||||
class UEGuideView(PermissionRequiredMixin, TemplateView):
|
||||
@@ -163,34 +135,24 @@ class UEGuideView(PermissionRequiredMixin, TemplateView):
|
||||
permission_required = "pedagogy.view_ue"
|
||||
|
||||
|
||||
class UECommentReportCreateView(PermissionRequiredMixin, AllowFragment, CreateView):
|
||||
class UECommentReportCreateView(PermissionRequiredMixin, CreateView):
|
||||
"""Create a new report for an inappropriate comment."""
|
||||
|
||||
model = UECommentReport
|
||||
form_class = UECommentReportForm
|
||||
template_name = "pedagogy/fragments/comment_report.jinja"
|
||||
template_name = "core/edit.jinja"
|
||||
permission_required = "pedagogy.add_uecommentreport"
|
||||
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
self.ue_comment = get_object_or_404(UEComment, pk=kwargs["comment_id"])
|
||||
return super().dispatch(request, *args, **kwargs)
|
||||
|
||||
@cached_property
|
||||
def ue_detail_url(self):
|
||||
return reverse("pedagogy:ue_detail", kwargs={"ue_id": self.ue_comment.ue.id})
|
||||
|
||||
def get_form_kwargs(self):
|
||||
kwargs = super().get_form_kwargs()
|
||||
kwargs["reporter_id"] = self.request.user.id
|
||||
kwargs["comment_id"] = self.ue_comment.id
|
||||
return kwargs
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
return super().get_context_data() | {
|
||||
"comment_id": self.ue_comment.id,
|
||||
"ue_detail_url": self.ue_detail_url,
|
||||
}
|
||||
|
||||
def form_valid(self, form):
|
||||
resp = super().form_valid(form)
|
||||
# Send a message to moderation admins
|
||||
@@ -206,10 +168,11 @@ class UECommentReportCreateView(PermissionRequiredMixin, AllowFragment, CreateVi
|
||||
url=reverse("pedagogy:moderation"),
|
||||
type="PEDAGOGY_MODERATION",
|
||||
)
|
||||
|
||||
return resp
|
||||
|
||||
def get_success_url(self):
|
||||
return self.ue_detail_url
|
||||
return reverse("pedagogy:ue_detail", kwargs={"ue_id": self.ue_comment.ue_id})
|
||||
|
||||
|
||||
class UEModerationFormView(PermissionRequiredMixin, FormView):
|
||||
|
||||
@@ -12,16 +12,35 @@
|
||||
{% trans %}Timetable generator{% endtrans %}
|
||||
{% endblock %}
|
||||
|
||||
{% block description -%}
|
||||
{% trans trimmed %}
|
||||
Get a nice schedule from the raw text in your student file
|
||||
{% endtrans %}
|
||||
{%- endblock %}
|
||||
|
||||
{% block metatags %}
|
||||
<meta property="og:url" content="{{ request.build_absolute_uri() }}" />
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:title" content="Générateur d'emploi du temps" />
|
||||
<meta property="og:image" content="{{ request.build_absolute_uri(static("core/img/logo_no_text.png")) }}" />
|
||||
<meta
|
||||
property="og:description"
|
||||
content="Générateur d'emploi du temps de l'UTBM.
|
||||
Copiez le texte de l'emploi du temps de votre dossier étudiant
|
||||
et récupérez une image plus jolie."
|
||||
/>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div x-data="timetableGenerator">
|
||||
<form @submit.prevent="generate()">
|
||||
<h1>Générateur d'emploi du temps</h1>
|
||||
<h1>{% trans %}Timetable generator{% endtrans %}</h1>
|
||||
<template x-if="error !== null" x-cloak>
|
||||
<div class="alert alert-red">
|
||||
<div class="alert-main">
|
||||
<p>
|
||||
{% trans trimmed %}
|
||||
Wrong timetable format. Make sure you copied if from your student folder.
|
||||
Wrong timetable format. Make sure you copied it from your student folder.
|
||||
{% endtrans %}
|
||||
</p>
|
||||
<template x-if="!!error.incorrectRow">
|
||||
@@ -34,7 +53,9 @@
|
||||
</div>
|
||||
</template>
|
||||
<div class="form-group">
|
||||
<label for="timetable-input">Colle ton emploi du temps (sans l'entête)</label>
|
||||
<label for="timetable-input">
|
||||
{% trans %}Paste your schedule (without the header){% endtrans %}
|
||||
</label>
|
||||
<textarea id="timetable-input" cols="30" rows="15" x-model="content"></textarea>
|
||||
</div>
|
||||
<input type="submit" class="btn btn-blue" value="{% trans %}Generate{% endtrans %}">
|
||||
|
||||
Reference in New Issue
Block a user