From 4ce54b001100097611d3a6e236b4f0a6df3acade Mon Sep 17 00:00:00 2001 From: Prateeksha Singh Date: Mon, 20 Aug 2018 13:07:23 +0530 Subject: [PATCH] [feat] new component: NotificationMessage --- .../js/hub/components/notification_message.js | 20 +++++++++++++++++++ erpnext/public/js/hub/pages/publish.js | 17 ---------------- erpnext/public/js/hub/pages/subpage.js | 6 ++++++ 3 files changed, 26 insertions(+), 17 deletions(-) create mode 100644 erpnext/public/js/hub/components/notification_message.js diff --git a/erpnext/public/js/hub/components/notification_message.js b/erpnext/public/js/hub/components/notification_message.js new file mode 100644 index 0000000000..890c298674 --- /dev/null +++ b/erpnext/public/js/hub/components/notification_message.js @@ -0,0 +1,20 @@ +const NotificationMessage = (message) => { + const $message = $(`
+

+ + ${message} + + +

+
`); + + $message.find('.octicon-x').on('click', () => { + $message.remove(); + }); + + return $message; +} + +export { + NotificationMessage +} diff --git a/erpnext/public/js/hub/pages/publish.js b/erpnext/public/js/hub/pages/publish.js index 46e4545d9b..8de7b3844c 100644 --- a/erpnext/public/js/hub/pages/publish.js +++ b/erpnext/public/js/hub/pages/publish.js @@ -212,23 +212,6 @@ erpnext.hub.Publish = class Publish extends SubPage { // } - show_message(message) { - const $message = $(`
-

- - ${message} - - -

-
`); - - $message.find('.octicon-x').on('click', () => { - $message.remove(); - }); - - this.$wrapper.prepend($message); - } - make_publish_in_progress_state() { this.$wrapper.empty(); diff --git a/erpnext/public/js/hub/pages/subpage.js b/erpnext/public/js/hub/pages/subpage.js index 7c75b1379e..fd058387a0 100644 --- a/erpnext/public/js/hub/pages/subpage.js +++ b/erpnext/public/js/hub/pages/subpage.js @@ -1,3 +1,5 @@ +import { NotificationMessage } from '../components/notification_message'; + export default class SubPage { constructor(parent, options) { this.$parent = $(parent); @@ -42,4 +44,8 @@ export default class SubPage { hide() { this.$wrapper.hide(); } + + show_message(message) { + this.$wrapper.prepend(NotificationMessage(message)); + } }