branch feature/bug-on-save created (now 4dbf8c44)
This is an automated email from the git hooks/post-receive script. New change to branch feature/bug-on-save in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git at 4dbf8c44 refs #248 wip modification des choix This branch includes the following new commits: new 4dbf8c44 refs #248 wip modification des choix The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 4dbf8c44a48896a24968110baef70dac1b40b99c Author: dcosse <cosse@codelutin.com> Date: Fri Oct 4 17:49:03 2019 +0200 refs #248 wip modification des choix -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/bug-on-save in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 4dbf8c44a48896a24968110baef70dac1b40b99c Author: dcosse <cosse@codelutin.com> Date: Fri Oct 4 17:49:03 2019 +0200 refs #248 wip modification des choix --- pollen-ui-riot-js/src/main/web/tag/poll/Choice.tag.html | 1 + pollen-ui-riot-js/src/main/web/tag/poll/Choices.tag.html | 14 ++++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/Choice.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/Choice.tag.html index 9e7a2119..3ec593e5 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/Choice.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/Choice.tag.html @@ -142,6 +142,7 @@ import "../components/time-picker.tag.html"; this.hasNewFile = false; this.valueText = this.opts.choice.choiceType === "TEXT" ? this.opts.choice.choiceValue : null; this.showDescription = this.opts.choice.description && this.opts.choice.description.length; + this.opts.choice.choiceType = this.choiceType || "TEXT"; if (this.opts.choice.choiceType.startsWith("DATE")) { this.date = { 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 88bca7a7..05b6cf8e 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 @@ -45,7 +45,7 @@ class="c-button c-button--ghost-error" show={!parent.form.hasVotes} disabled={parent.form.hasVotes || parent.form.model.closed} - onclick="{parent.removeChoice(index)}"> + onclick="{parent.removeChoice(parent.form.model.questions[0], index)}"> <i class="fa fa-trash" aria-hidden="true"/> </button> </div> @@ -75,7 +75,8 @@ this.installBundle(this.session, "poll_choices", this.opts.emitter); this.on("mount", () => { - let choices = (this.refs.choicesDrag || []) + let choiceDrag = this.refs.choicesDrag && Array.isArray(this.refs.choicesDrag) ? this.refs.choicesDrag : []; + let choices = (choiceDrag) .sort((c1, c2) => Math.sign(c1.choice.choiceOrder - c2.choice.choiceOrder)) .map(c => c.refs.choice); choices[0] && choices[0].focus(); @@ -176,7 +177,8 @@ this.addOneChoice = () => { if (!this.form.hasVotes) { this.submit(); - this.form.addNewChoice(0); + let questionId = this.form.model.questions[0].id; + this.form.addNewChoice(questionId); this.update(); this.placeChoices(true); let choices = this.getChoicesDragTab() @@ -186,9 +188,9 @@ } }; - this.removeChoice = index => () => { - if (!this.form.hasVotes) { - this.form.removeChoice(0, index); + this.removeChoice = (question, index) => () => { + if (typeof index === "number") { + this.form.removeChoice(question.id, index); this.compatChoiceOrders(); this.update(); this.placeChoices(true); -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm