This is an automated email from the git hooks/post-receive script. New commit to branch feature/multi-ui in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 0e6167f5176ad5940df0bc5f970f1ace4170bed3 Author: jcouteau <couteau@codelutin.com> Date: Thu Aug 22 16:12:02 2019 +0200 Fix empty choices bug --- pollen-ui-riot-js/src/main/web/js/PollForm.js | 15 +++++++++------ pollen-ui-riot-js/src/main/web/tag/poll/EditPoll.tag.html | 3 --- 2 files changed, 9 insertions(+), 9 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 3a09260a..94b28277 100644 --- a/pollen-ui-riot-js/src/main/web/js/PollForm.js +++ b/pollen-ui-riot-js/src/main/web/js/PollForm.js @@ -176,7 +176,7 @@ class PollForm { create() { logger.info("form before create"); - logger.info(this.form); + logger.info(this); // if the choice is of type resource, then upload the file and set its id as choice value let fileUploadPromises = []; @@ -231,6 +231,7 @@ class PollForm { addNewQuestion() { let newQuestion = new Question("", "", ""); this.setQuestionDefaultSettings(newQuestion); + this.setQuestionDefaultChoices(newQuestion); this.questionEdited = this.questionEdited + 1; this.model.questions.push(newQuestion); } @@ -276,9 +277,6 @@ class PollForm { } setSettingsDefault() { - this.model.beginChoiceDate = undefined; - this.model.endChoiceDate = undefined; - this.model.beginDate = undefined; this.model.endDate = undefined; this.model.commentVisibility = "EVERYBODY"; @@ -289,9 +287,9 @@ class PollForm { } setQuestionDefaultSettings(question) { + question.beginChoiceDate = undefined; + question.endChoiceDate = undefined; - question.choices = [new Choice("TEXT"), new Choice("TEXT"), new Choice("TEXT")]; - question.choices.forEach((c, index) => {c.choiceOrder = index;}); question.addChoices = false; question.voteCountingType = 1; question.voteCountingConfig = {}; @@ -303,6 +301,11 @@ class PollForm { question.commentVisibility = "EVERYBODY"; } + setQuestionDefaultChoices(question) { + question.choices = [new Choice("TEXT"), new Choice("TEXT"), new Choice("TEXT")]; + question.choices.forEach((c, index) => {c.choiceOrder = index;}); + } + setPollType(type) { if (this.types.indexOf(type) >= 0 && this.model.pollType !== type) { this.model.pollType = type; diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/EditPoll.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/EditPoll.tag.html index d1cf814f..23d602a1 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/EditPoll.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/EditPoll.tag.html @@ -142,9 +142,6 @@ import "./CheckEmails.tag.html"; this.session = session; this.installBundle(this.session, "poll"); this.form = form; - //init multi - - //init steps let pollLoaded = () => { this.loaded = true; -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.