From fc8ba59a0de84ca1a46d2f3f99ccaa1ce29542ca Mon Sep 17 00:00:00 2001 From: =?utf8?q?Magnus=20K=C3=BChn?= Date: Wed, 2 Jan 2013 21:22:06 +0100 Subject: [PATCH] Added support for a confirm message --- wcfsetup/install/files/js/WCF.js | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) 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(); -- 2.20.1