xmpp.chapril.org-conversejs/src/plugins/modal/alert.js
JC Brand fbe86e5af8 Create an ElementView base modal and use it for all modals
Modals are now all web components and are opened by component name.
2022-09-16 10:33:47 +02:00

24 lines
598 B
JavaScript

import BaseModal from "plugins/modal/modal.js";
import tpl_alert_modal from "./templates/alert.js";
import { api } from "@converse/headless/core";
export default class Alert extends BaseModal {
initialize () {
super.initialize();
this.listenTo(this.model, 'change', () => this.render())
this.addEventListener('hide.bs.modal', () => this.remove(), false);
}
renderModal () {
return tpl_alert_modal(this.model.toJSON());
}
getModalTitle () {
return this.model.get('title');
}
}
api.elements.define('converse-alert-modal', Alert);