diff rhodecode/public/js/rhodecode.js @ 2610:3fdf7c3be2c9 beta

added mark as read for single notifications
author Marcin Kuzminski <marcin@python-works.com>
date Sun, 15 Jul 2012 04:02:58 +0200
parents 58c529332e7e
children e83be26bb8d8
line wrap: on
line diff
--- a/rhodecode/public/js/rhodecode.js	Sun Jul 15 03:15:43 2012 +0200
+++ b/rhodecode/public/js/rhodecode.js	Sun Jul 15 04:02:58 2012 +0200
@@ -839,6 +839,27 @@
     											  callback, postData);
 };	
 
+var readNotification = function(url, notification_id,callbacks){
+    var callback = { 
+		success:function(o){
+		    var obj = YUD.get(String("notification_"+notification_id));
+		    YUD.removeClass(obj, 'unread');
+		    var r_button = obj.children[0].getElementsByClassName('read-notification')[0]
+		    
+		    if(r_button.parentNode !== undefined){
+		    	r_button.parentNode.removeChild(r_button);
+			}		    
+			_run_callbacks(callbacks);
+		},
+	    failure:function(o){
+	        alert("error");
+	    },
+	};
+    var postData = '_method=put';
+    var sUrl = url.replace('__NOTIFICATION_ID__',notification_id);
+    var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, 
+    											  callback, postData);
+};	
 
 /** MEMBERS AUTOCOMPLETE WIDGET **/