Guewen Baconnier
7 years ago
committed by
Yannick Vaucher
8 changed files with 138 additions and 12 deletions
-
10web_notify/README.rst
-
5web_notify/__manifest__.py
-
17web_notify/models/res_users.py
-
5web_notify/static/src/css/notification.less
-
40web_notify/static/src/js/notification.js
-
47web_notify/static/src/js/web_client.js
-
24web_notify/static/src/xml/notification.xml
-
2web_notify/views/web_notify.xml
@ -0,0 +1,5 @@ |
|||||
|
.o_notification { |
||||
|
.o_notification_reload { |
||||
|
padding: 10px; |
||||
|
} |
||||
|
} |
@ -0,0 +1,40 @@ |
|||||
|
/* Copyright 2018 Camptocamp |
||||
|
* License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). */
|
||||
|
odoo.define('web_notify.notification', function (require) { |
||||
|
"use strict"; |
||||
|
|
||||
|
var base_notification = require('web.notification'), |
||||
|
WebClient = require('web.WebClient'), |
||||
|
Notification = base_notification.Notification, |
||||
|
Warning = base_notification.Warning; |
||||
|
|
||||
|
Notification.include({ |
||||
|
events: _.extend( |
||||
|
{}, |
||||
|
Notification.prototype.events, |
||||
|
{'click .o_view_reload': function(e){ |
||||
|
e.preventDefault(); |
||||
|
this.reload_active_view(); |
||||
|
} |
||||
|
} |
||||
|
), |
||||
|
init: function(parent, title, text, sticky, options) { |
||||
|
this._super.apply(this, arguments); |
||||
|
this.options = options || {}; |
||||
|
}, |
||||
|
reload_active_view: function() { |
||||
|
this.trigger_up('reload_active_view'); |
||||
|
}, |
||||
|
}); |
||||
|
|
||||
|
base_notification.NotificationManager.include({ |
||||
|
notify: function(title, text, sticky, options) { |
||||
|
return this.display(new Notification(this, title, text, sticky, options)); |
||||
|
}, |
||||
|
warn: function(title, text, sticky, options) { |
||||
|
return this.display(new Warning(this, title, text, sticky, options)); |
||||
|
}, |
||||
|
|
||||
|
}); |
||||
|
|
||||
|
}); |
@ -0,0 +1,24 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<templates id="template" xml:space="preserve"> |
||||
|
|
||||
|
<t t-name="Notification.reload"> |
||||
|
<div class="o_notification_reload" t-if="widget.options.show_reload"> |
||||
|
<a href="#" class="o_view_reload"> |
||||
|
<span class="fa fa-refresh"/> Reload current view |
||||
|
</a> |
||||
|
</div> |
||||
|
</t> |
||||
|
|
||||
|
<t t-extend="Notification"> |
||||
|
<t t-jquery=".o_notification_content" t-operation="after"> |
||||
|
<t t-call="Notification.reload"/> |
||||
|
</t> |
||||
|
</t> |
||||
|
|
||||
|
<t t-extend="Warning"> |
||||
|
<t t-jquery=".o_notification_content" t-operation="after"> |
||||
|
<t t-call="Notification.reload"/> |
||||
|
</t> |
||||
|
</t> |
||||
|
|
||||
|
</templates> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue