Commit 5836e9d8 authored by JC Brand's avatar JC Brand

Formatting

parent d426d797
......@@ -135,36 +135,28 @@
renderBookmarkForm () {
const { _converse } = this.__super__,
{ __ } = _converse,
body = this.el.querySelector('.chatroom-body');
{ __ } = _converse,
body = this.el.querySelector('.chatroom-body');
_.each(body.children, function (child) {
child.classList.add('hidden');
});
// Remove any existing forms
_.each(body.children, child => child.classList.add('hidden'));
_.each(body.querySelectorAll('.chatroom-form-container'), u.removeElement);
body.insertAdjacentHTML(
'beforeend',
tpl_chatroom_bookmark_form({
heading: __('Bookmark this groupchat'),
label_name: __('The name for this bookmark:'),
label_autojoin: __('Would you like this groupchat to be automatically joined upon startup?'),
label_nick: __('What should your nickname for this groupchat be?'),
default_nick: this.model.get('nick'),
label_submit: __('Save'),
label_cancel: __('Cancel')
'default_nick': this.model.get('nick'),
'heading': __('Bookmark this groupchat'),
'label_autojoin': __('Would you like this groupchat to be automatically joined upon startup?'),
'label_cancel': __('Cancel'),
'label_name': __('The name for this bookmark:'),
'label_nick': __('What should your nickname for this groupchat be?'),
'label_submit': __('Save'),
'name': this.model.get('name')
})
);
const form = body.querySelector('form.chatroom-form');
form.addEventListener(
'submit',
this.onBookmarkFormSubmitted.bind(this)
);
form.querySelector('.button-cancel').addEventListener(
'click',
this.closeForm.bind(this)
);
form.addEventListener('submit', ev => this.onBookmarkFormSubmitted(ev));
form.querySelector('.button-cancel').addEventListener('click', () => this.closeForm());
},
onBookmarkFormSubmitted (ev) {
......
......@@ -343,10 +343,7 @@
},
roomStanzaItemToHTMLElement (groupchat) {
const name = Strophe.unescapeNode(
groupchat.getAttribute('name') ||
groupchat.getAttribute('jid')
);
const name = Strophe.unescapeNode(groupchat.getAttribute('name') || groupchat.getAttribute('jid'));
const div = document.createElement('div');
div.innerHTML = tpl_room_item({
'name': Strophe.xmlunescape(name),
......@@ -1309,14 +1306,14 @@
container_el.insertAdjacentHTML('beforeend',
tpl_chatroom_password_form({
heading: __('This groupchat requires a password'),
label_password: __('Password: '),
label_submit: __('Submit')
'heading': __('This groupchat requires a password'),
'label_password': __('Password: '),
'label_submit': __('Submit')
}));
this.model.save('connection_status', converse.ROOMSTATUS.PASSWORD_REQUIRED);
this.el.querySelector('.chatroom-form').addEventListener(
'submit', this.submitPassword.bind(this), false);
this.el.querySelector('.chatroom-form')
.addEventListener('submit', ev => this.submitPassword(ev), false);
},
showDisconnectMessages (msgs) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment