This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit a45b1d85932eb294ce5d9e8fe430f89d22762f3f Author: Kevin Morin <morin@codelutin.com> Date: Thu Apr 13 17:43:40 2017 +0200 refs #15 affichage ou non de la limite de choix à sélectionner en fonction du type de sondage --- .../src/main/web/tag/poll/Settings.tag.html | 57 +++++++++++++--------- 1 file changed, 33 insertions(+), 24 deletions(-) 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 b675c8d..90ed0c1 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 @@ -52,6 +52,29 @@ <div show={showOptions || !form.creation}> <hr> <div class="form-section"> + <div class="section-title"> + <h4>{__.nav_voteCountingType}</h4> + </div> + <div class="section-content"> + <div class="o-form-element"> + <label class="c-label"> + {__.voteCountingType} + </label> + <select class="c-field" + ref="voteCountingType" + value={form.model.voteCountingType} + disabled={form.hasVotes} + onchange={voteCountingTypeChanged}> + <option each={type in form.voteCountingTypes} + value={type.id}> + {type.name} + </option> + </select> + </div> + </div> + </div> + <hr> + <div class="form-section"> <div class="section-title"> <h4>{__.nav_choices}</h4> </div> @@ -97,7 +120,7 @@ type="datetime-local"> </div> </div> - <div class="o-form-element"> + <div show="{canLimitNumberOfChoices}" class="o-form-element"> <label class="c-toggle c-toggle--info"> {__.limitChoices} <input type="checkbox" @@ -122,6 +145,7 @@ class="c-field" disabled={form.hasVotes} value={form.model.maxChoiceNumber} + min="{form.model.limitChoices ? 1 : 0}" max="{form.choices.length}" type="number"> </div> </div> @@ -129,29 +153,6 @@ <hr> <div class="form-section"> <div class="section-title"> - <h4>{__.nav_voteCountingType}</h4> - </div> - <div class="section-content"> - <div class="o-form-element"> - <label class="c-label"> - {__.voteCountingType} - </label> - <select class="c-field" - ref="voteCountingType" - value={form.model.voteCountingType} - disabled={form.hasVotes} - onchange={voteCountingTypeChanged}> - <option each={type in form.voteCountingTypes} - value={type.id}> - {type.name} - </option> - </select> - </div> - </div> - </div> - <hr> - <div class="form-section"> - <div class="section-title"> <h4>{__.nav_votes}</h4> </div> <div class="section-content"> @@ -288,8 +289,11 @@ this.installBundle(this.session, "poll_settings"); this.form = this.opts.form; + this.showOptions = this.form.showOptions; this.showHelp = false; + this.voteCountingTypes = new Map(this.form.voteCountingTypes.map((t) => [t.id.toString(), t])); + this.canLimitNumberOfChoices = this.voteCountingTypes.get(this.form.model.voteCountingType.toString()).canLimitNumberOfChoices; this.form.model.votePeriod = this.form.model.beginDate || this.form.model.endDate; this.on("mount", () => { @@ -302,6 +306,9 @@ this.toggleLimitChoices = () => { this.form.model.limitChoices = !this.form.model.limitChoices; + if (this.form.model.limitChoices && !this.form.model.maxChoiceNumber) { + this.form.model.maxChoiceNumber = 1; + } }; this.toggleVotePeriod = () => { @@ -326,6 +333,8 @@ this.voteCountingTypeChanged = e => { this.form.model.voteCountingType = e.target.value; + this.canLimitNumberOfChoices = this.voteCountingTypes.get(this.form.model.voteCountingType).canLimitNumberOfChoices; + this.form.model.limitChoices &= this.canLimitNumberOfChoices; }; this.submit = () => { -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.