summaryrefslogtreecommitdiff
path: root/web_notify/static/src/js/widgets/notification.js
blob: 0c468ffb8db9e322083b872a042070494153a731 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
odoo.define("web_notify.Notification", function (require) {
    "use strict";

    var Notification = require("web.Notification");

    Notification.include({
        icon_mapping: {
            success: "fa-thumbs-up",
            danger: "fa-exclamation-triangle",
            warning: "fa-exclamation",
            info: "fa-info",
            default: "fa-lightbulb-o",
        },
        init: function () {
            this._super.apply(this, arguments);
            // Delete default classes
            this.className = this.className.replace(" o_error", "");
            // Add custom icon and custom class
            this.icon =
                this.type in this.icon_mapping
                    ? this.icon_mapping[this.type]
                    : this.icon_mapping.default;
            this.className += " o_" + this.type;
        },
    });
});