Commit b156bc271519fbbec685d6a354cf6c767c511f3d
1 parent
d66af035
Exists in
master
and in
5 other branches
review #53, scroll of notifiation is done, I'll create another issue to work on …
…how to make the ajax calls work, in parallel, I'm working the notifications decorators, which are not working properly
Showing
5 changed files
with
14 additions
and
9 deletions
Show diff stats
app/views.py
@@ -18,10 +18,7 @@ class AppIndex(LoginRequiredMixin, LogMixin, ListView, NotificationMixin): | @@ -18,10 +18,7 @@ class AppIndex(LoginRequiredMixin, LogMixin, ListView, NotificationMixin): | ||
18 | context_object_name = 'objects' | 18 | context_object_name = 'objects' |
19 | paginate_by = 10 | 19 | paginate_by = 10 |
20 | 20 | ||
21 | - action_name = "Acessar" | ||
22 | - resource_name = "home" | ||
23 | - users = User.objects.all() | ||
24 | - message="testing login and notification broadcast" | 21 | + |
25 | 22 | ||
26 | def get_queryset(self): | 23 | def get_queryset(self): |
27 | if self.request.user.is_staff: | 24 | if self.request.user.is_staff: |
@@ -45,7 +42,7 @@ class AppIndex(LoginRequiredMixin, LogMixin, ListView, NotificationMixin): | @@ -45,7 +42,7 @@ class AppIndex(LoginRequiredMixin, LogMixin, ListView, NotificationMixin): | ||
45 | else: | 42 | else: |
46 | self.template_name = "home_teacher_student_content.html" | 43 | self.template_name = "home_teacher_student_content.html" |
47 | 44 | ||
48 | - super(AppIndex, self).createNotification("testando notificacao de login", resource_name="home", resource_link="/login") | 45 | + #super(AppIndex, self).createNotification("testando notificacao de login", resource_name="home", resource_link="/") |
49 | return self.response_class(request = self.request, template = self.template_name, context = context, using = self.template_engine, **response_kwargs) | 46 | return self.response_class(request = self.request, template = self.template_name, context = context, using = self.template_engine, **response_kwargs) |
50 | 47 | ||
51 | 48 |
core/mixins.py
@@ -44,9 +44,9 @@ class NotificationMixin(object): | @@ -44,9 +44,9 @@ class NotificationMixin(object): | ||
44 | action_name = '' | 44 | action_name = '' |
45 | resource_name = '' | 45 | resource_name = '' |
46 | 46 | ||
47 | - def createNotification(self, message='', actor=None, users = User.objects.all(), action_name = '', resource_name='', resource_link=''): #the default will be a broadcast | 47 | + def createNotification(self, message='', actor=None, users = User.objects.all(), resource_slug='' ,action_name = '', resource_name='', resource_link=''): #the default will be a broadcast |
48 | action = Action.objects.filter(name = action_name) | 48 | action = Action.objects.filter(name = action_name) |
49 | - resource = Resource.objects.filter(name = resource_name) | 49 | + resource = Resource.objects.filter(slug = resource_slug) |
50 | print(message) | 50 | print(message) |
51 | if action.exists(): | 51 | if action.exists(): |
52 | action = action[0] | 52 | action = action[0] |
core/static/css/base/amadeus.css
core/templates/base.html
@@ -54,7 +54,7 @@ | @@ -54,7 +54,7 @@ | ||
54 | <ul class="nav navbar-nav navbar-right notifications"> | 54 | <ul class="nav navbar-nav navbar-right notifications"> |
55 | <li class="" data-toggle="tooltip" data-placement="bottom" title data-original-title="notifications"> | 55 | <li class="" data-toggle="tooltip" data-placement="bottom" title data-original-title="notifications"> |
56 | <a class="dropdown-toggle" data-toggle="dropdown"> <span class="badge notification-count">{{notifications.count}}</span><i class="fa fa-bell-o" aria-hidden="true"></i></a> | 56 | <a class="dropdown-toggle" data-toggle="dropdown"> <span class="badge notification-count">{{notifications.count}}</span><i class="fa fa-bell-o" aria-hidden="true"></i></a> |
57 | - <ul class="dropdown-menu"> | 57 | + <ul id="notification-dropdown" class="dropdown-menu"> |
58 | <li class="dropdown-header">Notifications</li> | 58 | <li class="dropdown-header">Notifications</li> |
59 | {% for notification in notifications %} | 59 | {% for notification in notifications %} |
60 | {% if notification.actor %} <!-- if the notification has a user--> | 60 | {% if notification.actor %} <!-- if the notification has a user--> |
core/views.py
@@ -93,7 +93,6 @@ def processNotification(self, notificationId): | @@ -93,7 +93,6 @@ def processNotification(self, notificationId): | ||
93 | notification = Notification.objects.get(id= notificationId) | 93 | notification = Notification.objects.get(id= notificationId) |
94 | notification.read = True | 94 | notification.read = True |
95 | notification.save() | 95 | notification.save() |
96 | - print(notification.action_resource) | ||
97 | return redirect(notification.action_resource.resource.url) | 96 | return redirect(notification.action_resource.resource.url) |
98 | 97 | ||
99 | # class LoginClass(LoginView): | 98 | # class LoginClass(LoginView): |