From c842b246ba5927a9d1a3ef3b1c91a502bbb142d0 Mon Sep 17 00:00:00 2001 From: Rahul Kachhadiya Date: Sat, 19 May 2018 13:12:58 +0530 Subject: [PATCH] Refactor message popup js --- .../templates/system/messages/popup.phtml | 24 +++++++------------ .../adminhtml/web/js/system/messages/popup.js | 24 +++++++++++++++++++ 2 files changed, 32 insertions(+), 16 deletions(-) create mode 100644 app/code/Magento/AdminNotification/view/adminhtml/web/js/system/messages/popup.js diff --git a/app/code/Magento/AdminNotification/view/adminhtml/templates/system/messages/popup.phtml b/app/code/Magento/AdminNotification/view/adminhtml/templates/system/messages/popup.phtml index a97293547e132..d654504a41e5c 100644 --- a/app/code/Magento/AdminNotification/view/adminhtml/templates/system/messages/popup.phtml +++ b/app/code/Magento/AdminNotification/view/adminhtml/templates/system/messages/popup.phtml @@ -19,20 +19,12 @@ - + \ No newline at end of file diff --git a/app/code/Magento/AdminNotification/view/adminhtml/web/js/system/messages/popup.js b/app/code/Magento/AdminNotification/view/adminhtml/web/js/system/messages/popup.js new file mode 100644 index 0000000000000..4463f3bee84ea --- /dev/null +++ b/app/code/Magento/AdminNotification/view/adminhtml/web/js/system/messages/popup.js @@ -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'); + }; +}); \ No newline at end of file