From 5a71d4f9bd85aa7f6f941bad06c43efc541962c7 Mon Sep 17 00:00:00 2001 From: Zambom Date: Mon, 21 Aug 2017 23:31:59 -0300 Subject: [PATCH] Hiding pendencies buttons in non-student visualization --- notifications/templates/notifications/_view.html | 92 ++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------- notifications/views.py | 13 +++++++++++++ 2 files changed, 61 insertions(+), 44 deletions(-) diff --git a/notifications/templates/notifications/_view.html b/notifications/templates/notifications/_view.html index 83a3f74..36878b0 100644 --- a/notifications/templates/notifications/_view.html +++ b/notifications/templates/notifications/_view.html @@ -1,4 +1,6 @@ -{% load i18n notification_filters %} +{% load i18n notification_filters permissions_tags %} + +{% subject_permissions request.user subject as has_subject_permissions %} {% for notification in notifications %}
@@ -44,52 +46,54 @@
-
- - {% if notification.level == 4 %} - {% trans 'Access the task' %} - {% else %} - {% trans 'Realize the task' %} - {% endif %} - - - {% if notification.level < 3 %} - - + -
-
-
- {% csrf_token %} -
-
-
-
-
- -
-
-
-
-
-
- -
- {% endif %} -
+ {% if notification.level < 3 %} + + + +
+
+
+ {% csrf_token %} +
+
+
+
+
+ +
+
+
+
+
+
+ +
+ {% endif %} + + {% endif %} diff --git a/notifications/views.py b/notifications/views.py index 99d2596..b93108c 100644 --- a/notifications/views.py +++ b/notifications/views.py @@ -311,6 +311,17 @@ class AjaxNotifications(LoginRequiredMixin, generic.ListView): return notifications + def get_context_data(self, **kwargs): + context = super(AjaxNotifications, self).get_context_data(**kwargs) + + subject_id = self.kwargs.get('id', '') + subject = Subject.objects.get(id = subject_id) + + context['subject_id'] = subject_id + context['subject'] = subject + + return context + class AjaxHistory(LoginRequiredMixin, generic.ListView): login_url = reverse_lazy("users:login") redirect_field_name = 'next' @@ -351,8 +362,10 @@ class AjaxHistory(LoginRequiredMixin, generic.ListView): context = super(AjaxHistory, self).get_context_data(**kwargs) subject_id = self.kwargs.get('id', '') + subject = Subject.objects.get(id = subject_id) context['subject_id'] = subject_id + context['subject'] = subject context['rows'] = self.num_rows context['searched'] = self.request.GET.get("search", "") context['order_by'] = self.request.GET.get("order_by", "") -- libgit2 0.21.2