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 285a0a1a660748df98067c33232a262baf91ad09 Author: Kevin Morin <morin@codelutin.com> Date: Fri Sep 15 17:16:37 2017 +0200 fixes #122 Afficher le statut du sondage dans l'ecran de vote --- pollen-ui-riot-js/src/main/web/i18n/en.json | 1 + pollen-ui-riot-js/src/main/web/i18n/fr.json | 1 + .../main/web/tag/components/time-picker.tag.html | 6 +- .../src/main/web/tag/poll/Votes.tag.html | 197 +++++++++++---------- 4 files changed, 110 insertions(+), 95 deletions(-) diff --git a/pollen-ui-riot-js/src/main/web/i18n/en.json b/pollen-ui-riot-js/src/main/web/i18n/en.json index 4d1919d2..4623ffd7 100644 --- a/pollen-ui-riot-js/src/main/web/i18n/en.json +++ b/pollen-ui-riot-js/src/main/web/i18n/en.json @@ -148,6 +148,7 @@ "poll_votes_results_unit_7_one": "vote", "poll_votes_results_unit_7_many": "votes", "poll_votes_voteNotOpen": "Votes are not open.", + "poll_votes_voteClosed": "Votes are closed", "polls_createdPolls": "My polls", "polls_assignPollToMe": "Link a poll to my account", "polls_assignPollToMe_title": "Link the poll", diff --git a/pollen-ui-riot-js/src/main/web/i18n/fr.json b/pollen-ui-riot-js/src/main/web/i18n/fr.json index 1d5716e4..56d6968d 100644 --- a/pollen-ui-riot-js/src/main/web/i18n/fr.json +++ b/pollen-ui-riot-js/src/main/web/i18n/fr.json @@ -148,6 +148,7 @@ "poll_votes_results_unit_7_one": "vote", "poll_votes_results_unit_7_many": "votes", "poll_votes_voteNotOpen": "Les votes ne sont pas encore ouverts.", + "poll_votes_voteClosed": "Les votes sont clos.", "polls_createdPolls": "Mes sondages", "polls_assignPollToMe": "Attacher le sondage", "polls_assignPollToMe_title": "Attacher un sondage à mon compte", diff --git a/pollen-ui-riot-js/src/main/web/tag/components/time-picker.tag.html b/pollen-ui-riot-js/src/main/web/tag/components/time-picker.tag.html index 71fcd46d..0d58eaf1 100644 --- a/pollen-ui-riot-js/src/main/web/tag/components/time-picker.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/components/time-picker.tag.html @@ -16,7 +16,8 @@ max="23" min="0" required - value="{opts.time.time ? opts.time.time.format('HH') : moment().format('HH')}" + disabled={opts.disabled} + value="{opts.time.time ? opts.time.time.format('HH') : null}" onchange="{hourChanged}"/> <span class="colon">:</span> <input class="timepicker-input" @@ -25,7 +26,8 @@ max="59" min="0" required - value="{opts.time.time ? opts.time.time.format('mm') : moment().format('mm')}" + disabled={opts.disabled} + value="{opts.time.time ? opts.time.time.format('mm') : null}" onchange="{minuteChanged}"/> </div> 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 32b46804..ff7fb647 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 @@ -8,110 +8,114 @@ require("../components/LazyLoad.tag.html"); <!-- Form to vote --> <div class="form-wrapper"> - <form id="voteForm" class="voter separator" ref="formAddVote"> - <HumanInput onsubmit="{voteInEdition ? updateVote : addVote}"></HumanInput> - <div class="header"> - <div class="current-voter separator-right"> - <div class="o-field o-field--icon-left o-field--icon-right" - if={poll.canVote || voteInEdition} > - <i class="fa fa-fw fa-user c-icon"></i> - <input class="c-field {c-field--error: !voteInEdition && error && error['voter.name']}" - type="text" - ref="voterName" - name="voterName" - required - maxlength="255" - tabindex="1" - placeholder={__.authorPlaceHolder} - value={poll.voterName}> + <form id="voteForm" class="voter separator" ref="formAddVote"> + <HumanInput onsubmit="{voteInEdition ? updateVote : addVote}"></HumanInput> + <div class="header"> + <div class="current-voter separator-right"> + <div class="o-field o-field--icon-left o-field--icon-right" + if={poll.canVote || voteInEdition} > + <i class="fa fa-fw fa-user c-icon"></i> + <input class="c-field {c-field--error: !voteInEdition && error && error['voter.name']}" + type="text" + ref="voterName" + name="voterName" + required + maxlength="255" + tabindex="1" + placeholder={__.authorPlaceHolder} + value={poll.voterName}> + </div> + <div if={!poll.canVote && !voteInEdition} + class="choices-label"> + {__.choices} + </div> </div> - <div if={!poll.canVote && !voteInEdition} - class="choices-label"> - {__.choices} + <div if={poll.resultIsVisible} class="result-label"> + <strong>{__.results}</strong> </div> </div> - <div if={poll.resultIsVisible} class="result-label"> - <strong>{__.results}</strong> - </div> - </div> - <div each={choice, index in poll.choices} class="choice separator-top"> - <div class="choice-vote separator-right"> - <div class="choice-value"> - <ChoiceView choice={choice} center="true"></ChoiceView> + <div each={choice, index in poll.choices} class="choice separator-top"> + <div class="choice-vote separator-right"> + <div class="choice-value"> + <ChoiceView choice={choice} center="true"></ChoiceView> + </div> + <div class="current-choice" + if={poll.canVote || voteInEdition}> + <input if={pollTypeCheckbox} + class="check" + type="checkbox" + onchange="{onVoteChanged}" + ref="{choice.id}_voteValue" + tabindex="{10 * (index + 1)}"> + <input if={!pollTypeCheckbox} + class="text c-field {c-field--error: !voteInEdition && error && (error['vote.voteValue#' + choice.id] || error['vote.totalVoteValue'])}" + type="number" + required + min="{poll.voteCountingTypeValue && poll.voteCountingTypeValue.minimumValue}" + max="{poll.voteCountingTypeValue && poll.voteCountingTypeValue.maximumValue}" + onchange="{onVoteChanged}" + ref="{choice.id}_voteValue" + tabindex="{10 * (index + 1)}"> + </div> </div> - <div class="current-choice" - if={poll.canVote || voteInEdition}> - <input if={pollTypeCheckbox} - class="check" - type="checkbox" - onchange="{onVoteChanged}" - ref="{choice.id}_voteValue" - tabindex="{10 * (index + 1)}"> - <input if={!pollTypeCheckbox} - class="text c-field {c-field--error: !voteInEdition && error && (error['vote.voteValue#' + choice.id] || error['vote.totalVoteValue'])}" - type="number" - required - min="{poll.voteCountingTypeValue && poll.voteCountingTypeValue.minimumValue}" - max="{poll.voteCountingTypeValue && poll.voteCountingTypeValue.maximumValue}" - onchange="{onVoteChanged}" - ref="{choice.id}_voteValue" - tabindex="{10 * (index + 1)}"> + <div if={poll.resultIsVisible} class="score-choice"> + <span if={!choice.score}>{parent.__.noVote}</span> + <span if={choice.score}> + <i if="{choice.score.scoreOrder === 0}" class="fa fa-trophy fa-15x winner"></i> + {choice.score.scoreValue} + {parent.__["results_unit_" + poll.voteCountingType + "_" + (choice.score.scoreValue > 1 ? "many" : "one")]} + </span> </div> </div> - <div if={poll.resultIsVisible} class="score-choice"> - <span if={!choice.score}>{parent.__.noVote}</span> - <span if={choice.score}> - <i if="{choice.score.scoreOrder === 0}" class="fa fa-trophy fa-15x winner"></i> - {choice.score.scoreValue} - {parent.__["results_unit_" + poll.voteCountingType + "_" + (choice.score.scoreValue > 1 ? "many" : "one")]} - </span> - </div> - </div> - <div class="footer separator-top" if="{loaded && poll.canVote}"> - <div class="current-voter-actions separator-right"> - <div class="current-voter-buttons"> - <button if={!voteInEdition} - class="c-button c-button--brand pull-right" - type="submit" - name="newVote" - tabindex="{(poll.choices.length + 1) * 10}" - disabled={tooManyChoicesSelected || voting}> - <i class="fa fa-envelope"></i> - {__.toVote} - </button> - <button if="{voteInEdition}" - class="c-button c-button--error" - type="button" - tabindex="{(poll.choices.length + 2) * 10}" - onclick="{cancelEditVote}" - disabled={voting}> - <i class="fa fa-remove"></i> - {__.cancelEdition} - </button> - <button if="{voteInEdition}" - class="c-button c-button--success" - tabindex="{(poll.choices.length + 1) * 10}" - disabled={tooManyChoicesSelected || voting} - type="submit"> - <i class="fa fa-check"></i> - {__.validateEdition} - </button> - </div> - <div class="c-hint--static c-hint--error" if="{tooManyChoicesSelected}"> - {__.tooManyChoicesSelected} {poll.maxChoiceNumber} - </div> - <div class="c-hint--static c-hint--error" if="{error}"> - <div each={fields in error}> - {fields} + <div class="footer separator-top" if="{loaded && poll.canVote}"> + <div class="current-voter-actions separator-right"> + <div class="current-voter-buttons"> + <button if={!voteInEdition} + class="c-button c-button--brand pull-right" + type="submit" + name="newVote" + tabindex="{(poll.choices.length + 1) * 10}" + disabled={tooManyChoicesSelected || voting}> + <i class="fa fa-envelope"></i> + {__.toVote} + </button> + <button if="{voteInEdition}" + class="c-button c-button--error" + type="button" + tabindex="{(poll.choices.length + 2) * 10}" + onclick="{cancelEditVote}" + disabled={voting}> + <i class="fa fa-remove"></i> + {__.cancelEdition} + </button> + <button if="{voteInEdition}" + class="c-button c-button--success" + tabindex="{(poll.choices.length + 1) * 10}" + disabled={tooManyChoicesSelected || voting} + type="submit"> + <i class="fa fa-check"></i> + {__.validateEdition} + </button> + </div> + <div class="c-hint--static c-hint--error" if="{tooManyChoicesSelected}"> + {__.tooManyChoicesSelected} {poll.maxChoiceNumber} + </div> + <div class="c-hint--static c-hint--error" if="{error}"> + <div each={fields in error}> + {fields} + </div> </div> </div> - </div> - <div if={poll.resultIsVisible} class="results-actions"> + <div if={poll.resultIsVisible} class="results-actions"> + </div> </div> - </div> - </form> + </form> </div> + <p class="warning-label warning" if="{loaded && !poll.canVote}"> + <span if="{moment().isBefore(poll.beginDate)}">{__.voteNotOpen}</span> + <span if="{moment().isAfter(poll.endDate)}">{__.voteClosed}</span> + </p> <!-- Form to add a choice --> <form ref="formAddChoice" class="formAddChoice" if={poll.status === "ADDING_CHOICES"}> @@ -211,6 +215,7 @@ require("../components/LazyLoad.tag.html"); this.loaded = false; let session = require("../../js/Session"); let Choice = require("../../js/Choice"); + this.moment = require("moment"); this.installBundle(session, "poll_votes"); this.tooManyChoicesSelected = false; this.showChoiceHeader = true; @@ -259,6 +264,7 @@ require("../components/LazyLoad.tag.html"); this.pollTypeCheckbox = poll.voteCountingTypeValue && poll.voteCountingTypeValue.renderType === "checkbox"; this.choiceToAdd = this.poll.initChoice(this.choiceToAdd); this.onVoteChanged(); + console.log(poll); this.refresh(); this.update(); }; @@ -739,5 +745,10 @@ require("../components/LazyLoad.tag.html"); font-weight: bold; } + .warning-label { + text-align: center; + margin-top: 1em; + } + </style> </Votes> -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.