summaryrefslogtreecommitdiff
path: root/addons/web/static/src/xml/notification.xml
diff options
context:
space:
mode:
authorqsm-odoo <qsm@odoo.com>2019-04-18 10:01:40 +0000
committerqsm-odoo <qsm@odoo.com>2019-04-24 13:21:41 +0000
commitb94395b50175925fc7d1bd3655e5facb78a8ba2b (patch)
treea6a3a20555ece8dcff22ffbd9cd27170b839e2ea /addons/web/static/src/xml/notification.xml
parent09c3df17cd940a8d1bda4cc265ef5f24e3aa8ecc (diff)
[IMP] web, *: share and improve notification system
* barcodes, calendar, partner_autocomplete, web_settings_dashboard Make the notification system better, using bootstrap toast component, and make it available in the frontend. The toast component allowed to remove some JS code and made the component customizable by themes but it had to be reviewed/fixed to make it functional (maybe bootstrap will review its work in next versions). This work should still be improved because there are still too many ways (deprecated and not deprecated) to instantiate toasts in the backend. The goal here was however to make the toasts more modern and make them available in the frontend. This work is needed for some tasks. @kig-odoo and @fja-odoo made a pre-work to instantiate toasts in the frontend for their respective tasks. This commit unifies the system. Part of https://github.com/odoo/odoo/pull/32793 task-1970731 closes odoo/odoo#32793 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Diffstat (limited to 'addons/web/static/src/xml/notification.xml')
-rw-r--r--addons/web/static/src/xml/notification.xml36
1 files changed, 36 insertions, 0 deletions
diff --git a/addons/web/static/src/xml/notification.xml b/addons/web/static/src/xml/notification.xml
new file mode 100644
index 00000000000..3ffe9e8979a
--- /dev/null
+++ b/addons/web/static/src/xml/notification.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<templates id="template" xml:space="preserve">
+
+<t t-name="Notification">
+ <div t-attf-class="toast o_notification #{widget.className}"
+ role="alert" aria-live="assertive" aria-atomic="true">
+ <div class="toast-header">
+ <span t-attf-class="fa fa-2x mr-3 #{widget.icon} o_notification_icon"
+ role="img" t-attf-aria-label="Notification #{widget.name}"
+ t-attf-title="Notification #{widget.name}"/>
+ <div class="d-flex align-items-center mr-auto font-weight-bold o_notification_title"
+ t-raw="widget.title"/>
+ <button t-if="widget.sticky" type="button"
+ class="mb-1 close o_notification_close"
+ data-dismiss="toast" aria-label="Close">
+ <span class="d-inline" aria-hidden="true">&amp;times;</span>
+ </button>
+ </div>
+ <div t-if="widget.message or widget.buttons.length" class="toast-body">
+ <div t-if="widget.message" t-raw="widget.message"
+ class="o_notification_content"/>
+ <div t-if="widget.buttons.length" class="mt-2 o_notification_buttons">
+ <button t-foreach="widget.buttons" t-as="button" type="button"
+ t-attf-class="btn #{button.primary ? 'btn-primary' : 'btn-secondary'}">
+ <t t-if="button.icon">
+ <i t-if="button.icon.indexOf('fa-') === 0" t-attf-class="fa fa-fw o_button_icon #{button.icon}" role="img" t-att-aria-label="button.name" t-att-title="button.name"/>
+ <img t-else="" t-att-src="button.icon" t-att-alt="button.name"/>
+ </t>
+ <span t-esc="button.text"/>
+ </button>
+ </div>
+ </div>
+ </div>
+</t>
+
+</templates>