|
@@ -2,13 +2,16 @@ import BaseModal from "plugins/modal/modal.js";
|
|
|
import tplOccupantModal from "./templates/occupant.js";
|
|
|
import { Model } from '@converse/skeletor/src/model.js';
|
|
|
import { __ } from 'i18n';
|
|
|
-import { _converse, api } from "@converse/headless/core";
|
|
|
+import { _converse, api, converse } from "@converse/headless/core";
|
|
|
+
|
|
|
+const { u } = converse.env;
|
|
|
|
|
|
export default class OccupantModal extends BaseModal {
|
|
|
|
|
|
constructor () {
|
|
|
super();
|
|
|
this.addEventListener("affiliationChanged", () => this.alert(__('Affiliation changed')));
|
|
|
+ this.addEventListener("roleChanged", () => this.alert(__('role changed')));
|
|
|
}
|
|
|
|
|
|
initialize () {
|
|
@@ -48,8 +51,15 @@ export default class OccupantModal extends BaseModal {
|
|
|
if (jid) api.modal.show('converse-add-contact-modal', {'model': new Model({ jid })});
|
|
|
}
|
|
|
|
|
|
- toggleForm () {
|
|
|
- this.show_affiliation_form = !this.show_affiliation_form;
|
|
|
+ toggleForm (ev) {
|
|
|
+ const toggle = u.ancestor(ev.target, '.toggle-form');
|
|
|
+ const form = toggle.getAttribute('data-form');
|
|
|
+
|
|
|
+ if (form === 'row-form') {
|
|
|
+ this.show_role_form = !this.show_role_form;
|
|
|
+ } else {
|
|
|
+ this.show_affiliation_form = !this.show_affiliation_form;
|
|
|
+ }
|
|
|
this.render();
|
|
|
}
|
|
|
}
|