From 1c6434630e7a9d8393d1eb08f3bb4e1fa3a4a398 Mon Sep 17 00:00:00 2001 From: John Livingston Date: Mon, 1 Jul 2024 18:06:26 +0200 Subject: [PATCH] Poll WIP (#231): * poll frontend WIP --- conversejs/custom/plugins/poll/components/poll-view.js | 2 +- conversejs/custom/plugins/poll/templates/poll.js | 5 ++++- languages/en.yml | 2 +- languages/fr.yml | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/conversejs/custom/plugins/poll/components/poll-view.js b/conversejs/custom/plugins/poll/components/poll-view.js index be8aa7ad..fd06d552 100644 --- a/conversejs/custom/plugins/poll/components/poll-view.js +++ b/conversejs/custom/plugins/poll/components/poll-view.js @@ -23,7 +23,7 @@ export default class MUCPollView extends CustomElement { render () { const currentPoll = this.model?.get('current_poll') - return tplPoll(this.model, currentPoll) + return tplPoll(this, currentPoll) } } diff --git a/conversejs/custom/plugins/poll/templates/poll.js b/conversejs/custom/plugins/poll/templates/poll.js index 8ff1d863..becc5876 100644 --- a/conversejs/custom/plugins/poll/templates/poll.js +++ b/conversejs/custom/plugins/poll/templates/poll.js @@ -37,8 +37,11 @@ function _tplChoice (el, currentPoll, choice) { @click=${ev => { ev.preventDefault() if (currentPoll.over) { return } - // TODO + console.info('User has voted for choice: ', choice) + el.model.sendMessage({ + body: '!' + choice.choice + }) }} > ${i18nChoiceN} diff --git a/languages/en.yml b/languages/en.yml index 96e824ba..7b84ca6e 100644 --- a/languages/en.yml +++ b/languages/en.yml @@ -571,5 +571,5 @@ poll_instructions: Complete and submit this form to create a new poll. This will poll_question: Question poll_duration: Poll duration (in minutes) poll_anonymous_results: Anonymous results -poll_choice_n: Choice {{N}} +poll_choice_n: 'Choice {{N}}:' poll_end: 'Poll ends at:' diff --git a/languages/fr.yml b/languages/fr.yml index bfe4a7ea..1c163a62 100644 --- a/languages/fr.yml +++ b/languages/fr.yml @@ -553,4 +553,4 @@ poll_instructions: Complétez et soumettez ce formulaire pour créer un nouveau poll_question: Question poll_duration: Durée du sondage (en minutes) poll_anonymous_results: Résultats anonymes -poll_choice_n: Choix {{N}} +poll_choice_n: 'Choix {{N}} :'