mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
[12.0] web_notify: improve popup UI (#1231)
* [ADD]: all available bootstrap notifications (success/danger/warning/info/default) * [IMP] use black color for text for default notification. * [FIX] reverted require string for `bus.Longpolling` and rename `on_message_received` to `on_message` to prevent collisions.
This commit is contained in:
committed by
David
parent
af2656ba00
commit
3db7072296
26
web_notify/static/src/js/widgets/notification.js
Normal file
26
web_notify/static/src/js/widgets/notification.js
Normal file
@@ -0,0 +1,26 @@
|
||||
odoo.define('web_notify.Notification', function (require) {
|
||||
"use strict";
|
||||
|
||||
var Notification = require('web.Notification');
|
||||
|
||||
Notification.include({
|
||||
icon_mapping: {
|
||||
'success': 'fa-thumbs-up',
|
||||
'danger': 'fa-exclamation-triangle',
|
||||
'warning': 'fa-exclamation',
|
||||
'info': 'fa-info',
|
||||
'default': 'fa-lightbulb-o',
|
||||
},
|
||||
init: function () {
|
||||
this._super.apply(this, arguments);
|
||||
// Delete default classes
|
||||
this.className = this.className.replace(' o_error', '');
|
||||
// Add custom icon and custom class
|
||||
this.icon = (this.type in this.icon_mapping) ?
|
||||
this.icon_mapping[this.type] :
|
||||
this.icon_mapping['default'];
|
||||
this.className += ' o_' + this.type;
|
||||
},
|
||||
});
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user