diff --git a/app/controllers/notifications_controller.rb b/app/controllers/notifications_controller.rb index af52b16a3..52c5bd3f7 100644 --- a/app/controllers/notifications_controller.rb +++ b/app/controllers/notifications_controller.rb @@ -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 ) diff --git a/public/javascripts/widgets/notifications-badge.js b/public/javascripts/widgets/notifications-badge.js index ff2d0ad81..72301de06 100644 --- a/public/javascripts/widgets/notifications-badge.js +++ b/public/javascripts/widgets/notifications-badge.js @@ -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) { - $("
") + var notificationElement = $("") .addClass("notification_element") - .addClass((notification.unread) ? "unread" : "read" ) .html(notification.translation) .prepend($("