From: Magnus Kühn Date: Wed, 2 Jan 2013 20:22:06 +0000 (+0100) Subject: Added support for a confirm message X-Git-Tag: 2.0.0_Beta_1~606^2^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=fc8ba59a0de84ca1a46d2f3f99ccaa1ce29542ca;p=GitHub%2FWoltLab%2FWCF.git Added support for a confirm message --- diff --git a/wcfsetup/install/files/js/WCF.js b/wcfsetup/install/files/js/WCF.js index 80c433f457..f45fa2eaaa 100755 --- a/wcfsetup/install/files/js/WCF.js +++ b/wcfsetup/install/files/js/WCF.js @@ -1895,11 +1895,36 @@ WCF.Action.Toggle = Class.extend({ * @param object event */ _click: function(event) { + var $target = $(event.currentTarget); + + if ($target.data('confirmMessage')) { + WCF.System.Confirmation.show($target.data('confirmMessage'), $.proxy(this._execute, this), { target: $target }); + } + else { + this._sendRequest($target); + } + }, + + /** + * Executes toggeling. + * + * @param string action + * @param object parameters + */ + _execute: function(action, parameters) { + if (action === 'cancel') { + return; + } + + this._sendRequest(parameters.target); + }, + + _sendRequest: function(object) { this.proxy.setOption('data', { actionName: 'toggle', className: this._className, interfaceName: 'wcf\\data\\IToggleAction', - objectIDs: [ $(event.target).data('objectID') ] + objectIDs: [ $(object).data('objectID') ] }); this.proxy.sendRequest();