Skip to content

Commit 76dad58

Browse files
author
Stanislav Idolov
authored
🔃 [EngCom] Public Pull Requests - 2.1-develop
Accepted Public Pull Requests: - #15863: [Backport] Refactored javascript code of admin notification modal popup (by @rahul-kachhadiya)
2 parents deabc3c + 788a597 commit 76dad58

File tree

3 files changed

+34
-16
lines changed
  • app/code/Magento/AdminNotification/view/adminhtml
  • dev/tests/functional/tests/app/Magento/Tax/Test/Page/Adminhtml

3 files changed

+34
-16
lines changed

app/code/Magento/AdminNotification/view/adminhtml/templates/system/messages/popup.phtml

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,12 @@
1919
</ul>
2020
</div>
2121

22-
<script>
23-
require([
24-
"jquery",
25-
"Magento_Ui/js/modal/modal"
26-
], function($){
27-
if (this.modal) {
28-
this.modal.html($('[data-role="system_messages_list"]').html());
29-
} else {
30-
this.modal = $('[data-role="system_messages_list"]').modal({
31-
modalClass: 'modal-system-messages ui-popup-message',
32-
type: 'popup',
33-
buttons: []
34-
});
22+
<script type="text/x-magento-init">
23+
{
24+
"[data-role=system_messages_list]": {
25+
"Magento_AdminNotification/js/system/messages/popup": {
26+
"class":"modal-system-messages ui-popup-message"
27+
}
28+
}
3529
}
36-
this.modal.modal('openModal');
37-
});
3830
</script>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/**
2+
* Copyright © Magento, Inc. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
6+
define([
7+
'jquery',
8+
'Magento_Ui/js/modal/modal'
9+
], function ($, modal) {
10+
'use strict';
11+
12+
return function (data, element) {
13+
14+
if (modal.modal) {
15+
modal.modal.html($(element).html());
16+
} else {
17+
modal.modal = $(element).modal({
18+
modalClass: data.class,
19+
type: 'popup',
20+
buttons: []
21+
});
22+
}
23+
24+
modal.modal.modal('openModal');
25+
};
26+
});

dev/tests/functional/tests/app/Magento/Tax/Test/Page/Adminhtml/TaxConfiguration.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd">
99
<page name="TaxConfiguration" area="Adminhtml" mca="admin/system_config/edit/section/tax" module="Magento_Tax">
10-
<block name="notificationBlockPopup" class="Magento\Tax\Test\Block\Adminhtml\System\Config\NotificationPopup" locator=".ui-popup-message .modal-inner-wrap" strategy="css selector" />
10+
<block name="notificationBlockPopup" class="Magento\Tax\Test\Block\Adminhtml\System\Config\NotificationPopup" locator=".ui-popup-message._show .modal-inner-wrap" strategy="css selector" />
1111
<block name="notificationBlock" class="Magento\Tax\Test\Block\Adminhtml\System\Config\Notification" locator="#system_messages" strategy="css selector" />
1212
<block name="pageActions" class="Magento\Backend\Test\Block\System\Config\PageActions" locator=".page-main-actions" strategy="css selector" />
1313
<block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages" strategy="css selector" />

0 commit comments

Comments
 (0)