diff --git a/core/context_processors.py b/core/context_processors.py index cd4dcf8..9c6daaa 100644 --- a/core/context_processors.py +++ b/core/context_processors.py @@ -5,6 +5,6 @@ def notifications(request): context['notifications'] = None if request.user.is_authenticated: return { - 'notifications': Notification.objects.filter(user= request.user, read=False).order_by('-datetime') + 'notifications': Notification.objects.filter(user= request.user, read=False).order_by('-datetime')[0:5] } return context diff --git a/core/static/js/base/amadeus.js b/core/static/js/base/amadeus.js index 6baf3b0..2f407e5 100644 --- a/core/static/js/base/amadeus.js +++ b/core/static/js/base/amadeus.js @@ -126,4 +126,14 @@ function validarCpfSemAlert(campo,nome,idElementoMensagemErro){ return true; } return retorno; -} \ No newline at end of file +} + +/* +This functions get the next 5 notifications from the user given a "step"(an amount) of previous notifications +*/ +function getNotifications(step){ + $.get('/getNotifications', + {'steps':step, 'amount': 5}, function(data){ + console.log(data); + }); +} diff --git a/core/static/js/base/header.js b/core/static/js/base/header.js index 9375087..fbf2635 100644 --- a/core/static/js/base/header.js +++ b/core/static/js/base/header.js @@ -6,8 +6,8 @@ $(document).ready(function(){ /* */ -function loadNotifications(step){ - $.ajax('/loadNotifications',{ +function getNotifications(step){ + $.ajax('/getNotifications',{ steps: step, amount: 5, sucess: function(response){ diff --git a/core/templates/base.html b/core/templates/base.html index 819160f..df40728 100644 --- a/core/templates/base.html +++ b/core/templates/base.html @@ -64,7 +64,7 @@ {% include "notifications.html" %}
See More
diff --git a/core/templates/notifications.html b/core/templates/notifications.html index c691d8c..7a643fd 100644 --- a/core/templates/notifications.html +++ b/core/templates/notifications.html @@ -1,31 +1,31 @@ {% for notification in notifications %} - {% if notification.actor %} -{{ notification.message }}
-{{ notification.message }}
+{{ notification.message }}
-{{ notification.message }}
+