diff --git a/public/css/style.less b/public/css/style.less index 46e3410ecb..d361197625 100644 --- a/public/css/style.less +++ b/public/css/style.less @@ -42,7 +42,7 @@ button, a { vertical-align: 17%; } .nav .badge { - vertical-align: 10%; + vertical-align: 2%; } #alert_window { diff --git a/public/src/forum/unread.js b/public/src/forum/unread.js index cdf4c8a95c..82819e5f7d 100644 --- a/public/src/forum/unread.js +++ b/public/src/forum/unread.js @@ -56,6 +56,10 @@ $('#topics-container').empty(); $('#category-no-topics').removeClass('hidden'); app.alertSuccess('All topics marked as read!'); + $('#numUnreadBadge') + .removeClass('badge-important') + .addClass('badge-inverse') + .html('0'); } else { app.alertError('There was an error marking topics read!'); } diff --git a/public/src/utils.js b/public/src/utils.js index db25a91d0a..fce4d0ecdd 100644 --- a/public/src/utils.js +++ b/public/src/utils.js @@ -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') + } + }); } } diff --git a/public/templates/header.tpl b/public/templates/header.tpl index cd95b71d80..a806fd56de 100644 --- a/public/templates/header.tpl +++ b/public/templates/header.tpl @@ -49,7 +49,7 @@ Recent