mark notifications as read and update badge

This commit is contained in:
danielvincent 2010-12-25 16:27:09 -05:00
parent 4ff9622bfc
commit 30dd11b9fa
2 changed files with 10 additions and 3 deletions

View file

@ -1,7 +1,8 @@
:javascript
$('.message').live('click', function(evt){
var note = $(this).closest('.message'),
note_id = note.attr('data-guid');
note_id = note.attr('data-guid'),
nBadge = $("#notification_badge_number");
if(note.hasClass('unread') ){
note.removeClass('unread');
@ -10,8 +11,15 @@
type: 'PUT'
});
}
});
nBadge.html().replace(/\d+/, function(num){
num = parseInt(num);
nBadge.html(parseInt(num)-1);
if(num == 1) {
nBadge.addClass("hidden");
}
});
});
.span-1
= image_tag 'icons/mail_big.png', :height => 30, :width => 30, :style=>"margin-top:3px;"

View file

@ -54,7 +54,6 @@ var WebSocketReceiver = {
processNotification: function(notification){
var nBadge = $("#notification_badge_number");
nBadge.html().replace(/\d+/, function(num){