diff options
| author | Dhruv Patel <dhp@odoo.com> | 2020-06-02 07:19:05 +0000 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2020-06-10 08:36:05 +0000 |
| commit | 3288304f59bb473be6d5a5f8caf66f54c131b116 (patch) | |
| tree | 26c4d6bf082ae11199930943c5593386d26a9c00 /addons/web/static/src/js | |
| parent | 6c44424cd9230a23ba0262e5725698815530129e (diff) | |
[IMP] web,*: make notification title optional
*odoo_referral,portal
Currently, it is not possible to have one line notification,
when you are not passing the title parameter as an option when
generating the notification,then it will display the blank div
with the default button icon only. so it is not possible to have
one-line notifications since the title is mandatory.
So the purpose of the task is to make the title optional, allowing
for more minimalistic notification.
Also removed some unnecessary titles from the notification and
some stying change.
This commit also increase the autoclose delay of non sticky
notifications, from 2.5s to 4s.
task : 2264749
closes odoo/odoo#52229
Related: odoo/enterprise#10981
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: Dhruv Patel <dhp@odoo.com>
Diffstat (limited to 'addons/web/static/src/js')
| -rw-r--r-- | addons/web/static/src/js/chrome/abstract_web_client.js | 6 | ||||
| -rw-r--r-- | addons/web/static/src/js/core/service_mixins.js | 4 | ||||
| -rw-r--r-- | addons/web/static/src/js/widgets/notification.js | 2 |
3 files changed, 5 insertions, 7 deletions
diff --git a/addons/web/static/src/js/chrome/abstract_web_client.js b/addons/web/static/src/js/chrome/abstract_web_client.js index 56d00d80b9e..7c48784bd39 100644 --- a/addons/web/static/src/js/chrome/abstract_web_client.js +++ b/addons/web/static/src/js/chrome/abstract_web_client.js @@ -369,8 +369,7 @@ var AbstractWebClient = Widget.extend(KeyboardNavigationMixin, { */ _onConnectionLost: function () { this.connectionNotificationID = this.displayNotification({ - title: _t('Connection lost'), - message: _t('Trying to reconnect...'), + message: _t('Connection lost. Trying to reconnect...'), sticky: true }); }, @@ -384,8 +383,7 @@ var AbstractWebClient = Widget.extend(KeyboardNavigationMixin, { this.call('notification', 'close', this.connectionNotificationID); this.displayNotification({ type: 'info', - title: _t('Connection restored'), - message: _t('You are back online'), + message: _t('Connection restored. You are back online.'), sticky: false }); this.connectionNotificationID = false; diff --git a/addons/web/static/src/js/core/service_mixins.js b/addons/web/static/src/js/core/service_mixins.js index d03d90456d0..f191dba5c08 100644 --- a/addons/web/static/src/js/core/service_mixins.js +++ b/addons/web/static/src/js/core/service_mixins.js @@ -250,7 +250,7 @@ var ServicesMixin = { * @deprecated will be removed as soon as the notification system is reviewed * @see displayNotification */ - do_notify: function (title, message, sticky, className) { + do_notify: function (title = false, message, sticky, className) { return this.displayNotification({ type: 'warning', title: title, @@ -263,7 +263,7 @@ var ServicesMixin = { * @deprecated will be removed as soon as the notification system is reviewed * @see displayNotification */ - do_warn: function (title, message, sticky, className) { + do_warn: function (title = false, message, sticky, className) { console.warn(title, message); return this.displayNotification({ type: 'danger', diff --git a/addons/web/static/src/js/widgets/notification.js b/addons/web/static/src/js/widgets/notification.js index aad896bcd61..0e9cdabe7ca 100644 --- a/addons/web/static/src/js/widgets/notification.js +++ b/addons/web/static/src/js/widgets/notification.js @@ -19,7 +19,7 @@ var Notification = Widget.extend({ 'mouseenter': '_onMouseEnter', 'mouseleave': '_onMouseLeave', }, - _autoCloseDelay: 2500, + _autoCloseDelay: 4000, _animation: true, /** |
