From 39bfb1bc1080cb76641d48e9c3bf7e5a880856a7 Mon Sep 17 00:00:00 2001 From: MuK IT GmbH Date: Wed, 7 Nov 2018 11:25:07 +0000 Subject: [PATCH] publish muk_web_utils - 12.0 --- muk_web_utils/static/src/js/core/files.js | 1 - .../src/js/services/notification_service.js | 35 ++++++++++++++ .../static/src/js/widgets/notification.js | 46 +++++++++++++++++++ .../static/src/scss/notification.scss | 27 +++++++++++ muk_web_utils/static/src/xml/notification.xml | 34 ++++++++++++++ muk_web_utils/template/assets.xml | 19 ++++---- 6 files changed, 153 insertions(+), 9 deletions(-) create mode 100644 muk_web_utils/static/src/js/services/notification_service.js create mode 100644 muk_web_utils/static/src/js/widgets/notification.js create mode 100644 muk_web_utils/static/src/scss/notification.scss create mode 100644 muk_web_utils/static/src/xml/notification.xml diff --git a/muk_web_utils/static/src/js/core/files.js b/muk_web_utils/static/src/js/core/files.js index 526f3a3..ab4d543 100644 --- a/muk_web_utils/static/src/js/core/files.js +++ b/muk_web_utils/static/src/js/core/files.js @@ -21,7 +21,6 @@ odoo.define('muk_web_utils.files', function (require) { "use strict"; var core = require('web.core'); -var utils = require('web.utils'); var QWeb = core.qweb; var _t = core._t; diff --git a/muk_web_utils/static/src/js/services/notification_service.js b/muk_web_utils/static/src/js/services/notification_service.js new file mode 100644 index 0000000..c188948 --- /dev/null +++ b/muk_web_utils/static/src/js/services/notification_service.js @@ -0,0 +1,35 @@ +/********************************************************************************** +* +* Copyright (C) 2017 MuK IT GmbH +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Affero General Public License as +* published by the Free Software Foundation, either version 3 of the +* License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Affero General Public License for more details. +* +* You should have received a copy of the GNU Affero General Public License +* along with this program. If not, see . +* +**********************************************************************************/ + +odoo.define('muk_web_utils.NotificationService', function (require) { +"use strict"; + +var NotificationService = require('web.NotificationService'); + +NotificationService.include({ + progress: function (notificationId, progress) { + console.log(this) + if(notificationId in this.notifications) { + var notification = this.notifications[notificationId]; + notification.updateProgress(progress.state, progress.text); + } + }, +}); + +}); diff --git a/muk_web_utils/static/src/js/widgets/notification.js b/muk_web_utils/static/src/js/widgets/notification.js new file mode 100644 index 0000000..ad9a6c8 --- /dev/null +++ b/muk_web_utils/static/src/js/widgets/notification.js @@ -0,0 +1,46 @@ +/********************************************************************************** +* +* Copyright (C) 2017 MuK IT GmbH +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Affero General Public License as +* published by the Free Software Foundation, either version 3 of the +* License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Affero General Public License for more details. +* +* You should have received a copy of the GNU Affero General Public License +* along with this program. If not, see . +* +**********************************************************************************/ + +odoo.define('muk_web_utils.Notification', function (require) { +"use strict"; + +var core = require('web.core'); + +var Notification = require('web.Notification'); + +var _t = core._t; +var QWeb = core.qweb; + +Notification.include({ + init: function (parent, params) { + this._super.apply(this, arguments); + this.icon = params.icon || this.icon; + this.progress = params.progress; + }, + updateProgress: function(state, text) { + console.log(state, text) + this.progress = {state: state, text: text}; + this.$(".progress-bar").animate({ + width: state + "%", + }, 250); + this.$(".progress-bar").text(text); + }, +}); + +}); \ No newline at end of file diff --git a/muk_web_utils/static/src/scss/notification.scss b/muk_web_utils/static/src/scss/notification.scss new file mode 100644 index 0000000..9d43d60 --- /dev/null +++ b/muk_web_utils/static/src/scss/notification.scss @@ -0,0 +1,27 @@ +/********************************************************************************** +* +* Copyright (C) 2017 MuK IT GmbH +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Affero General Public License as +* published by the Free Software Foundation, either version 3 of the +* License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Affero General Public License for more details. +* +* You should have received a copy of the GNU Affero General Public License +* along with this program. If not, see . +* +**********************************************************************************/ + +.o_notification { + .mk_notification_progress { + padding: 2px 10px 10px 10px; + .progress { + background-color: rgba(0, 0, 0, 0.3); + } + } +} diff --git a/muk_web_utils/static/src/xml/notification.xml b/muk_web_utils/static/src/xml/notification.xml new file mode 100644 index 0000000..4d6a79d --- /dev/null +++ b/muk_web_utils/static/src/xml/notification.xml @@ -0,0 +1,34 @@ + + + + + + + + +
+
+
+ +
+
+
+
+
+ +
\ No newline at end of file diff --git a/muk_web_utils/template/assets.xml b/muk_web_utils/template/assets.xml index d1f0b28..4c96b1a 100644 --- a/muk_web_utils/template/assets.xml +++ b/muk_web_utils/template/assets.xml @@ -37,16 +37,19 @@ + - - - - - - - - +