Commit f8279790 authored by JC Brand's avatar JC Brand

converse-register: render the buttons as part of the template

instead of manually
parent 33cc7282
......@@ -500,34 +500,23 @@
'__': _converse.__,
'domain': this.domain,
'title': this.title,
'instructions': this.instructions
'instructions': this.instructions,
'registration_domain': _converse.registration_domain
});
const buttons = form.querySelector('fieldset.buttons');
if (this.form_type === 'xform') {
_.each(stanza.querySelectorAll('field'), (field) => {
form.insertAdjacentHTML(
'beforeend',
buttons.insertAdjacentHTML(
'beforebegin',
utils.xForm2webForm(field, stanza, this.domain)
);
});
} else {
this.renderLegacyRegistrationForm(form);
}
if (this.fields) {
form.insertAdjacentHTML(
'beforeend',
`<input type="submit" class="pure-button button-primary" value="${__('Register')}"/>`
);
if (!_converse.registration_domain) {
form.insertAdjacentHTML(
'beforeend',
`<input type="button" class="pure-button button-cancel" value="${__('Choose a different provider')}"/>`
);
}
} else {
form.insertAdjacentHTML(
'beforeend',
`<input type="button" class="pure-button button-cancel" value="${__('Return')}"/>`
);
if (!this.fields) {
form.querySelector('.button-primary').classList.add('hidden');
}
this.model.set('registration_form_rendered', true);
this.showRegistrationForm();
......
......@@ -2,3 +2,10 @@
<p class="title">{{{title}}}</p>
<p class="instructions">{{{instructions}}}</p>
<div class="form-errors hidden"></div>
<fieldset class="buttons">
<input type="submit" class="pure-button button-primary" value="{{{__('Register')}}}"/>
{[ if (!registration_domain) { ]}
<input type="button" class="pure-button button-cancel" value="{{{__('Choose a different provider')}}}"/>
{[ } ]}
</fieldset>
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