diff rhodecode/controllers/admin/notifications.py @ 2190:64f7cf8f6a33 beta

notification inbox improvements - added pagers - css+styling fixes
author Marcin Kuzminski <marcin@python-works.com>
date Sat, 14 Apr 2012 23:42:43 +0200
parents 89efedac4e6c
children 74f2910f7ad9
line wrap: on
line diff
--- a/rhodecode/controllers/admin/notifications.py	Sat Apr 14 22:40:47 2012 +0200
+++ b/rhodecode/controllers/admin/notifications.py	Sat Apr 14 23:42:43 2012 +0200
@@ -30,6 +30,8 @@
 from pylons import tmpl_context as c, url
 from pylons.controllers.util import redirect
 
+from webhelpers.paginate import Page
+
 from rhodecode.lib.base import BaseController, render
 from rhodecode.model.db import Notification
 
@@ -58,8 +60,9 @@
         """GET /_admin/notifications: All items in the collection"""
         # url('notifications')
         c.user = self.rhodecode_user
-        c.notifications = NotificationModel()\
-                            .get_for_user(self.rhodecode_user.user_id)
+        notif = NotificationModel().get_for_user(self.rhodecode_user.user_id)
+        p = int(request.params.get('page', 1))
+        c.notifications = Page(notif, page=p, items_per_page=10)
         return render('admin/notifications/notifications.html')
 
     def mark_all_read(self):
@@ -69,7 +72,8 @@
             nm.mark_all_read_for_user(self.rhodecode_user.user_id)
             Session.commit()
             c.user = self.rhodecode_user
-            c.notifications = nm.get_for_user(self.rhodecode_user.user_id)
+            notif = nm.get_for_user(self.rhodecode_user.user_id)
+            c.notifications = Page(notif, page=1, items_per_page=10)
             return render('admin/notifications/notifications_data.html')
 
     def create(self):