mark notifications as read and update badge
This commit is contained in:
parent
4ff9622bfc
commit
30dd11b9fa
2 changed files with 10 additions and 3 deletions
|
|
@ -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;"
|
||||
|
|
|
|||
|
|
@ -54,7 +54,6 @@ var WebSocketReceiver = {
|
|||
|
||||
|
||||
processNotification: function(notification){
|
||||
|
||||
var nBadge = $("#notification_badge_number");
|
||||
|
||||
nBadge.html().replace(/\d+/, function(num){
|
||||
|
|
|
|||
Loading…
Reference in a new issue