[IMP] web: convert notification popup in service and add buttons params
this.call('web.Notification', 'notify', params)
Display a notification at the appropriate location, and returns the
reference id to the same widget. Note that this method does not wait
for the appendTo method to complete.
@param {Object} params
@param {string} params.title notification title
@param {string} params.message notification main message
@param {string} params.type 'notification' or 'warning'
@param {boolean} [params.sticky=false] if true, the notification will stay
visible until the user clicks on it.
@param {string} [params.className] className to add on the dom
@param {function} [params.onClose] callback when the user click on the x
or when the notification is auto close (no sticky)
@param {Array<Object>} params.buttons
@param {function} params.buttons[0].click callback on click
@param {Boolean} [params.buttons[0].primary] display the button as primary
@param {string} [params.buttons[0].text] button label
@param {string} [params.buttons[0].icon] font-awsome className or image src
@returns {Number} notification id
this.call('web.Notification', 'close', notificationId)
This commit is contained in:
committed by
Géry Debongnie
parent
67a7d1f2b5
commit
07cd24b1ec
@@ -115,20 +115,24 @@
|
||||
</t>
|
||||
|
||||
<t t-name="Notification">
|
||||
<div t-attf-class="o_notification #{className}" t-translation="off">
|
||||
<div t-attf-class="o_notification #{widget.className}" t-translation="off">
|
||||
<a t-if="widget.sticky" class="fa fa-times o_close" href="#"/>
|
||||
<div class="o_notification_title">
|
||||
<span class="o_icon fa fa-3x fa-lightbulb-o"/>
|
||||
<span t-attf-class="o_icon fa fa-3x #{widget.icon}"/>
|
||||
<t t-raw="widget.title"/>
|
||||
</div>
|
||||
<div class="o_notification_content" t-if="widget.text"><t t-raw="widget.text"/></div>
|
||||
<div class="o_notification_content" t-if="widget.message"><t t-raw="widget.message"/></div>
|
||||
<div t-if="widget.buttons.length" class="o_buttons">
|
||||
<button t-foreach="widget.buttons" t-as="button" t-attf-class="btn btn-sm #{button.primary ? 'btn-primary' : 'btn-default'}" type="button">
|
||||
<t t-if="button.icon">
|
||||
<i t-if="button.icon.indexOf('fa-') === 0" t-attf-class="fa fa-fw o_button_icon #{button.icon}"/>
|
||||
<img t-else="" t-att-src="button.icon"/>
|
||||
</t>
|
||||
<span><t t-esc="button.text"/></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
<t t-name="Warning" t-extend="Notification">
|
||||
<t t-jquery=".o_icon" t-operation="replace">
|
||||
<span class="o_icon fa fa-3x fa-exclamation"/>
|
||||
</t>
|
||||
</t>
|
||||
|
||||
<div t-name="CrashManager.warning" class="o_dialog_warning">
|
||||
<t t-js="d">
|
||||
|
||||
Reference in New Issue
Block a user