Skip to content
Extraits de code Groupes Projets
Valider eb0fbe51 rédigé par Dan Hansen's avatar Dan Hansen
Parcourir les fichiers

remove read/unread state, always mark notifications as read, only return 5...

remove read/unread state, always mark notifications as read, only return 5 notifications for json requests
parent 0b56ade4
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -24,7 +24,7 @@ class NotificationsController < VannaController
:conditions => conditions,
:order => 'created_at desc',
:include => [:target, {:actors => :profile}],
:limit => pager.per_page,
:limit => request.format == :json ? 5 : pager.per_page,
:offset => pager.offset
)
......
......@@ -14,6 +14,7 @@
evt.stopPropagation();
self.getNotifications(function() {
self.badge.addClass("active");
self.renderNotifications();
self.dropdown.css("display", "block");
});
......@@ -21,6 +22,7 @@
evt.preventDefault();
evt.stopPropagation();
self.badge.removeClass("active");
self.dropdown.css("display", "none");
});
......@@ -52,12 +54,28 @@
$.each(self.notifications.notifications, function(index, notifications) {
$.each(notifications, function(index, notification) {
$("<div/>")
var notificationElement = $("<div/>")
.addClass("notification_element")
.addClass((notification.unread) ? "unread" : "read" )
.html(notification.translation)
.prepend($("<img/>", { src: notification.actors[0].avatar }))
.prependTo(self.dropdownNotifications);
.append("<br />")
.append($("<abbr/>", {
"class": "timeago",
"title": notification.created_at
}))
.appendTo(self.dropdownNotifications);
Diaspora.widgets.timeago.updateTimeAgo(".notification_element time.timeago");
if(notification.unread) {
$.ajax({
url: "/notifications/" + notification.id,
type: "PUT",
success: function() {
Diaspora.widgets.notifications.decrementCount();
}
});
}
});
});
};
......
......@@ -3082,10 +3082,6 @@ ul.left_nav
.notification_element
:padding 10px 20px
:min-height 30px
.unread
:background #CCC
.read
:background white
img
:height 30px
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter