Skip to content

Commit

Permalink
Refactor message popup js
Browse files Browse the repository at this point in the history
  • Loading branch information
RahulKachhadia committed May 23, 2018
1 parent 4037c51 commit c842b24
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,12 @@
</ul>
</div>

<script>
require([
"jquery",
"Magento_Ui/js/modal/modal"
], function($){
if (this.modal) {
this.modal.html($('[data-role="system_messages_list"]').html());
} else {
this.modal = $('[data-role="system_messages_list"]').modal({
modalClass: 'modal-system-messages ui-popup-message',
type: 'popup',
buttons: []
});
<script type="text/x-magento-init">
{
"[data-role=system_messages_list]": {
"Magento_AdminNotification/js/system/messages/popup": {
class: 'modal-system-messages ui-popup-message'
}
}
}
this.modal.modal('openModal');
});
</script>
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

define([
"jquery",
"Magento_Ui/js/modal/modal"
], function($){
'use strict';

return function (data, element) {
if (this.modal) {
this.modal.html($(element).html());
} else {
this.modal = $(element).modal({
modalClass: data.class,
type: 'popup',
buttons: []
});
}
this.modal.modal('openModal');
};
});

0 comments on commit c842b24

Please sign in to comment.