branch feature/multi-ui updated (a5700ffd -> a38150bb)
This is an automated email from the git hooks/post-receive script. New change to branch feature/multi-ui in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git from a5700ffd Use toggle instead of classic checkbox new 7c11d381 Deal with config init on max choice number new 79e9af31 Fix MaxChoicesNumberConfig save bug new bea6b5ac Display question x / n when voting new 14a84bf2 Question title and question changing buttons centered new 962ea514 Choices are now displayed in order vote new 8e13df84 Question number and title on 2 different lines new 7c630d8a Proper previous/next buttons when voting new 07850a16 Same order on mono and multi questions new 16b23161 Split workflows new 962c8305 Nice question editing workflow new f8849fd9 Keep its name from one question to another new a09e252e Keep ones name on VoteOrder too new 27c3f23f Prevent console logs new a38150bb Vote goes to next question The 14 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 a38150bb44aa2606516cdc3eb657a4c89caaccb6 Author: jcouteau <couteau@codelutin.com> Date: Thu Oct 10 17:16:18 2019 +0200 Vote goes to next question commit 27c3f23fc30cf59b159dc2961e57b079c7dbfdce Author: jcouteau <couteau@codelutin.com> Date: Thu Oct 10 16:09:17 2019 +0200 Prevent console logs commit a09e252e8178bce0f36037acc5aaca228e7a1703 Author: jcouteau <couteau@codelutin.com> Date: Thu Oct 10 16:07:13 2019 +0200 Keep ones name on VoteOrder too commit f8849fd9da3008eaba68b8c105a4ecdd5e6f31d4 Author: jcouteau <couteau@codelutin.com> Date: Thu Oct 10 16:03:37 2019 +0200 Keep its name from one question to another commit 962c830556167d70e872cc17e7b859e04b7abac2 Author: jcouteau <couteau@codelutin.com> Date: Thu Oct 10 15:13:15 2019 +0200 Nice question editing workflow commit 16b231613f26c11fab5f9d219da432c7c9ba037a Author: jcouteau <couteau@codelutin.com> Date: Wed Oct 9 16:46:23 2019 +0200 Split workflows commit 07850a16055ba133d2c90e3a47d3028e0fd9888b Author: jcouteau <couteau@codelutin.com> Date: Wed Oct 9 16:42:09 2019 +0200 Same order on mono and multi questions commit 7c630d8a3d013e347c1d50e0097d97566997d03c Author: jcouteau <couteau@codelutin.com> Date: Wed Oct 9 16:34:47 2019 +0200 Proper previous/next buttons when voting commit 8e13df844a4ae94ca12ad34df6f5f09fed1f394a Author: jcouteau <couteau@codelutin.com> Date: Wed Oct 9 16:29:54 2019 +0200 Question number and title on 2 different lines commit 962ea5143a69b9f20329d0c9a52dd7f4669b7ec9 Author: jcouteau <couteau@codelutin.com> Date: Wed Oct 9 15:31:09 2019 +0200 Choices are now displayed in order vote commit 14a84bf204a3b42b118242512fb0583183bd6193 Author: jcouteau <couteau@codelutin.com> Date: Wed Oct 9 14:45:28 2019 +0200 Question title and question changing buttons centered commit bea6b5acc8f5af6d18bc29e2d49381abdc82bf4e Author: jcouteau <couteau@codelutin.com> Date: Wed Oct 9 14:42:12 2019 +0200 Display question x / n when voting commit 79e9af31002850f5713776a2762958c55d13c3ef Author: jcouteau <couteau@codelutin.com> Date: Wed Oct 9 14:32:14 2019 +0200 Fix MaxChoicesNumberConfig save bug commit 7c11d3812c941692da4871b868ad1f9e7243d177 Author: jcouteau <couteau@codelutin.com> Date: Wed Oct 9 10:52:38 2019 +0200 Deal with config init on max choice number Summary of changes: pollen-ui-riot-js/src/main/web/js/Poll.js | 4 ++ pollen-ui-riot-js/src/main/web/js/PollForm.js | 13 ++-- .../src/main/web/tag/poll/EditPoll.tag.html | 76 +++++++++++++++------- .../src/main/web/tag/poll/EditQuestions.tag.html | 42 ++++++++---- .../web/tag/poll/EditQuestionsSettings.tag.html | 1 + .../src/main/web/tag/poll/EditVote.tag.html | 55 +++++----------- .../src/main/web/tag/poll/EditVoteOrder.tag.html | 29 +++++---- .../src/main/web/tag/poll/Vote.tag.html | 9 ++- .../src/main/web/tag/poll/Votes.tag.html | 32 ++++++--- .../MaxChoicesNumberConfig.tag.html | 21 ++++-- 10 files changed, 168 insertions(+), 114 deletions(-) -- 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/multi-ui in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 7c11d3812c941692da4871b868ad1f9e7243d177 Author: jcouteau <couteau@codelutin.com> Date: Wed Oct 9 10:52:38 2019 +0200 Deal with config init on max choice number --- .../src/main/web/tag/voteCountingType/MaxChoicesNumberConfig.tag.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pollen-ui-riot-js/src/main/web/tag/voteCountingType/MaxChoicesNumberConfig.tag.html b/pollen-ui-riot-js/src/main/web/tag/voteCountingType/MaxChoicesNumberConfig.tag.html index dd77eafd..debf6256 100644 --- a/pollen-ui-riot-js/src/main/web/tag/voteCountingType/MaxChoicesNumberConfig.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/voteCountingType/MaxChoicesNumberConfig.tag.html @@ -51,7 +51,7 @@ this.installBundle(session, "poll_settings_voteCountingConfig"); this.toggleLimitChoices = () => { - if (this.opts.config.maxChoiceNumber === 0) { + if (this.opts.config.maxChoiceNumber === 0 || typeof this.opts.config.maxChoiceNumber === "undefined") { this.opts.config.maxChoiceNumber = this.opts.countChoices; } else { this.opts.config.maxChoiceNumber = 0; -- 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/multi-ui in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 79e9af31002850f5713776a2762958c55d13c3ef Author: jcouteau <couteau@codelutin.com> Date: Wed Oct 9 14:32:14 2019 +0200 Fix MaxChoicesNumberConfig save bug --- .../web/tag/poll/EditQuestionsSettings.tag.html | 1 + .../MaxChoicesNumberConfig.tag.html | 21 ++++++++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/EditQuestionsSettings.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/EditQuestionsSettings.tag.html index e82f78f0..eac19b01 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/EditQuestionsSettings.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/EditQuestionsSettings.tag.html @@ -177,6 +177,7 @@ import "../voteCountingType/MajorityJudgmentConfig.tag.html"; this.listen("questionEditedChanged", () => { this.question = this.form.model.questions[this.form.questionEdited]; this.updateQuestionType(); + this.update(); }); this.toggleVoteCountingTypeHelp = () => { diff --git a/pollen-ui-riot-js/src/main/web/tag/voteCountingType/MaxChoicesNumberConfig.tag.html b/pollen-ui-riot-js/src/main/web/tag/voteCountingType/MaxChoicesNumberConfig.tag.html index debf6256..78581f86 100644 --- a/pollen-ui-riot-js/src/main/web/tag/voteCountingType/MaxChoicesNumberConfig.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/voteCountingType/MaxChoicesNumberConfig.tag.html @@ -26,10 +26,10 @@ id="limitChoices" ref="limitChoices" disabled={opts.disabled} - checkboxchecked={opts.config.maxChoiceNumber > 0} + checkboxchecked={config.maxChoiceNumber > 0} ontogglecheckbox={toggleLimitChoices}/> </div> - <div show={opts.config.maxChoiceNumber > 0} class="o-form-element"> + <div show={config.maxChoiceNumber > 0} class="o-form-element"> <label class="c-label" for="maxChoiceNumber"> {_t.maxChoiceNumber} </label> @@ -39,7 +39,7 @@ ref="maxChoiceNumber" class="c-field c-field--label" disabled={opts.disabled} - value={Math.max(1, opts.config.maxChoiceNumber)} + value={Math.max(1, config.maxChoiceNumber)} min="1" max="{opts.countChoices}" type="number" onchange={maxChoiceNumberChange}> @@ -50,11 +50,13 @@ this.installBundle(session, "poll_settings_voteCountingConfig"); + this.config = this.opts.config; + this.toggleLimitChoices = () => { - if (this.opts.config.maxChoiceNumber === 0 || typeof this.opts.config.maxChoiceNumber === "undefined") { - this.opts.config.maxChoiceNumber = this.opts.countChoices; + if (this.config.maxChoiceNumber === 0 || typeof this.config.maxChoiceNumber === "undefined") { + this.config.maxChoiceNumber = this.opts.countChoices; } else { - this.opts.config.maxChoiceNumber = 0; + this.config.maxChoiceNumber = 0; } if (this.opts.onchange) { this.opts.onchange(); @@ -63,7 +65,7 @@ }; this.maxChoiceNumberChange = () => { - this.opts.config.maxChoiceNumber = this.refs.maxChoiceNumber.valueAsNumber; + this.config.maxChoiceNumber = this.refs.maxChoiceNumber.valueAsNumber; if (this.opts.onchange) { this.opts.onchange(); } @@ -75,6 +77,11 @@ }; }; + this.listen("questionEditedChanged", () => { + //this.config = this.form.model.questions[this.form.questionEdited].voteCountingConfig; + this.update(); + }); + </script> -- 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/multi-ui in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit bea6b5acc8f5af6d18bc29e2d49381abdc82bf4e Author: jcouteau <couteau@codelutin.com> Date: Wed Oct 9 14:42:12 2019 +0200 Display question x / n when voting --- pollen-ui-riot-js/src/main/web/tag/poll/Vote.tag.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/Vote.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/Vote.tag.html index 842db92f..86f6df98 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/Vote.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/Vote.tag.html @@ -21,7 +21,7 @@ <Vote> <div class="container" show="{loaded}"> - <h2>{question.title}</h2> + <h2>Question {parent.questionToVote + 1}/{poll.questions.length} : {question.title}</h2> <span class="c-input-group actions-right" if={isVoteByOrder}> -- 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/multi-ui in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 14a84bf204a3b42b118242512fb0583183bd6193 Author: jcouteau <couteau@codelutin.com> Date: Wed Oct 9 14:45:28 2019 +0200 Question title and question changing buttons centered --- pollen-ui-riot-js/src/main/web/tag/poll/Vote.tag.html | 2 +- pollen-ui-riot-js/src/main/web/tag/poll/Votes.tag.html | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/Vote.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/Vote.tag.html index 86f6df98..a0828bb4 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/Vote.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/Vote.tag.html @@ -21,7 +21,7 @@ <Vote> <div class="container" show="{loaded}"> - <h2>Question {parent.questionToVote + 1}/{poll.questions.length} : {question.title}</h2> + <h2 class="align-center">Question {parent.questionToVote + 1}/{poll.questions.length} : {question.title}</h2> <span class="c-input-group actions-right" if={isVoteByOrder}> diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/Votes.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/Votes.tag.html index 681176e4..bbc8ada8 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/Votes.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/Votes.tag.html @@ -20,6 +20,8 @@ --> <Votes> + <div class="align-center"> + <button if={questionToVote > 0} type="button" class="c-button c-button--info" @@ -37,6 +39,7 @@ {_t.nextQuestion} <i class="fa fa-chevron-right " aria-hidden="true"></i> </button> + </div> <Vote question={question}/> -- 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/multi-ui in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 962ea5143a69b9f20329d0c9a52dd7f4669b7ec9 Author: jcouteau <couteau@codelutin.com> Date: Wed Oct 9 15:31:09 2019 +0200 Choices are now displayed in order vote --- .../src/main/web/tag/poll/EditVoteOrder.tag.html | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/EditVoteOrder.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/EditVoteOrder.tag.html index 6c3e3a5a..fced717d 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/EditVoteOrder.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/EditVoteOrder.tag.html @@ -145,15 +145,8 @@ }); } - this.onPollChange = poll2 => { - //reload question - var _this = this; - poll2.questions.forEach(function(question) { - if (_this.question.id === question.id) { - _this.question = question; - } - }); - this.poll = poll2; + this.onQuestionChange = question2 => { + this.question = question2; this.pollTypeRound = this.question.voteCountingType && (this.question.voteCountingType === 7 || this.question.voteCountingType === 6); this.maxChoiceNumber = this.question.voteCountingConfig.maxChoiceNumber; this.update(); @@ -163,7 +156,7 @@ this.listen("resize", () => this.placeChoices(true)); this.listen("orientationchange", () => this.placeChoices(true)); - //this.listen("poll", this.onPollChange); + this.listen("question", this.onQuestionChange); this.listen("user", (user, oldUser) => { if (user !== oldUser) { if (user && this.refs.voterName && this.refs.voterName.value !== "") { -- 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/multi-ui in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 8e13df844a4ae94ca12ad34df6f5f09fed1f394a Author: jcouteau <couteau@codelutin.com> Date: Wed Oct 9 16:29:54 2019 +0200 Question number and title on 2 different lines --- pollen-ui-riot-js/src/main/web/tag/poll/Vote.tag.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/Vote.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/Vote.tag.html index a0828bb4..70b17408 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/Vote.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/Vote.tag.html @@ -21,7 +21,8 @@ <Vote> <div class="container" show="{loaded}"> - <h2 class="align-center">Question {parent.questionToVote + 1}/{poll.questions.length} : {question.title}</h2> + <h2 class="align-center">Question {parent.questionToVote + 1}/{poll.questions.length} :</h2> + <h2 class="align-center">{question.title}</h2> <span class="c-input-group actions-right" if={isVoteByOrder}> -- 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/multi-ui in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 7c630d8a3d013e347c1d50e0097d97566997d03c Author: jcouteau <couteau@codelutin.com> Date: Wed Oct 9 16:34:47 2019 +0200 Proper previous/next buttons when voting --- pollen-ui-riot-js/src/main/web/tag/poll/Votes.tag.html | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/Votes.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/Votes.tag.html index bbc8ada8..dcb4620a 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/Votes.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/Votes.tag.html @@ -22,20 +22,20 @@ <div class="align-center"> - <button if={questionToVote > 0} - type="button" + <button type="button" class="c-button c-button--info" tabindex="1" - onclick={previousQuestion}> + onclick={previousQuestion} + disabled={questionToVote === 0}> <i class="fa fa-chevron-left " aria-hidden="true"></i> {_t.previousQuestion} </button> - <button if={questionToVote < poll.questions.length - 1} - type="button" + <button type="button" class="c-button c-button--info" tabindex="1" - onclick={nextQuestion}> + onclick={nextQuestion} + disabled={questionToVote === poll.questions.length - 1}> {_t.nextQuestion} <i class="fa fa-chevron-right " aria-hidden="true"></i> </button> -- 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/multi-ui in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 07850a16055ba133d2c90e3a47d3028e0fd9888b Author: jcouteau <couteau@codelutin.com> Date: Wed Oct 9 16:42:09 2019 +0200 Same order on mono and multi questions --- pollen-ui-riot-js/src/main/web/js/PollForm.js | 4 ++-- pollen-ui-riot-js/src/main/web/tag/poll/EditPoll.tag.html | 14 +++++++------- 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 a7d43904..41152b4e 100644 --- a/pollen-ui-riot-js/src/main/web/js/PollForm.js +++ b/pollen-ui-riot-js/src/main/web/js/PollForm.js @@ -39,8 +39,8 @@ class PollForm { ]; this.stepsMulti = [ "general", - "options", - "questions" + "questions", + "options" ]; this.types = ["FREE", "RESTRICTED", "REGISTERED"]; 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 b06cf1ab..abff67b5 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 @@ -64,8 +64,8 @@ import "./CheckEmails.tag.html"; <Choices if={!showSummary && form.step === 1 && !form.multi} form={form} ref="choices"/> <Settings if={!showSummary && form.step === 2 && !form.multi} form={form} ref="settings"/> <VoterList if={!showSummary && form.step === 3 && form.model.pollType === "RESTRICTED"} form={form} ref="voters"/> - <VoteSettings if={!showSummary && form.step === 1 && form.multi} form={form} ref="voteSettings"/> - <EditQuestions if={!showSummary && form.step === 2 && form.multi} form={form} ref="editQuestions"/> + <VoteSettings if={!showSummary && form.step === 2 && form.multi} form={form} ref="voteSettings"/> + <EditQuestions if={!showSummary && form.step === 1 && form.multi} form={form} ref="editQuestions"/> <Summary if={showSummary} form={form}/> <div class="form-footer"> @@ -87,7 +87,7 @@ import "./CheckEmails.tag.html"; {_t.previous} </button> - <button if={form.step === 2 && form.multi && form.questionEdited !== 0} + <button if={form.step === 1 && form.multi && form.questionEdited !== 0} type={form.creation || form.model.closed ? "button" : "submit"} class="c-button c-button--info" tabindex="1" @@ -96,7 +96,7 @@ import "./CheckEmails.tag.html"; {_t.previousQuestion} </button> - <button if={form.step === 2 && form.multi} + <button if={form.step === 1 && form.multi} type="submit" class="c-button c-button--info" tabindex="1" @@ -167,12 +167,12 @@ import "./CheckEmails.tag.html"; e.stopPropagation(); if (this.form.step === 0) { this.refs.description.submit(); - } else if (this.form.step === 1 && this.form.multi) { + } else if (this.form.step === 2 && this.form.multi) { this.refs.voteSettings.submit(); + } else if (this.form.step === 1 && this.form.multi) { + this.refs.editQuestions.submit(); } else if (this.form.step === 1) { this.refs.choices.submit(); - } else if (this.form.step === 2 && this.form.multi) { - this.refs.editQuestions.submit(); } else if (this.form.step === 2) { this.refs.settings.submit(); } else if (this.form.step === 3) { -- 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/multi-ui in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 16b231613f26c11fab5f9d219da432c7c9ba037a Author: jcouteau <couteau@codelutin.com> Date: Wed Oct 9 16:46:23 2019 +0200 Split workflows --- .../src/main/web/tag/poll/EditPoll.tag.html | 40 ++++++++++++---------- 1 file changed, 22 insertions(+), 18 deletions(-) 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 abff67b5..3e743b30 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 @@ -72,6 +72,28 @@ import "./CheckEmails.tag.html"; <GtuValidation if={!form.model.gtuValidated && !showSummary && (!form.creation || form.step === form.getSteps(form.multi).length - 1)} ref="gtuValidation"/> + <div class="actions" if={!showSummary && form.multi}> + + <button if={form.step === 1 && form.questionEdited !== 0} + type={form.creation || form.model.closed ? "button" : "submit"} + class="c-button c-button--info" + tabindex="1" + onclick={previousQuestion}> + <i class="fa fa-chevron-left " aria-hidden="true"></i> + {_t.previousQuestion} + </button> + + <button if={form.step === 1} + type="submit" + class="c-button c-button--info" + tabindex="1" + onclick={newQuestion}> + {_t.nextQuestion} + <i class="fa fa-chevron-right " aria-hidden="true"></i> + </button> + </div> + </div> + <div class="actions" if={!showSummary}> <a class="c-button c-button--ghost" tabindex="3" @@ -87,24 +109,6 @@ import "./CheckEmails.tag.html"; {_t.previous} </button> - <button if={form.step === 1 && form.multi && form.questionEdited !== 0} - type={form.creation || form.model.closed ? "button" : "submit"} - class="c-button c-button--info" - tabindex="1" - onclick={previousQuestion}> - <i class="fa fa-chevron-left " aria-hidden="true"></i> - {_t.previousQuestion} - </button> - - <button if={form.step === 1 && form.multi} - type="submit" - class="c-button c-button--info" - tabindex="1" - onclick={newQuestion}> - {_t.nextQuestion} - <i class="fa fa-chevron-right " aria-hidden="true"></i> - </button> - <button if={form.step < form.getSteps(form.multi).length - 1} type="submit" class="c-button c-button--info" -- 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/multi-ui in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 962c830556167d70e872cc17e7b859e04b7abac2 Author: jcouteau <couteau@codelutin.com> Date: Thu Oct 10 15:13:15 2019 +0200 Nice question editing workflow --- pollen-ui-riot-js/src/main/web/js/PollForm.js | 9 ++-- .../src/main/web/tag/poll/EditPoll.tag.html | 48 +++++++++++++++++----- .../src/main/web/tag/poll/EditQuestions.tag.html | 42 ++++++++++++------- 3 files changed, 71 insertions(+), 28 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 41152b4e..b4745dbc 100644 --- a/pollen-ui-riot-js/src/main/web/js/PollForm.js +++ b/pollen-ui-riot-js/src/main/web/js/PollForm.js @@ -227,12 +227,15 @@ class PollForm { this.setStep(this.step + 1); } - addNewQuestion() { + addNewQuestion(index) { let newQuestion = new Question("", "", ""); this.setQuestionDefaultSettings(newQuestion); this.setQuestionDefaultChoices(newQuestion); - this.questionEdited = this.questionEdited + 1; - this.model.questions.push(newQuestion); + this.model.questions.splice(index, 0, newQuestion); + } + + deleteQuestion() { + this.model.questions.splice(this.questionEdited, 1); } addNewChoice(questionId) { 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 3e743b30..5f78ba04 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 @@ -72,22 +72,39 @@ import "./CheckEmails.tag.html"; <GtuValidation if={!form.model.gtuValidated && !showSummary && (!form.creation || form.step === form.getSteps(form.multi).length - 1)} ref="gtuValidation"/> - <div class="actions" if={!showSummary && form.multi}> + <div class="actions" if={!showSummary && form.multi && form.step === 1}> - <button if={form.step === 1 && form.questionEdited !== 0} - type={form.creation || form.model.closed ? "button" : "submit"} - class="c-button c-button--info" - tabindex="1" - onclick={previousQuestion}> + <button type={form.creation || form.model.closed ? "button" : "submit"} + class="c-button c-button--info" + tabindex="1" + onclick={previousQuestion} + disabled={form.questionEdited === 0}> <i class="fa fa-chevron-left " aria-hidden="true"></i> {_t.previousQuestion} </button> - <button if={form.step === 1} - type="submit" - class="c-button c-button--info" - tabindex="1" - onclick={newQuestion}> + <button type={form.creation || form.model.closed ? "button" : "submit"} + class="c-button c-button--info" + tabindex="1" + onclick={deleteQuestion} + disabled={form.model.questions.length === 1}> + <i class="fa fa-trash " aria-hidden="true"></i> + {_t.deleteQuestion} + </button> + + <button type="submit" + class="c-button c-button--info" + tabindex="1" + onclick={newQuestion}> + <i class="fa fa-plus " aria-hidden="true"></i> + {_t.newQuestion} + </button> + + <button type="submit" + class="c-button c-button--info" + tabindex="1" + onclick={nextQuestion} + disabled={form.questionEdited === form.model.questions.length - 1}> {_t.nextQuestion} <i class="fa fa-chevron-right " aria-hidden="true"></i> </button> @@ -199,6 +216,15 @@ import "./CheckEmails.tag.html"; this.callAfterSubmit = () => this.refs.editQuestions.newQuestion(); }; + this.deleteQuestion = () => { + this.refs.editQuestions.deleteQuestion(); + }; + + this.nextQuestion = e => { + this.callAfterSubmit = () => this.refs.editQuestions.nextQuestion(); + this.submitStep(e); + }; + this.previousQuestion = (e) => { this.callAfterSubmit = () => this.refs.editQuestions.previousQuestion(); this.submitStep(e); diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/EditQuestions.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/EditQuestions.tag.html index a74c87b7..996138d2 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/EditQuestions.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/EditQuestions.tag.html @@ -59,17 +59,27 @@ import "./EditQuestionsSettings.tag.html"; this.newQuestion = () => { if (!this.form.hasVotes) { this.submit(); + this.form.addNewQuestion(this.form.questionEdited + 1); + this.form.questionEdited++; + this.reloadQuestion(); + } + }; - if (this.form.questionEdited === this.form.model.questions.length-1) { - this.form.addNewQuestion(); - } else { - this.form.questionEdited++; + this.deleteQuestion = () => { + if (!this.form.hasVotes) { + this.form.deleteQuestion(); + if (this.form.questionEdited >= this.form.model.questions.length) { + this.form.questionEdited = this.form.model.questions.length -1; } - this.question = this.form.model.questions[this.form.questionEdited]; - this.refs.title.value = this.question.title; - this.refs.description.value = this.question.description; - this.bus.trigger("questionEditedChanged", this.form.questionEdited); - this.update(); + this.reloadQuestion(); + } + }; + + this.nextQuestion = () => { + if (!this.form.hasVotes) { + this.submit(); + this.form.questionEdited++; + this.reloadQuestion(); } }; @@ -77,14 +87,18 @@ import "./EditQuestionsSettings.tag.html"; if (!this.form.hasVotes) { this.submit(); this.form.questionEdited = this.form.questionEdited - 1; - this.bus.trigger("questionEditedChanged", this.questionEdited); - this.question = this.form.model.questions[this.form.questionEdited]; - this.refs.title.value = this.question.title; - this.refs.description.value = this.question.description; - this.update(); + this.reloadQuestion(); } }; + this.reloadQuestion = () => { + this.question = this.form.model.questions[this.form.questionEdited]; + this.refs.title.value = this.question.title; + this.refs.description.value = this.question.description; + this.bus.trigger("questionEditedChanged", this.form.questionEdited); + this.update(); + } + this.submit = () => { this.refs.choices.submit(); this.refs.settings.submit(); -- 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/multi-ui in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit f8849fd9da3008eaba68b8c105a4ecdd5e6f31d4 Author: jcouteau <couteau@codelutin.com> Date: Thu Oct 10 16:03:37 2019 +0200 Keep its name from one question to another --- pollen-ui-riot-js/src/main/web/js/Poll.js | 4 ++ .../src/main/web/tag/poll/EditVote.tag.html | 48 ++++------------------ .../src/main/web/tag/poll/Vote.tag.html | 6 ++- .../src/main/web/tag/poll/Votes.tag.html | 3 ++ 4 files changed, 20 insertions(+), 41 deletions(-) diff --git a/pollen-ui-riot-js/src/main/web/js/Poll.js b/pollen-ui-riot-js/src/main/web/js/Poll.js index 035d77b0..5cd74842 100644 --- a/pollen-ui-riot-js/src/main/web/js/Poll.js +++ b/pollen-ui-riot-js/src/main/web/js/Poll.js @@ -35,6 +35,7 @@ class Poll { constructor() { this.questions = []; this.comments = []; + this.multi = false; } init(pollId, voteId, permission) { @@ -44,6 +45,7 @@ class Poll { delete this.voteId; delete this.votePermission; Object.assign(this, result); + this.multi = this.questions.length > 1; this.voteId = voteId; this.votePermission = permission; this.comments = undefined; @@ -63,6 +65,7 @@ class Poll { if (this.id) { return pollService.getPoll(this.id, this.getPermission()).then(result => { Object.assign(this, result); + this.multi = this.questions.length > 1; bus.trigger("poll", this); return Promise.resolve(this); }); @@ -77,6 +80,7 @@ class Poll { delete this.permission; delete this._initPromise; this.comments = []; + this.multi = false; bus.trigger("poll", this); }); } diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/EditVote.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/EditVote.tag.html index 35cb12a1..a3a14bda 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/EditVote.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/EditVote.tag.html @@ -193,6 +193,8 @@ this.question = opts.question; + this.multi = opts.multi; + this.poll = poll; if (this.question) { this.poll.loadForVotes(this.question.id).then(() => { @@ -200,42 +202,6 @@ }); } - this.onPollChange = poll2 => { - //reload question - var _this = this; - if (_this.question) { - poll2.questions.forEach(function(question) { - if (_this.question.id === question.id) { - _this.question = question; - } - }); - } else { - _this.question = poll2.questions[0]; - } - - this.poll = poll2; - if (this.question) { - if (!this.question.voteCountingTypeValue) { - this.poll.reloadVoteCountingTypeValue(this.question).then(() => { - this.pollTypeCheckbox = this.question.voteCountingTypeValue && this.question.voteCountingTypeValue.renderType === "checkbox"; - this.pollTypeSelect = this.question.voteCountingTypeValue && this.question.voteCountingTypeValue.renderType === "select"; - this.pollTypeCoombs = this.question.voteCountingType && this.question.voteCountingType === 7; - }); - } else { - this.pollTypeCheckbox = this.question.voteCountingTypeValue && this.question.voteCountingTypeValue.renderType === "checkbox"; - this.pollTypeSelect = this.question.voteCountingTypeValue && this.question.voteCountingTypeValue.renderType === "select"; - this.pollTypeCoombs = this.question.voteCountingType && this.question.voteCountingType === 7; - } - this.resultsLoaded = this.question.results !== undefined; - if (!this.resultsLoaded) { - this.poll.loadResults(this.question.id).then(() => { - }); - } - this.onVoteChanged(); - } - this.update(); - }; - this.onQuestionChange = question2 => { this.question = question2; if (!this.question.voteCountingTypeValue) { @@ -254,14 +220,16 @@ this.poll.loadResults(this.question.id).then(() => { }); } - this.onVoteChanged(); + this.onVoteChanged(); this.update(); }; + this.onMultiChange = multi2 => { + this.multi = multi2; + }; - - //this.listen("poll", this.onPollChange); this.listen("question", this.onQuestionChange); + this.listen("multi", this.onMultiChange); this.listen("user", (user, oldUser) => { if (user !== oldUser) { if (user && this.refs.voterName && this.refs.voterName.value !== "") { @@ -351,7 +319,9 @@ this.resetVoteForm = () => { this.voteInEdition = null; if (this.question.canVote) { + if (!this.multi) { this.refs.voterName.value = null; + } this.question.choices.forEach(choice => { let input = this.refs[choice.id + "_voteValue"]; if (this.question.voteCountingTypeValue.renderType === "text") { diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/Vote.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/Vote.tag.html index 70b17408..01fea47c 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/Vote.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/Vote.tag.html @@ -39,11 +39,13 @@ <EditVote ref="editVote" show={!isVoteByOrder || !voteClickAndDrop} on-save-vote={saveVote} - question="{question}"/> + question="{question}" + multi="{poll.multi}"/> <EditVoteOrder ref="editVoteOrder" show={isVoteByOrder && voteClickAndDrop} on-save-vote={saveVote} - question="{question}"/> + question="{question}" + multi="{poll.multi}"/> <!-- Form to vote --> <p class="warning-label warning" if="{loaded && !poll.canVote}"> diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/Votes.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/Votes.tag.html index dcb4620a..ab8db88e 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/Votes.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/Votes.tag.html @@ -64,6 +64,9 @@ this.onPollChange = poll2 => { this.loaded = poll2.questions[0].choices !== undefined; this.poll = poll2; + if (this.poll.questions.length > 0) { + this.bus.trigger("multi", this.poll.questions.length > 1); + } this.question = this.poll.questions[this.questionToVote]; if (this.question) { this.bus.trigger("question", this.question); -- 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/multi-ui in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit a09e252e8178bce0f36037acc5aaca228e7a1703 Author: jcouteau <couteau@codelutin.com> Date: Thu Oct 10 16:07:13 2019 +0200 Keep ones name on VoteOrder too --- pollen-ui-riot-js/src/main/web/tag/poll/EditVoteOrder.tag.html | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/EditVoteOrder.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/EditVoteOrder.tag.html index fced717d..c1fe943b 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/EditVoteOrder.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/EditVoteOrder.tag.html @@ -139,6 +139,7 @@ this.poll = poll; this.question = opts.question; + this.multi = opts.multi; if (this.question) { this.poll.loadForVotes(this.question.id).then(() => { this.update(); @@ -153,8 +154,13 @@ this.placeChoices(true); }; + this.onMultiChange = multi2 => { + this.multi = multi2; + }; + this.listen("resize", () => this.placeChoices(true)); this.listen("orientationchange", () => this.placeChoices(true)); + this.listen("multi", this.onMultiChange); this.listen("question", this.onQuestionChange); this.listen("user", (user, oldUser) => { @@ -345,7 +351,9 @@ this.resetVoteForm = () => { if (this.poll.canVote) { - this.refs.voterName.value = null; + if (!this.multi) { + this.refs.voterName.value = null; + } this.getChoicesTab().forEach(choice => { choice.voteOrder = undefined; choice.stashed = false; -- 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/multi-ui in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 27c3f23fc30cf59b159dc2961e57b079c7dbfdce Author: jcouteau <couteau@codelutin.com> Date: Thu Oct 10 16:09:17 2019 +0200 Prevent console logs --- pollen-ui-riot-js/src/main/web/tag/poll/Vote.tag.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/Vote.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/Vote.tag.html index 01fea47c..c01201e9 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/Vote.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/Vote.tag.html @@ -22,7 +22,7 @@ <div class="container" show="{loaded}"> <h2 class="align-center">Question {parent.questionToVote + 1}/{poll.questions.length} :</h2> - <h2 class="align-center">{question.title}</h2> + <h2 if="{question}" class="align-center">{question.title}</h2> <span class="c-input-group actions-right" if={isVoteByOrder}> -- 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/multi-ui in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit a38150bb44aa2606516cdc3eb657a4c89caaccb6 Author: jcouteau <couteau@codelutin.com> Date: Thu Oct 10 17:16:18 2019 +0200 Vote goes to next question --- pollen-ui-riot-js/src/main/web/tag/poll/EditVote.tag.html | 7 ++++++- .../src/main/web/tag/poll/EditVoteOrder.tag.html | 6 +++++- pollen-ui-riot-js/src/main/web/tag/poll/Votes.tag.html | 14 ++++++++++---- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/EditVote.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/EditVote.tag.html index a3a14bda..6dbc0352 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/EditVote.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/EditVote.tag.html @@ -388,7 +388,12 @@ this.voting = false; this.voteInEdition = null; this.resetVoteForm(); - this.update(); + if (this.multi) { + this.update(); + this.parent.parent.nextQuestion(); + } else { + this.update(); + } }, (error) => { this.error = error; diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/EditVoteOrder.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/EditVoteOrder.tag.html index c1fe943b..aaaa341b 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/EditVoteOrder.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/EditVoteOrder.tag.html @@ -437,7 +437,11 @@ this.voting = false; this.voteInEdition = null; this.resetVoteForm(); - this.update(); + if (this.multi) { + this.parent.parent.nextQuestion(); + } else { + this.update(); + } }, (error) => { this.error = error; diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/Votes.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/Votes.tag.html index ab8db88e..a02d0057 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/Votes.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/Votes.tag.html @@ -77,10 +77,16 @@ this.listen("poll", this.onPollChange); this.nextQuestion = () => { - this.questionToVote = this.questionToVote + 1; - this.question = this.poll.questions[this.questionToVote]; - this.bus.trigger("question", this.question); - this.update(); + //TODO gérer le cas dernière question + if (this.questionToVote === this.poll.questions.length - 1) { + //last question, thank you and back to home page + //TODO + } else { + this.questionToVote = this.questionToVote + 1; + this.question = this.poll.questions[this.questionToVote]; + this.bus.trigger("question", this.question); + this.update(); + } }; this.previousQuestion = (e) => { -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm