fix: notification read count doesn't decrement in menu bar (#7750)

* fix: notification read count doesn't decrement in menu bar

* also remove red color if we reach 0
This commit is contained in:
Tony Murray
2017-11-16 20:10:20 -06:00
committed by GitHub
parent e57feab499
commit de35e6e3a5
2 changed files with 9 additions and 2 deletions

View File

@@ -626,7 +626,7 @@ if (empty($notifications['count']) && empty($notifications['sticky_count'])) {
} else {
$class = 'badge-danger';
}
echo('<a href="#" class="dropdown-toggle" data-hover="dropdown" data-toggle="dropdown"><i class="fa fa-user fa-fw fa-lg fa-nav-icons" aria-hidden="true"></i> <span class="visible-xs-inline-block">User</span><span class="badge badge-navbar-user '.$class.'">'.($notifications['sticky_count']+$notifications['count']).'</span></a>');
echo('<a href="#" class="dropdown-toggle" data-hover="dropdown" data-toggle="dropdown"><i class="fa fa-user fa-fw fa-lg fa-nav-icons" aria-hidden="true"></i> <span class="visible-xs-inline-block">User</span><span class="badge badge-navbar-user count-notif '.$class.'">'.($notifications['sticky_count']+$notifications['count']).'</span></a>');
?>
<ul class="dropdown-menu">
<li><a href="preferences/"><i class="fa fa-cog fa-fw fa-lg" aria-hidden="true"></i> My Settings</a></li>

View File

@@ -221,7 +221,14 @@ $(function() {
$("#message").html('<div class="alert alert-info">' + data.message + '</div>');
$("#"+notif).parent().parent().parent().fadeOut();
$(".count-notif").each(function(){
this.innerHTML = this.innerHTML-1;
var new_count = this.innerHTML-1;
this.innerHTML = new_count;
if (new_count == 0) {
$this = $(this);
if ($this.hasClass('badge-danger')) {
$this.removeClass('badge-danger');
}
}
});
}
else {