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 e05d92c311fa4673d940aa13fc2a69aa089625f7 Author: Brendan Le Ny <bleny@codelutin.com> Date: Fri Oct 18 11:18:47 2019 +0200 Indent component --- .../web/tag/voteCountingType/BordaConfig.tag.html | 136 ++++++++++----------- 1 file changed, 68 insertions(+), 68 deletions(-) diff --git a/pollen-ui-riot-js/src/main/web/tag/voteCountingType/BordaConfig.tag.html b/pollen-ui-riot-js/src/main/web/tag/voteCountingType/BordaConfig.tag.html index 7fb14de0..7935f918 100644 --- a/pollen-ui-riot-js/src/main/web/tag/voteCountingType/BordaConfig.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/voteCountingType/BordaConfig.tag.html @@ -33,83 +33,83 @@ import "./MaxChoicesNumberConfig.tag.html"; name="bordaDefault" id="bordaDefault" ref="bordaDefault" - disabled={opts.disabled} - checkboxchecked={opts.config.pointsByRankDefault} - ontogglecheckbox={toggleBordaDefault}/> + disabled="{opts.disabled}" + checkboxchecked="{opts.config.pointsByRankDefault}" + ontogglecheckbox="{toggleBordaDefault}" /> </div> <div class="o-form-element"> - <label class="c-label" for="maxChoiceNumber"> - {_t.pointsByRank} - </label> - <div class="c-input-group c-input-group--stacked c-field--label"> - <div class="o-field ranks" - each={value, index in opts.config.pointsByRank || []}> - <em class="rank">{parent._t.rank} {index + 1} :</em> - <input name="points-{index}" - tabindex="1" - id="points-{index}" - ref="points" - class="c-field" - disabled={parent.opts.disabled || parent.opts.config.pointsByRankDefault} - value={value} - min="{index + 1 === parent.opts.config.pointsByRank.length ? 1 : parent.opts.config.pointsByRank[index + 1]}" - max="{index === 0 ? undefined : parent.opts.config.pointsByRank[index - 1]}" - onChange={parent.pointsChange(index)} - type="number"> - <em class="points">{parent._t.points}</em> - </div> - </div> - </div> - - <script type="es6"> - import session from "../../js/Session"; - this.installBundle(session, "poll_settings_voteCountingConfig"); - - if (this.opts.config.pointsByRankDefault === undefined) { - this.opts.config.pointsByRankDefault = this.opts.config.pointsByRank === undefined || this.opts.config.pointsByRank === null; - } - - - this.toggleBordaDefault = () => { - this.opts.config.pointsByRankDefault = !this.opts.config.pointsByRankDefault; - if (this.opts.config.pointsByRankDefault) { - this.updatePointsByRank(); - } - this.update(); - }; + <label class="c-label" for="maxChoiceNumber"> + {_t.pointsByRank} + </label> + <div class="c-input-group c-input-group--stacked c-field--label"> + <div class="o-field ranks" + each={value, index in opts.config.pointsByRank || []}> + <em class="rank">{parent._t.rank} {index + 1} :</em> + <input name="points-{index}" + tabindex="1" + id="points-{index}" + ref="points" + class="c-field" + disabled={parent.opts.disabled || parent.opts.config.pointsByRankDefault} + value={value} + min="{index + 1 === parent.opts.config.pointsByRank.length ? 1 : parent.opts.config.pointsByRank[index + 1]}" + max="{index === 0 ? undefined : parent.opts.config.pointsByRank[index - 1]}" + onChange={parent.pointsChange(index)} + type="number"> + <em class="points">{parent._t.points}</em> + </div> + </div> + </div> - this.updatePointsByRank = () => { - let length = this.opts.config.maxChoiceNumber || this.opts.countChoices; - this.opts.config.pointsByRank = Array.from(Array(length).keys(), x => length - x); - }; + <script type="es6"> + import session from "../../js/Session"; + this.installBundle(session, "poll_settings_voteCountingConfig"); - this.pointsChange = index => () => { - this.opts.config.pointsByRank[index] = this.refs.points[index].valueAsNumber; - }; + if (this.opts.config.pointsByRankDefault === undefined) { + this.opts.config.pointsByRankDefault = this.opts.config.pointsByRank === undefined || this.opts.config.pointsByRank === null; + } - this.getConfig = () => { - let config = this.refs.maxChoiceNumber.getConfig(); - config.pointsByRank = this.opts.config.pointsByRankDefault ? null : this.refs.points.map(input => input.valueAsNumber); - return config; - }; - if (!this.opts.config.pointsByRank) { + this.toggleBordaDefault = () => { + this.opts.config.pointsByRankDefault = !this.opts.config.pointsByRankDefault; + if (this.opts.config.pointsByRankDefault) { this.updatePointsByRank(); - } else { - let length = this.opts.config.maxChoiceNumber || this.opts.countChoices; - if (this.opts.config.pointsByRank.length < length) { - let nbRankToAdd = length - this.opts.config.pointsByRank.length; - let nextRanks = new Array(nbRankToAdd).fill(0); - this.opts.config.pointsByRank = this.opts.config.pointsByRank.concat(nextRanks); - } else if (this.opts.config.pointsByRank.length > length) { - let nbRankToRemove = this.opts.config.pointsByRank.length - length; - this.opts.config.pointsByRank.splice(length, nbRankToRemove); - } } + this.update(); + }; + + this.updatePointsByRank = () => { + let length = this.opts.config.maxChoiceNumber || this.opts.countChoices; + this.opts.config.pointsByRank = Array.from(Array(length).keys(), x => length - x); + }; + + this.pointsChange = index => () => { + this.opts.config.pointsByRank[index] = this.refs.points[index].valueAsNumber; + }; + + this.getConfig = () => { + let config = this.refs.maxChoiceNumber.getConfig(); + config.pointsByRank = this.opts.config.pointsByRankDefault ? null : this.refs.points.map(input => input.valueAsNumber); + return config; + }; + + if (!this.opts.config.pointsByRank) { + this.updatePointsByRank(); + } else { + let length = this.opts.config.maxChoiceNumber || this.opts.countChoices; + if (this.opts.config.pointsByRank.length < length) { + let nbRankToAdd = length - this.opts.config.pointsByRank.length; + let nextRanks = new Array(nbRankToAdd).fill(0); + this.opts.config.pointsByRank = this.opts.config.pointsByRank.concat(nextRanks); + } else if (this.opts.config.pointsByRank.length > length) { + let nbRankToRemove = this.opts.config.pointsByRank.length - length; + this.opts.config.pointsByRank.splice(length, nbRankToRemove); + } + } - </script> + </script> - <style> + <style> .ranks .rank { left: .5em; @@ -131,6 +131,6 @@ import "./MaxChoicesNumberConfig.tag.html"; padding-left: 5em; padding-right: 4em; } - </stryle> + </style> </BordaConfig> -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.