diff --git a/app/code/Magento/Ui/view/base/web/js/modal/modal.js b/app/code/Magento/Ui/view/base/web/js/modal/modal.js index f5c284165d8d2..2e797a09d225f 100644 --- a/app/code/Magento/Ui/view/base/web/js/modal/modal.js +++ b/app/code/Magento/Ui/view/base/web/js/modal/modal.js @@ -308,7 +308,7 @@ define([ * Close modal. * * @return {Element} - current element. */ - closeModal: function () { + closeModal: function (event, result) {//eslint-disable-line no-unused-vars var that = this; this._removeKeyListener(); diff --git a/app/code/Magento/Ui/view/base/web/js/modal/prompt.js b/app/code/Magento/Ui/view/base/web/js/modal/prompt.js index 13b4d55ea2787..d5a8654249612 100644 --- a/app/code/Magento/Ui/view/base/web/js/modal/prompt.js +++ b/app/code/Magento/Ui/view/base/web/js/modal/prompt.js @@ -51,8 +51,8 @@ define([ /** * Click handler. */ - click: function () { - this.closeModal(); + click: function (event) { + this.closeModal(event); } }, { text: $.mage.__('OK'), @@ -61,8 +61,8 @@ define([ /** * Click handler. */ - click: function () { - this.closeModal(true); + click: function (event) { + this.closeModal(event, true); } }] }, @@ -75,7 +75,7 @@ define([ this.options.validation = this.options.validation && this.options.validationRules.length; this._super(); this.modal.find(this.options.modalContent).append(this.getFormTemplate()); - this.modal.find(this.options.modalCloseBtn).off().on('click', _.bind(this.closeModal, this, false)); + this.modal.find(this.options.modalCloseBtn).off().on('click', _.bind(this.closeModal, this)); if (this.options.validation) { this.setValidationClasses(); @@ -152,21 +152,23 @@ define([ /** * Close modal window */ - closeModal: function (result) { + closeModal: function (event, result) { var value; + result = result || false; + if (result) { if (this.options.validation && !this.validate()) { return false; } value = this.modal.find(this.options.promptField).val(); - this.options.actions.confirm.call(this, value); + this.options.actions.confirm.call(event, value); } else { - this.options.actions.cancel.call(this, result); + this.options.actions.cancel.call(event, result); } - this.options.actions.always(); + this.options.actions.always(event); this.element.bind('promptclosed', _.bind(this._remove, this)); return this._super(); @@ -177,3 +179,4 @@ define([ return $('
').html(config.content).prompt(config); }; }); +