Poll WIP (#231):

* backend form declaration
* frontend form dialog
This commit is contained in:
John Livingston
2024-06-28 18:38:59 +02:00
parent b792588364
commit 14e0576329
7 changed files with 245 additions and 14 deletions

View File

@ -3,18 +3,8 @@
// SPDX-License-Identifier: AGPL-3.0-only
import { XMLNS_POLL } from './constants.js'
import { converse, _converse, api } from '../../../src/headless/core.js'
import { _converse, api } from '../../../src/headless/core.js'
import { __ } from 'i18n'
const $iq = converse.env.$iq
function _fetchPollForm (mucModel) {
return api.sendIQ(
$iq({
to: mucModel.get('jid'),
type: 'get'
}).c('query', { xmlns: XMLNS_POLL })
)
}
export function getHeadingButtons (view, buttons) {
const muc = view.model
@ -39,9 +29,7 @@ export function getHeadingButtons (view, buttons) {
i18n_text: __(LOC_new_poll),
handler: async (ev) => {
ev.preventDefault()
const r = await _fetchPollForm(muc)
// FIXME
console.info('Received poll form', r)
api.modal.show('livechat-converse-poll-form-modal', { model: muc })
},
a_class: '',
icon_class: 'fa-list-check', // FIXME