From f3a5085905ac918993bc423ac025ae5b0276142b Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Thu, 21 Dec 2017 09:41:41 +0100 Subject: [PATCH] Add cancel button for guest comment dialog See #2502 --- com.woltlab.wcf/templates/commentAddGuestDialog.tpl | 1 + .../files/js/WoltLabSuite/Core/Ui/Comment/Add.js | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/com.woltlab.wcf/templates/commentAddGuestDialog.tpl b/com.woltlab.wcf/templates/commentAddGuestDialog.tpl index a2da40c3d2..e1a16a1658 100644 --- a/com.woltlab.wcf/templates/commentAddGuestDialog.tpl +++ b/com.woltlab.wcf/templates/commentAddGuestDialog.tpl @@ -22,4 +22,5 @@
+
diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Comment/Add.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Comment/Add.js index 35a666eccb..7c4293c6c3 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Comment/Add.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Comment/Add.js @@ -35,7 +35,8 @@ function( _insertMessage: function() {}, _ajaxSuccess: function() {}, _ajaxFailure: function() {}, - _ajaxSetup: function() {} + _ajaxSetup: function() {}, + _cancelGuestDialog: function() {} }; return Fake; } @@ -318,6 +319,7 @@ function( var dialog = UiDialog.getDialog('jsDialogGuestComment'); elBySel('input[type=submit]', dialog.content).addEventListener(WCF_CLICK_EVENT, this._submitGuestDialog.bind(this)); + elBySel('button[data-type="cancel"]', dialog.content).addEventListener(WCF_CLICK_EVENT, this._cancelGuestDialog.bind(this)); elBySel('input[type=text]', dialog.content).addEventListener('keypress', this._submitGuestDialog.bind(this)); } else { @@ -358,6 +360,15 @@ function( }, silent: true }; + }, + + /** + * Cancels the guest dialog and restores the comment editor. + */ + _cancelGuestDialog: function() { + UiDialog.close('jsDialogGuestComment'); + + this._hideLoadingOverlay(); } }; -- 2.20.1