branch develop updated (534a4eb -> a95b94c)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git from 534a4eb Ajout d'un composent de visualisation d'un choix new a95b94c écrans des votes afficher une colonne de resultats The 1 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 a95b94c3d780d8a32f1a7d86ecbe9ed1f2df01db Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Mon Mar 20 15:10:51 2017 +0100 écrans des votes afficher une colonne de resultats Summary of changes: pollen-ui-riot-js/src/main/web/i18n.json | 4 ++ pollen-ui-riot-js/src/main/web/js/Poll.js | 4 ++ .../src/main/web/tag/poll/Poll.tag.html | 8 +-- .../src/main/web/tag/poll/Votes.tag.html | 78 +++++++++++++++++++--- 4 files changed, 82 insertions(+), 12 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 develop in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit a95b94c3d780d8a32f1a7d86ecbe9ed1f2df01db Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Mon Mar 20 15:10:51 2017 +0100 écrans des votes afficher une colonne de resultats --- pollen-ui-riot-js/src/main/web/i18n.json | 4 ++ pollen-ui-riot-js/src/main/web/js/Poll.js | 4 ++ .../src/main/web/tag/poll/Poll.tag.html | 8 +-- .../src/main/web/tag/poll/Votes.tag.html | 78 +++++++++++++++++++--- 4 files changed, 82 insertions(+), 12 deletions(-) diff --git a/pollen-ui-riot-js/src/main/web/i18n.json b/pollen-ui-riot-js/src/main/web/i18n.json index 2a7e0b8..4bb936a 100644 --- a/pollen-ui-riot-js/src/main/web/i18n.json +++ b/pollen-ui-riot-js/src/main/web/i18n.json @@ -32,6 +32,8 @@ "poll_votes_vote": "Voter", "poll_votes_addChoice": "Ajouter un choix", "poll_votes_delete": "Supprimer le vote ?", + "poll_votes_results": "Resultats", + "poll_votes_votes": "votes", "poll_votes_voteNotOpen": "Les votes ne sont pas encore ouverts.", "polls_createdPolls": "Mes sondages", "polls_invitedPolls": "Mes invitations", @@ -287,6 +289,8 @@ "poll_votes_vote": "Vote", "poll_votes_addChoice": "Add choice", "poll_votes_delete": "Delete vote?", + "poll_votes_results": "Results", + "poll_votes_votes": "votes", "poll_votes_voteNotOpen": "Votes are not open.", "polls_createdPolls": "My polls", "polls_invitedPolls": "My invitations", 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 677623c..685eec4 100644 --- a/pollen-ui-riot-js/src/main/web/js/Poll.js +++ b/pollen-ui-riot-js/src/main/web/js/Poll.js @@ -120,6 +120,10 @@ class Poll { return Promise.reject("Init poll after load results"); } + getScoreByChoice(choice) { + return this.results.scores.find(score => score.choiceId === choice.id); + } + loadComments() { if (this.id) { let paginationParameter = new Pagination(); diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/Poll.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/Poll.tag.html index 572de88..c676cd7 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/Poll.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/Poll.tag.html @@ -28,6 +28,10 @@ require("./Settings.tag.html"); class="poll-options dropdown"> <a class="header-link"><i class="fa fa-bars"/></a> <div class="dropdown-content"> + <a href="#/poll/{poll.id}/edit/{poll.permission}"> + <i class="link fa fa-pencil-square-o"/> + {__.editPoll} + </a> <a if="{!poll.isClosed}" onclick="{closePoll}"> <i class="link fa fa-close"/> {__.closePoll}</a> @@ -38,10 +42,6 @@ require("./Settings.tag.html"); <i class="link fa fa-trash"/> {__.deletePoll} </a> - <a href="#/poll/{poll.id}/edit/{poll.permission}"> - <i class="link fa fa-pencil-square-o"/> - {__.editPoll} - </a> </div> </div> </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 e6a731d..672bd24 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 @@ -55,11 +55,49 @@ require("./ChoiceView.tag.html"); disabled={voteId}> {__.vote} </button> + <button type="button" + if={!poll.resultIsVisible && poll.voteIsVisible && !showVotes} + class="c-button c-button--info" + onclick="{onShowVotes}"> + <i class="fa fa-caret-left"/> + <i class="fa fa-caret-right"/> + </button> + <button type="button" + if={!poll.resultIsVisible && poll.voteIsVisible && showVotes} + class="c-button c-button--info" + onclick="{onHideVotes}"> + <i class="fa fa-caret-right"/> + <i class="fa fa-caret-left"/> + </button> </div> </form> <div class="window"> <div class="frame"> - <form each={vote in poll.votes} class="vote" onsubmit="{updateVote(vote)}"> + <div if={poll.resultIsVisible} class="results"> + <div class="result-label"> + <i class="fa fa-trophy fa-15x"></i> {__.results} + </div> + <div each={choice in poll.choices} class="score-choice" score={poll.getScoreByChoice(choice)}> + {poll.getScoreByChoice(choice).scoreOrder + 1} ({poll.getScoreByChoice(choice).scoreValue} {parent.__.votes}) + </div> + <div class="results-actions"> + <button type="button" + if={poll.voteIsVisible && !showVotes} + class="c-button c-button--info" + onclick="{onShowVotes}"> + <i class="fa fa-caret-left"/> + <i class="fa fa-caret-right"/> + </button> + <button type="button" + if={poll.voteIsVisible && showVotes} + class="c-button c-button--info" + onclick="{onHideVotes}"> + <i class="fa fa-caret-right"/> + <i class="fa fa-caret-left"/> + </button> + </div> + </div> + <form if={showVotes} each={vote in poll.votes} class="vote" onsubmit="{updateVote(vote)}"> <div class="voter"> <span class="voter-name" if={vote.id !== voteId}> @@ -84,14 +122,14 @@ require("./ChoiceView.tag.html"); </div> </div> <div each={choice in poll.choices} class="vote-choice" > - <input if={poll.voteCountingTypeValue.renderType==='checkbox' && (poll.getVoteValue(vote, choice) || voteId === vote.id)} + <input if={poll.voteCountingTypeValue.renderType==='checkbox' && (poll.getVoteChoice(vote, choice) || voteId === vote.id)} ref="vote_{vote.id}_{choice.id}" name="vote_{vote.id}_{choice.id}" class="check" type="checkbox" checked={poll.getVoteValue(vote, choice) == 1} disabled={voteId !== vote.id}> - <input if={poll.voteCountingTypeValue.renderType === 'text' && (poll.getVoteValue(vote, choice) || voteId === vote.id)} + <input if={poll.voteCountingTypeValue.renderType === 'text' && (poll.getVoteChoice(vote, choice) || voteId === vote.id)} ref="vote_{vote.id}_{choice.id}" class="text c-field" name="vote_{vote.id}_{choice.id}" @@ -167,15 +205,20 @@ require("./ChoiceView.tag.html"); this.userName = user && user.name; }); this.poll = {}; + this.showVotes = false; this.opts.pollPromise.then(poll => { this.poll = poll; this.voting = poll.canVote || poll.status === "VOTING" || poll.status === "CLOSED"; this.choiceToAdd = new Choice("TEXT"); - return Promise.all([ + let promises = [ poll.loadChoices(), poll.loadVotes(), poll.loadVoteCountingType() - ]); + ]; + if (this.poll.resultIsVisible) { + promises.push(poll.loadResults()); + } + return Promise.all(promises); }).then(() => { this.loaded = true; this.update(); @@ -293,6 +336,14 @@ require("./ChoiceView.tag.html"); }); }; + this.onShowVotes = () => { + this.showVotes = true; + }; + + this.onHideVotes = () => { + this.showVotes = false; + }; + </script> <style> @@ -308,6 +359,7 @@ require("./ChoiceView.tag.html"); .voters .fix { flex-grow: 0; min-width: 200px; + border-right: 1px solid #b2c7d3; } .voters .fix .choice { @@ -342,12 +394,20 @@ require("./ChoiceView.tag.html"); align-items: stretch; } - .voters .window .frame .vote { + .voters .window .frame .vote, + .voters .window .frame .results { min-width: 100px; + border-left: 1px solid #b2c7d3; + } + + .voters .window .frame .vote:first-child, + .voters .window .frame .results:first-child { + border-left: none; } .current-voter, - .voter { + .voter, + .result-label { height: 40px; text-align: center; } @@ -355,7 +415,9 @@ require("./ChoiceView.tag.html"); .voters .fix .choice, .voters .fix .current-voter-actions, .voters .window .frame .vote .vote-choice, - .voters .window .frame .vote .vote-actions { + .voters .window .frame .vote .vote-actions, + .voters .window .frame .results .score-choice, + .voters .window .frame .results .results-actions { height: 40px; display: flex; align-items: center; -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm