2022-08-21 13:03:32 +02:00
|
|
|
import BaseModal from "plugins/modal/modal.js";
|
2020-12-01 18:50:35 +01:00
|
|
|
import tpl_alert_modal from "./templates/alert.js";
|
2022-08-21 13:03:32 +02:00
|
|
|
import { api } from "@converse/headless/core";
|
2020-12-01 18:50:35 +01:00
|
|
|
|
|
|
|
|
2022-08-21 13:03:32 +02:00
|
|
|
export default class Alert extends BaseModal {
|
2020-12-01 18:50:35 +01:00
|
|
|
|
|
|
|
initialize () {
|
2022-08-21 13:03:32 +02:00
|
|
|
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());
|
|
|
|
}
|
2020-12-01 18:50:35 +01:00
|
|
|
|
2022-08-21 13:03:32 +02:00
|
|
|
getModalTitle () {
|
|
|
|
return this.model.get('title');
|
2020-12-01 18:50:35 +01:00
|
|
|
}
|
2022-08-21 13:03:32 +02:00
|
|
|
}
|
2020-12-01 18:50:35 +01:00
|
|
|
|
2022-08-21 13:03:32 +02:00
|
|
|
api.elements.define('converse-alert-modal', Alert);
|