xmpp.chapril.org-conversejs/src/plugins/modal/templates/prompt.js
JC Brand 15c10376b0 Rename all templates to camelCase
To conform with naming conventions regarding functions, which the
templates are.
2023-02-15 14:29:07 +01:00

31 lines
1.1 KiB
JavaScript

import { html } from "lit";
import { __ } from 'i18n';
const tplField = (f) => html`
<div class="form-group">
<label>
${f.label || ''}
<input type="text"
name="${f.name}"
class="${(f.challenge_failed) ? 'error' : ''} form-control form-control--labeled"
?required="${f.required}"
placeholder="${f.placeholder}" />
</label>
</div>
`;
export default (el) => {
return html`
<form class="converse-form converse-form--modal confirm" action="#" @submit=${ev => el.onConfimation(ev)}>
<div class="form-group">
${ el.model.get('messages')?.map(message => html`<p>${message}</p>`) }
</div>
${ el.model.get('fields')?.map(f => tplField(f)) }
<div class="form-group">
<button type="submit" class="btn btn-primary">${__('OK')}</button>
<input type="button" class="btn btn-secondary" data-dismiss="modal" value="${__('Cancel')}"/>
</div>
</form>`;
}