This is an automated email from the git hooks/post-receive script. New commit to branch feature/april in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit d0f398aba0a1745a99abb5be3dc905d8c5f34ebb Author: jcouteau <couteau@codelutin.com> Date: Tue Jan 8 10:53:31 2019 +0100 Can add and delete choices in UI. Poll can be saved --- pollen-ui-riot-js/src/main/web/js/PollForm.js | 4 ++-- pollen-ui-riot-js/src/main/web/js/PollService.js | 18 ++++++++++++++---- .../src/main/web/tag/poll/Choices.tag.html | 4 ++-- .../src/main/web/tag/poll/Settings.tag.html | 4 ++-- 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/pollen-ui-riot-js/src/main/web/js/PollForm.js b/pollen-ui-riot-js/src/main/web/js/PollForm.js index f13c29b9..a64b24c7 100644 --- a/pollen-ui-riot-js/src/main/web/js/PollForm.js +++ b/pollen-ui-riot-js/src/main/web/js/PollForm.js @@ -207,7 +207,7 @@ class PollForm { addNewChoice(questionId) { this.model.questions.forEach((question) => { - if (question.id === questionId) { + if (question.id === questionId || question.id === null) { let choice; if (question.choices.length > 0) { let lastChoice = question.choices[question.choices.length - 1]; @@ -227,7 +227,7 @@ class PollForm { removeChoice(questionId, index) { this.model.questions.forEach((question) => { - if (question.id === questionId) { + if (question.id === questionId || question.id === null) { question.choices.splice(index, 1); } }); diff --git a/pollen-ui-riot-js/src/main/web/js/PollService.js b/pollen-ui-riot-js/src/main/web/js/PollService.js index 984a5202..c644cc8b 100644 --- a/pollen-ui-riot-js/src/main/web/js/PollService.js +++ b/pollen-ui-riot-js/src/main/web/js/PollService.js @@ -43,8 +43,13 @@ class PollService extends FetchService { let poll2 = Object.assign({}, poll); delete poll2.participant; delete poll2.votePeriod; - delete poll2.addChoices; - delete poll2.anonymousVote; + delete poll2.questions[0].addChoices; + delete poll2.questions[0].voteVisibility; + delete poll2.questions[0].anonymousVote; + delete poll2.questions[0].resultVisibility; + delete poll2.questions[0].continuousResults; + delete poll2.questions[0].commentVisibility; + delete poll2.voteCountingType; delete poll2.alreadyParticipants; delete poll2.limitChoices; let url = this._getUrlPrefix(); @@ -55,8 +60,13 @@ class PollService extends FetchService { let poll2 = Object.assign({}, poll); delete poll2.participant; delete poll2.votePeriod; - delete poll2.addChoices; - delete poll2.anonymousVote; + delete poll2.questions[0].addChoices; + delete poll2.questions[0].voteVisibility; + delete poll2.questions[0].anonymousVote; + delete poll2.questions[0].resultVisibility; + delete poll2.questions[0].continuousResults; + delete poll2.questions[0].commentVisibility; + delete poll2.voteCountingType; delete poll2.alreadyParticipants; delete poll2.limitChoices; let url = this._getUrlPrefix(poll.id); diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/Choices.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/Choices.tag.html index 0b5e2f03..642291b4 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/Choices.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/Choices.tag.html @@ -176,7 +176,7 @@ this.addOneChoice = () => { if (!this.form.hasVotes) { this.submit(); - this.form.addNewChoice(); + this.form.addNewChoice(0); this.update(); this.placeChoices(true); let choices = this.getChoicesDragTab() @@ -188,7 +188,7 @@ this.removeChoice = index => () => { if (!this.form.hasVotes) { - this.form.removeChoice(index); + this.form.removeChoice(0, index); this.compatChoiceOrders(); this.update(); this.placeChoices(true); diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/Settings.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/Settings.tag.html index eace7e03..c8593bc2 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/Settings.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/Settings.tag.html @@ -194,12 +194,12 @@ import "../voteCountingType/MajorityJudgmentConfig.tag.html"; <MaxChoicesNumberConfig if={form.model.voteCountingType == 1 || form.model.voteCountingType == 4} ref="config" config={form.model.voteCountingConfig} - count-choices={form.choices.length} + count-choices={form.questions[0].choices.length} disabled={form.hasVotes || form.model.closed}/> <BordaConfig if={form.model.voteCountingType == 5} ref="config" config={form.model.voteCountingConfig} - count-choices={form.choices.length} + count-choices={form.questions[0].choices.length} disabled={form.hasVotes || form.model.closed}/> <CumulativeConfig if={form.model.voteCountingType == 2} ref="config" -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.