MuK IT GmbH
6 years ago
6 changed files with 153 additions and 9 deletions
-
1muk_web_utils/static/src/js/core/files.js
-
35muk_web_utils/static/src/js/services/notification_service.js
-
46muk_web_utils/static/src/js/widgets/notification.js
-
27muk_web_utils/static/src/scss/notification.scss
-
34muk_web_utils/static/src/xml/notification.xml
-
19muk_web_utils/template/assets.xml
@ -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 <http://www.gnu.org/licenses/>.
|
|||
* |
|||
**********************************************************************************/ |
|||
|
|||
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); |
|||
} |
|||
}, |
|||
}); |
|||
|
|||
}); |
@ -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 <http://www.gnu.org/licenses/>.
|
|||
* |
|||
**********************************************************************************/ |
|||
|
|||
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); |
|||
}, |
|||
}); |
|||
|
|||
}); |
@ -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 <http://www.gnu.org/licenses/>. |
|||
* |
|||
**********************************************************************************/ |
|||
|
|||
.o_notification { |
|||
.mk_notification_progress { |
|||
padding: 2px 10px 10px 10px; |
|||
.progress { |
|||
background-color: rgba(0, 0, 0, 0.3); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,34 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
|
|||
<!-- |
|||
Copyright (C) 2018 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 <http://www.gnu.org/licenses/>. |
|||
--> |
|||
|
|||
<templates id="template" xml:space="preserve"> |
|||
|
|||
<t t-extend="Notification"> |
|||
<t t-jquery=".o_notification_content" t-operation="after"> |
|||
<div t-if="widget.progress" class="mk_notification_progress"> |
|||
<div class="progress"> |
|||
<div class="progress-bar" t-attf-style="width: #{widget.progress.state}%;"> |
|||
<t t-esc="widget.progress.text"/> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</t> |
|||
</t> |
|||
|
|||
</templates> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue