changeset 2519:f8742e1acf08 beta

add highlight of current filter in notifications
author Marcin Kuzminski <marcin@python-works.com>
date Sat, 30 Jun 2012 23:32:52 +0200
parents 83aff72a1da7
children a1e156503afe
files rhodecode/controllers/admin/notifications.py rhodecode/public/css/style.css rhodecode/templates/admin/notifications/notifications.html
diffstat 3 files changed, 19 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/controllers/admin/notifications.py	Sat Jun 30 23:12:34 2012 +0200
+++ b/rhodecode/controllers/admin/notifications.py	Sat Jun 30 23:32:52 2012 +0200
@@ -67,6 +67,14 @@
         c.pull_request_type = Notification.TYPE_PULL_REQUEST
         c.comment_type = [Notification.TYPE_CHANGESET_COMMENT,
                           Notification.TYPE_PULL_REQUEST_COMMENT]
+
+        _current_filter = request.GET.getall('type')
+        c.current_filter = 'all'
+        if _current_filter == [c.pull_request_type]:
+            c.current_filter = 'pull_request'
+        elif _current_filter == c.comment_type:
+            c.current_filter = 'comment'
+
         return render('admin/notifications/notifications.html')
 
     def mark_all_read(self):
--- a/rhodecode/public/css/style.css	Sat Jun 30 23:12:34 2012 +0200
+++ b/rhodecode/public/css/style.css	Sat Jun 30 23:32:52 2012 +0200
@@ -3348,6 +3348,10 @@
   border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);	
 }
 
+.ui-btn.active{
+    font-weight: bold;
+}
+
 ins,div.options a:hover {
 	text-decoration: none;
 }
--- a/rhodecode/templates/admin/notifications/notifications.html	Sat Jun 30 23:12:34 2012 +0200
+++ b/rhodecode/templates/admin/notifications/notifications.html	Sat Jun 30 23:32:52 2012 +0200
@@ -27,7 +27,7 @@
     
       <div style="padding:14px 18px;text-align: right;float:left">
       <span id='all' class="ui-btn"><a href="${h.url.current()}">${_('All')}</a></span>
-      <span id='pull_request' class="ui-btn"><a href="${h.url.current(type=c.comment_type)}">${_('Comments')}</a></span>
+      <span id='comment' class="ui-btn"><a href="${h.url.current(type=c.comment_type)}">${_('Comments')}</a></span>
       <span id='pull_request' class="ui-btn"><a href="${h.url.current(type=c.pull_request_type)}">${_('Pull requests')}</a></span>
       </div>
       %if c.notifications:
@@ -54,5 +54,11 @@
     	})
     });
 })
+
+var current_filter = "${c.current_filter}";
+if (YUD.get(current_filter)){
+	YUD.addClass(current_filter, 'active');
+}
+console.log(current_filter);
 </script>
 </%def>