allow closing notifications on click

This commit is contained in:
Géry Debongnie
2019-01-29 20:42:05 +01:00
parent 0bbeabd55c
commit 0b3dc0301e
4 changed files with 80 additions and 33 deletions
+1 -1
View File
@@ -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;`
);
+5 -1
View File
@@ -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);
}
}