From b42ad68c2c2a4cdb9ce214e7a0f2072d85e7550b Mon Sep 17 00:00:00 2001 From: Benjamin Vray Date: Wed, 12 Aug 2020 11:11:32 +0000 Subject: [PATCH] [IMP] web: redesign toast Remove the icon of the toast elements. Remove the header and move the title in the body, as simple text. Move buttons at the bottom instead of at the right side. Note: this will be refactored with OWL anyway but this is a first step towards more consistent tips across backend and frontend. task-2311554 closes odoo/odoo#61756 Signed-off-by: Quentin Smetz (qsm) --- .../web/static/src/js/widgets/notification.js | 8 -------- addons/web/static/src/scss/notification.scss | 2 +- addons/web/static/src/xml/notification.xml | 19 +++++-------------- .../services/notification_service_tests.js | 8 ++++---- 4 files changed, 10 insertions(+), 27 deletions(-) diff --git a/addons/web/static/src/js/widgets/notification.js b/addons/web/static/src/js/widgets/notification.js index 0e9cdabe7ca..59044a19198 100644 --- a/addons/web/static/src/js/widgets/notification.js +++ b/addons/web/static/src/js/widgets/notification.js @@ -53,22 +53,14 @@ var Notification = Widget.extend({ this._closeCallback = params.onClose; if (this.type === 'danger') { - this.icon = 'fa-exclamation'; this.className += ' bg-danger'; } else if (this.type === 'warning') { - this.icon = 'fa-lightbulb-o'; this.className += ' bg-warning'; } else if (this.type === 'success') { - this.icon = 'fa-check'; this.className += ' bg-success'; } else if (this.type === 'info') { - this.icon = 'fa-info'; this.className += ' bg-info'; } - - if (this.buttons && this.buttons.length) { - this.icon = 'fa-question-circle-o'; - } }, /** * @override diff --git a/addons/web/static/src/scss/notification.scss b/addons/web/static/src/scss/notification.scss index 561f7ab0552..83007fb653b 100644 --- a/addons/web/static/src/scss/notification.scss +++ b/addons/web/static/src/scss/notification.scss @@ -14,7 +14,7 @@ width: 100%; .toast-body { - padding: 8px 10px; + padding: 0.75rem; .o_notification_close { height: 20px; diff --git a/addons/web/static/src/xml/notification.xml b/addons/web/static/src/xml/notification.xml index e23538d1e28..761c02f0eb1 100644 --- a/addons/web/static/src/xml/notification.xml +++ b/addons/web/static/src/xml/notification.xml @@ -4,30 +4,21 @@
- +
- -
- -
- -
-
- + class="o_notification_subtitle mb-2 font-weight-normal text-muted"/>
+ class="o_notification_content"/>
b
", + "
a
b
", "should display notification"); assert.containsOnce($notification, '.o_notification_close'); await waitCloseNotification(); @@ -80,7 +80,7 @@ QUnit.module('Services', { await testUtils.nextMicrotaskTick(); var $notification = $('body .o_notification_manager .o_notification'); assert.strictEqual($notification.html().trim().replace(/\s+/g, ' '), - "
a
b
", + "
a
b
", "should display notification"); view.destroy(); }); @@ -117,7 +117,7 @@ QUnit.module('Services', { await testUtils.nextTick(); const $notification = $('body .o_notification_manager .o_notification'); assert.containsNone($notification, '.toast-header .o_notification_title'); - assert.containsNone($notification, '.o_notification_icon'); + assert.containsOnce($notification, '.o_notification_content'); assert.containsOnce($notification, '.toast-body .o_notification_close'); view.destroy(); @@ -206,7 +206,7 @@ QUnit.module('Services', { assert.containsOnce($notification.eq(0), '.o_notification_close', "should display the close button in notification"); assert.strictEqual($notification.html().trim().replace(/\s+/g, ' '), - "
a0
b0
", + "
a0
b0
", "should display notification"); testUtils.dom.click($notification.find('.o_notification_buttons button:contains(accept0)'));