diff --git a/vendor/magento/module-invitation/Block/Adminhtml/Invitation/View.php b/vendor/magento/module-invitation/Block/Adminhtml/Invitation/View.php index f63439b064ec..442aa007fbf3 100644 --- a/vendor/magento/module-invitation/Block/Adminhtml/Invitation/View.php +++ b/vendor/magento/module-invitation/Block/Adminhtml/Invitation/View.php @@ -14,8 +14,6 @@ class View extends \Magento\Backend\Block\Widget\Container { /** - * Core registry - * * @var \Magento\Framework\Registry */ protected $_coreRegistry = null; @@ -89,7 +87,13 @@ protected function _prepareLayout() ); $this->buttonList->add( 'resend', - ['label' => __('Send Invitation'), 'onclick' => "setLocation('{$massResendUrl}')"], + [ + 'label' => __('Send Invitation'), + 'id' => 'invitation-view-send-invitation-button', + 'data_attribute' => [ + 'url' => $massResendUrl + ] + ], -1 ); } diff --git a/vendor/magento/module-invitation/view/adminhtml/layout/invitations_index_view.xml b/vendor/magento/module-invitation/view/adminhtml/layout/invitations_index_view.xml index c0b9111e1a09..778d914f171e 100644 --- a/vendor/magento/module-invitation/view/adminhtml/layout/invitations_index_view.xml +++ b/vendor/magento/module-invitation/view/adminhtml/layout/invitations_index_view.xml @@ -6,6 +6,9 @@ */ --> + + + diff --git a/vendor/magento/module-invitation/view/adminhtml/web/index/view/post-wrapper.js b/vendor/magento/module-invitation/view/adminhtml/web/index/view/post-wrapper.js new file mode 100644 index 000000000000..8bcdca9ee8d3 --- /dev/null +++ b/vendor/magento/module-invitation/view/adminhtml/web/index/view/post-wrapper.js @@ -0,0 +1,47 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +define([ + 'jquery', + 'Magento_Ui/js/modal/confirm', + 'mage/translate' +], function ($, confirm) { + 'use strict'; + + /** + * @param {String} url + * @returns {jQuery} + */ + function getForm(url) { + return $('
', { + 'action': url, + 'method': 'POST' + }).append($('', { + 'name': 'form_key', + 'value': window.FORM_KEY, + 'type': 'hidden' + })); + } + + $('#invitation-view-send-invitation-button').on('click', function () { + const msg = $.mage.__('Are you sure you want to do this?'), + url = $('#invitation-view-send-invitation-button').data('url'); + + confirm({ + 'content': msg, + 'actions': { + + /** + * 'Confirm' action handler. + */ + confirm: function () { + getForm(url).appendTo('body').trigger('submit'); + } + } + }); + + return false; + }); +}); diff --git a/vendor/magento/module-invitation/view/adminhtml/web/js/bootstrap/index-post-action.js b/vendor/magento/module-invitation/view/adminhtml/web/js/bootstrap/index-post-action.js new file mode 100644 index 000000000000..ddf6950df1e0 --- /dev/null +++ b/vendor/magento/module-invitation/view/adminhtml/web/js/bootstrap/index-post-action.js @@ -0,0 +1,8 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +require([ + 'Magento_Invitation/index/view/post-wrapper' +]);