Skip to content

Commit 34def88

Browse files
author
Stanislav Idolov
authored
ENGCOM-2081: [Forwardport] Refactored javascript code of admin notification modal popup #15812
2 parents 60521be + 9e3d468 commit 34def88

File tree

2 files changed

+32
-16
lines changed
  • app/code/Magento/AdminNotification/view/adminhtml

2 files changed

+32
-16
lines changed

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

Lines changed: 8 additions & 16 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-
});
38-
</script>
30+
</script>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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 ($) {
10+
'use strict';
11+
12+
return function (data, element) {
13+
if (this.modal) {
14+
this.modal.html($(element).html());
15+
} else {
16+
this.modal = $(element).modal({
17+
modalClass: data.class,
18+
type: 'popup',
19+
buttons: []
20+
});
21+
}
22+
this.modal.modal('openModal');
23+
};
24+
});

0 commit comments

Comments
 (0)