VRFS-285 update notification count in sidebar when receiving or deleting notification

This commit is contained in:
Brian Smith 2013-04-06 20:23:39 -04:00
parent d68b95cf73
commit 6b894589e9
1 changed files with 12 additions and 3 deletions

View File

@ -120,7 +120,7 @@
}
function deleteNotification(evt) {
decrementNotificationCount();
}
function initializeChatPanel() {
@ -238,6 +238,16 @@
$('#sidebar-search-results').height('0px');
}
function incrementNotificationCount() {
var count = parseInt($('#sidebar-notification-count').html());
$('#sidebar-notification-count').html(count + 1);
}
function decrementNotificationCount() {
var count = parseInt($('#sidebar-notification-count').html());
$('#sidebar-notification-count').html(count - 1);
}
// TODO
// (1) optimize so we're not hitting server on each keyup once > 2 characters are entered
// (2) hide any expanded panels once search starts
@ -302,8 +312,7 @@
logger.debug("Added notification " + notifications[payload.notification_id].id + " to array");
logger.debug("Notification size = " + notifications.length);
// set notification count
$('#sidebar-notification-count').html(notifications.length);
incrementNotificationCount();
var template = $("#template-notification-panel").html();
var notificationHtml = context.JK.fillTemplate(template, {