mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
allow closing notifications on click
This commit is contained in:
@@ -721,7 +721,7 @@ const widgetDirective: Directive = {
|
||||
ctx.addLine(`let _${dummyID}_index = c${ctx.parentNode}.length;`);
|
||||
ctx.addLine(`c${ctx.parentNode}.push(_${dummyID});`);
|
||||
ctx.addLine(`let def${defID};`);
|
||||
let templateID = ctx.inLoop ? `(${widgetID} + i)` : String(widgetID);
|
||||
let templateID = ctx.inLoop ? `(-${widgetID} - i)` : String(widgetID);
|
||||
ctx.addLine(
|
||||
`let w${widgetID} = ${templateID} in context.__widget__.cmap ? context.__widget__.children[context.__widget__.cmap[${templateID}]] : false;`
|
||||
);
|
||||
|
||||
@@ -4,7 +4,7 @@ import { INotification } from "../services/notifications";
|
||||
|
||||
const template = `
|
||||
<div class="o_notification">
|
||||
<a t-if="props.sticky" class="fa fa-times o_close" href="#" title="Close" aria-label="Close"/>
|
||||
<a t-if="props.sticky" class="fa fa-times o_close" href="#" title="Close" aria-label="Close" t-on-click="close"/>
|
||||
<div class="o_notification_title">
|
||||
<t t-raw="props.title"/>
|
||||
</div>
|
||||
@@ -17,4 +17,8 @@ const template = `
|
||||
export class Notification extends Widget<Env, INotification> {
|
||||
name = "notification";
|
||||
template = template;
|
||||
|
||||
close() {
|
||||
this.env.notifications.close(this.props!.id);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user