branch develop updated (d193ac8f -> cbd67201)
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 d193ac8f Signalement de contenu inappropriƩ (ref #63) new cbd67201 Re-charger le sondage en cas de reconnexion. 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 cbd67201a16d53647b6ba0e3e1a4254076547efb Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Thu Jun 15 14:41:55 2017 +0200 Re-charger le sondage en cas de reconnexion. Summary of changes: .../org/chorem/pollen/services/service/CommentService.java | 4 ++++ .../org/chorem/pollen/services/service/VoteService.java | 5 +++++ pollen-ui-riot-js/src/main/web/js/Poll.js | 13 ++++++++----- pollen-ui-riot-js/src/main/web/tag/poll/Comments.tag.html | 4 ++++ pollen-ui-riot-js/src/main/web/tag/poll/Poll.tag.html | 5 +++++ pollen-ui-riot-js/src/main/web/tag/poll/Results.tag.html | 5 +++++ pollen-ui-riot-js/src/main/web/tag/poll/Votes.tag.html | 11 ++++++++--- 7 files changed, 39 insertions(+), 8 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 cbd67201a16d53647b6ba0e3e1a4254076547efb Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Thu Jun 15 14:41:55 2017 +0200 Re-charger le sondage en cas de reconnexion. --- .../org/chorem/pollen/services/service/CommentService.java | 4 ++++ .../org/chorem/pollen/services/service/VoteService.java | 5 +++++ pollen-ui-riot-js/src/main/web/js/Poll.js | 13 ++++++++----- pollen-ui-riot-js/src/main/web/tag/poll/Comments.tag.html | 4 ++++ pollen-ui-riot-js/src/main/web/tag/poll/Poll.tag.html | 5 +++++ pollen-ui-riot-js/src/main/web/tag/poll/Results.tag.html | 5 +++++ pollen-ui-riot-js/src/main/web/tag/poll/Votes.tag.html | 11 ++++++++--- 7 files changed, 39 insertions(+), 8 deletions(-) diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/CommentService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/CommentService.java index 91642546..34f6e8a4 100644 --- a/pollen-services/src/main/java/org/chorem/pollen/services/service/CommentService.java +++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/CommentService.java @@ -89,11 +89,15 @@ public class CommentService extends PollenServiceSupport { CommentBean commentBean = new CommentBean(); PollenPrincipal mainPrincipal = getSecurityContext().getMainPrincipal(); + PollenUser connectedUser = getConnectedUser(); if (mainPrincipal != null) { commentBean.setAuthorName(mainPrincipal.getName()); + } else if (connectedUser != null) { + + commentBean.setAuthorName(connectedUser.getName()); } return commentBean; diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/VoteService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/VoteService.java index d526b1f9..66a5d144 100644 --- a/pollen-services/src/main/java/org/chorem/pollen/services/service/VoteService.java +++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/VoteService.java @@ -78,6 +78,7 @@ public class VoteService extends PollenServiceSupport { voteBean.setWeight(1d); PollenPrincipal mainPrincipal = getSecurityContext().getMainPrincipal(); + PollenUser connectedUser = getConnectedUser(); if (mainPrincipal != null) { @@ -92,6 +93,10 @@ public class VoteService extends PollenServiceSupport { // fixme bavencoff 17/05/2017 faut-il toujour garder le poid sur le vote ?? et pas sur le VoterListMember //voteBean.setWeight(voterListMember.getWeight()); } + } else if (connectedUser != null) { + + voteBean.setVoterName(connectedUser.getName()); + } return voteBean; 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 b8357a3e..41f6d4a5 100644 --- a/pollen-ui-riot-js/src/main/web/js/Poll.js +++ b/pollen-ui-riot-js/src/main/web/js/Poll.js @@ -47,11 +47,14 @@ class Poll { } reloadPoll() { - return pollService.getPoll(this.id, this.permission || this.votePermission).then(result => { - Object.assign(this, result); - bus.trigger("poll", this); - return Promise.resolve(this); - }); + if (this.id) { + return pollService.getPoll(this.id, this.permission || this.votePermission).then(result => { + Object.assign(this, result); + bus.trigger("poll", this); + return Promise.resolve(this); + }); + } + return Promise.reject("Init poll after reload poll"); } delete() { diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/Comments.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/Comments.tag.html index 7f09740f..5f3873fb 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/Comments.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/Comments.tag.html @@ -172,6 +172,10 @@ require("./Report.tag.html"); }; this.listen("poll", this.onPollChange); + this.listen("user", () => { + this.poll.loadComments(); + this.update(); + }); this.orderDesc = true; 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 d79da368..dfd83861 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 @@ -186,11 +186,16 @@ require("./Report.tag.html"); }; this.listen("poll", this.onPollChange); + this.poll.init(this.opts.pollId, this.opts.voteId, this.opts.permission).catch((error) => { this.bus.trigger("error", new Error(this._l(error.status))); route("/"); }); + this.listen("user", () => { + this.poll.reloadPoll().then(() => {}, () =>{}); + }); + this.closePoll = (e) => { e.preventDefault(); e.stopPropagation(); diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/Results.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/Results.tag.html index 22a9888d..7ae30b60 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/Results.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/Results.tag.html @@ -46,6 +46,11 @@ require("./Podium.tag.html"); this.listen("poll", this.onPollChange); + this.listen("user", () => { + this.poll.loadResults(); + this.update(); + }); + </script> <style> 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 c819e119..e6023f3e 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 @@ -34,13 +34,13 @@ require("./Podium.tag.html"); </div> <div class="current-choice" if={poll.canVote}> - <input if={poll.voteCountingTypeValue.renderType==='checkbox'} + <input if={poll.voteCountingTypeValue && poll.voteCountingTypeValue.renderType==='checkbox'} class="check" type="checkbox" onchange="{onVoteChanged}" ref="{choice.id}_voteValue" disabled={voteId}> - <input if={poll.voteCountingTypeValue.renderType==='text'} + <input if={poll.voteCountingTypeValue && poll.voteCountingTypeValue.renderType==='text'} class="text c-field {c-field--error: !voteId && error && error['vote.voteValue#' + choice.id]}" type="number" min="{poll.voteCountingTypeValue.minimumValue}" @@ -121,7 +121,7 @@ require("./Podium.tag.html"); </div> </div> <div each={choice in poll.choices} class="vote-choice separator-top" > - <input if={poll.voteCountingTypeValue.renderType==='checkbox' && (poll.getVoteChoice(vote, choice) || voteId === vote.id)} + <input if={poll.voteCountingTypeValue && 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 {c-field--error: vote.id === voteId && error && error['vote.voteValue#' + choice.id]}" @@ -225,6 +225,11 @@ require("./Podium.tag.html"); }; this.listen("poll", this.onPollChange); + this.listen("user", () => { + this.poll.loadVotes(); + this.update(); + }); + this.showVotes = false; this.voteId = null; -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm