From: Matthias Schmidt Date: Tue, 27 Dec 2011 14:14:57 +0000 (+0100) Subject: Adds possibility to update badges after javascript deletions X-Git-Tag: 2.0.0_Beta_1~1472^2^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ff640b6839b0674dfc80ce6d873284a2dc27b9ea;p=GitHub%2FWoltLab%2FWCF.git Adds possibility to update badges after javascript deletions --- diff --git a/wcfsetup/install/files/js/WCF.js b/wcfsetup/install/files/js/WCF.js index 127fd1d58e..00d462af2c 100644 --- a/wcfsetup/install/files/js/WCF.js +++ b/wcfsetup/install/files/js/WCF.js @@ -1204,19 +1204,22 @@ WCF.Action.SimpleProxy.prototype = { * * @param string className * @param jQuery containerList + * @param jQuery badgeList */ -WCF.Action.Delete = function(className, containerList) { this.init(className, containerList); }; +WCF.Action.Delete = function(className, containerList, badgeList) { this.init(className, containerList, badgeList); }; WCF.Action.Delete.prototype = { /** * Initializes 'delete'-Proxy. * * @param string className * @param jQuery containerList + * @param jQuery badgeList */ - init: function(className, containerList) { + init: function(className, containerList, badgeList) { if (!containerList.length) return; this.containerList = containerList; this.className = className; + this.badgeList = badgeList; // initialize proxy var options = { @@ -1270,14 +1273,21 @@ WCF.Action.Delete.prototype = { */ _success: function(data, textStatus, jqXHR) { // remove items - this.containerList.each(function(index, container) { + this.containerList.each($.proxy(function(index, container) { var $objectID = $(container).find('.deleteButton').data('objectID'); if (WCF.inArray($objectID, data.objectIDs)) { $(container).wcfBlindOut('up', function() { $(container).empty().remove(); }, container); + + // update badges + if (this.badgeList) { + this.badgeList.each(function(innerIndex, badge) { + $(badge).html($(badge).html() - 1); + }); + } } - }); + }, this)); } };