003cb24dd8
* bootstrap 5 compatibility * other Converse updates integration * hack to get the sidebar work as with Converse v10. * modal onHide was renamed close. * fix slow mode infobox margin. * fix margin * shorter action label, for better dropdown UX.
41 lines
1.3 KiB
JavaScript
41 lines
1.3 KiB
JavaScript
// SPDX-FileCopyrightText: 2024 John Livingston <https://www.john-livingston.fr/>
|
|
//
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
import { html } from 'lit'
|
|
import { repeat } from 'lit/directives/repeat.js'
|
|
import { __ } from 'i18n'
|
|
|
|
export default function (el) {
|
|
const muc = el.muc
|
|
if (!muc?.tasklists?.length) {
|
|
// eslint-disable-next-line no-undef
|
|
const i18nEmpty = __(LOC_task_list_pick_empty)
|
|
return html`<p class="error">${i18nEmpty}</p>`
|
|
}
|
|
|
|
// eslint-disable-next-line no-undef
|
|
const i18nMessage = __(LOC_task_list_pick_message)
|
|
|
|
return html`
|
|
<form class="converse-form converse-form--modal confirm" action="#" @submit=${ev => el.onPick(ev)}>
|
|
<fieldset>
|
|
<select class="form-control" name="tasklist">
|
|
${
|
|
repeat(muc.tasklists, (tasklist) => tasklist.get('id'), (tasklist) => {
|
|
return html`<option value="${tasklist.get('id')}">${tasklist.get('name')}</option>`
|
|
})
|
|
}
|
|
</select>
|
|
<small class="form-text text-muted">
|
|
${i18nMessage}
|
|
</small>
|
|
</fieldset>
|
|
|
|
<fieldset>
|
|
<button type="submit" class="btn btn-primary">${__('OK')}</button>
|
|
<input type="button" class="btn btn-secondary" data-dismiss="modal" value="${__('Cancel')}"/>
|
|
</fieldset>
|
|
</form>`
|
|
}
|