Updating badge on user panel loaded
authorAlexander Ebert <ebert@woltlab.com>
Sun, 28 Apr 2013 12:54:59 +0000 (14:54 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Sun, 28 Apr 2013 12:54:59 +0000 (14:54 +0200)
wcfsetup/install/files/js/WCF.js

index f7502b077f7aad804035f1d3477bfa046b14e702..37b37f30e9b7a7a5117d1fd319fb28f2e113fba0 100755 (executable)
@@ -7723,6 +7723,14 @@ WCF.UserPanel = Class.extend({
                
                if (data.returnValues && data.returnValues.template) {
                        $('' + data.returnValues.template).prependTo($dropdownMenu);
+                       
+                       // update badge
+                       var $badge = this._container.find('.badge');
+                       if (!$badge.length) {
+                               $badge = $('<span class="badge badgeInverse" />').appendTo(this._container.children('.dropdownToggle'));
+                       }
+                       $badge.html(data.returnValues.totalCount);
+                       
                        this._after($dropdownMenu);
                }
                else {