added badge to header for unread topics count

This commit is contained in:
psychobunny
2013-08-22 00:08:11 +08:00
parent 746fa93c80
commit f1547a7b1f
6 changed files with 32 additions and 7 deletions

View File

@@ -137,6 +137,22 @@
document.title = (numNotifications > 0 ? '(' + numNotifications + ') ' : '') + title;
if (numNotifications > 0) document.querySelector('.notifications a i').className = 'icon-circle active';
});
jQuery.getJSON(RELATIVE_PATH + '/api/unread/total', function(data) {
var badge = jQuery('#numUnreadBadge');
badge.html(data.count > 20 ? '20+' : data.count);
if (data.count > 0) {
badge
.removeClass('badge-inverse')
.addClass('badge-important')
}
else {
badge
.removeClass('badge-important')
.addClass('badge-inverse')
}
});
}
}