diff --git a/core/static/bundled/base-bundle-index.ts b/core/static/bundled/base-bundle-index.ts index 8556a99e..eb31af0d 100644 --- a/core/static/bundled/base-bundle-index.ts +++ b/core/static/bundled/base-bundle-index.ts @@ -62,6 +62,8 @@ document.body.addEventListener( }, ); +htmx.config.transitions = true; + Object.assign(window, { htmx }); /** diff --git a/pedagogy/models.py b/pedagogy/models.py index 7333037a..84f6bab4 100644 --- a/pedagogy/models.py +++ b/pedagogy/models.py @@ -125,7 +125,11 @@ class UE(models.Model): Returns: True if the user has already posted a comment on this UE, else False. """ - return self.comments.filter(author=user).exists() + 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] @cached_property def grade_global_average(self): diff --git a/pedagogy/static/pedagogy/css/pedagogy.scss b/pedagogy/static/pedagogy/css/pedagogy.scss index e94fa813..ca7cc368 100644 --- a/pedagogy/static/pedagogy/css/pedagogy.scss +++ b/pedagogy/static/pedagogy/css/pedagogy.scss @@ -69,6 +69,7 @@ $pedagogy-white-text: #f0f0f0; input[type="checkbox"] { display: none; } + margin-top: 10px; margin-bottom: 0; color: white; @@ -128,14 +129,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; @@ -168,10 +169,6 @@ $pedagogy-white-text: #f0f0f0; .input-stars { margin-top: 20px; } - - input[type="submit"] { - float: right; - } } .ue-details-container { @@ -333,8 +330,9 @@ $pedagogy-white-text: #f0f0f0; padding-left: 10px; } - .actions { + .action { float: right; + margin-top: 0; } } @@ -402,6 +400,7 @@ $pedagogy-white-text: #f0f0f0; a { color: $pedagogy-white-text; + cursor: pointer; } a:hover { @@ -443,4 +442,10 @@ details.accordion>.accordion-content { background-color: $white-color; border-color: $pedagogy-orange; border-right: none; +} + +.buttons { + display: flex; + justify-content: flex-end; + align-items: center; } \ No newline at end of file diff --git a/pedagogy/templates/pedagogy/fragments/comment_report.jinja b/pedagogy/templates/pedagogy/fragments/comment_report.jinja new file mode 100644 index 00000000..39f9e6f6 --- /dev/null +++ b/pedagogy/templates/pedagogy/fragments/comment_report.jinja @@ -0,0 +1,31 @@ +
\ No newline at end of file diff --git a/pedagogy/templates/pedagogy/fragments/ue_comment_form.jinja b/pedagogy/templates/pedagogy/fragments/ue_comment_form.jinja new file mode 100644 index 00000000..7ec115be --- /dev/null +++ b/pedagogy/templates/pedagogy/fragments/ue_comment_form.jinja @@ -0,0 +1,71 @@ +{% trans %}You already posted a comment on this UE. If you want to comment again, please modify or delete your previous comment.{% endtrans %}
+{% trans %}Global grade{% endtrans %}
+{% trans %}Utility{% endtrans %}
+{% trans %}Interest{% endtrans %}
+{% trans %}Teaching{% endtrans %}
+{% trans %}Work load{% endtrans %}
+{{ display_star(object.grade_global_average) }}
+{{ display_star(object.grade_utility_average) }}
+{{ display_star(object.grade_interest_average) }}
+{{ display_star(object.grade_teaching_average) }}
+{{ display_star(object.grade_work_load_average) }}
+{% trans %}Objectives{% endtrans %}
+{{ object.objectives|markdown }}
+{% trans %}Program{% endtrans %}
+{{ object.program|markdown }}
+{% trans %}Earned skills{% endtrans %}
+{{ object.skills|markdown }}
+{% trans %}Key concepts{% endtrans %}
+{{ object.key_concepts|markdown }}
+{% trans %}UE manager: {% endtrans %}{{ object.manager }}
+{% trans %}Global grade{% endtrans %}
-{% trans %}Utility{% endtrans %}
-{% trans %}Interest{% endtrans %}
-{% trans %}Teaching{% endtrans %}
-{% trans %}Work load{% endtrans %}
-{{ display_star(object.grade_global_average) }}
-{{ display_star(object.grade_utility_average) }}
-{{ display_star(object.grade_interest_average) }}
-{{ display_star(object.grade_teaching_average) }}
-{{ display_star(object.grade_work_load_average) }}
-{% trans %}Objectives{% endtrans %}
-{{ object.objectives|markdown }}
-{% trans %}Program{% endtrans %}
-{{ object.program|markdown }}
-{% trans %}Earned skills{% endtrans %}
-{{ object.skills|markdown }}
-{% trans %}Key concepts{% endtrans %}
-{{ object.key_concepts|markdown }}
-{% trans %}UE manager: {% endtrans %}{{ object.manager }}
-{% trans %}You already posted a comment on this UE. If you want to comment again, please modify or delete your previous comment.{% endtrans %}
-
{% trans %}Global grade{% endtrans %}
+{% trans %}Utility{% endtrans %}
+{% trans %}Interest{% endtrans %}
+{% trans %}Teaching{% endtrans %}
+{% trans %}Work load{% endtrans %}
+{{ display_star(comment.grade_global) }}
+{{ display_star(comment.grade_utility) }}
+{{ display_star(comment.grade_interest) }}
+{{ display_star(comment.grade_teaching) }}
+{{ display_star(comment.grade_work_load) }}
++ {% trans %}This comment has been reported{% endtrans %} +
+ {% endif %} + + {% if comment.author_id == user.id or user.has_perm("pedagogy.change_comment") %} + + {% endif %} + {% if comment.author_id == user.id or user.has_perm("pedagogy.delete_comment") %} + + {% endif %} ++ + {% trans %}Report this comment{% endtrans %} + +
+{{ comment.publish_date.strftime('%d/%m/%Y') }}
{{ user_profile_link(comment.author) }}