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 3a3ad4ad52262dae940cbd99dfa63ec04ea0b20c Author: Kevin Morin <morin@codelutin.com> Date: Tue Aug 8 17:58:09 2017 +0200 on empeche de supprimer si le sondage est terminé --- .../src/main/java/org/chorem/pollen/rest/api/v1/VoteApi.java | 2 +- .../java/org/chorem/pollen/services/service/VoteService.java | 6 +++++- pollen-ui-riot-js/src/main/web/tag/poll/Votes.tag.html | 12 +++++++----- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/VoteApi.java b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/VoteApi.java index 4d1a3b04..1661a71c 100644 --- a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/VoteApi.java +++ b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/VoteApi.java @@ -104,7 +104,7 @@ public class VoteApi { @DELETE public void deleteVote(@Context VoteService voteService, @PathParam("pollId") PollenEntityId<Poll> pollId, - @PathParam("voteId") PollenEntityId<Vote> voteId) { + @PathParam("voteId") PollenEntityId<Vote> voteId) throws InvalidFormException { voteService.deleteVote(pollId.getEntityId(), voteId.getEntityId()); 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 66f8c3e1..50154a5b 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 @@ -179,16 +179,20 @@ public class VoteService extends PollenServiceSupport { } - public void deleteVote(String pollId, String voteId) { + public void deleteVote(String pollId, String voteId) throws InvalidFormException { checkNotNull(pollId); checkNotNull(voteId); checkPermission(PermissionVerb.deleteVote, voteId); Poll poll = getPollService().getPoll0(pollId); + List<ChoiceBean> choices = getChoiceService().getChoices(pollId); Vote vote = getVote(poll, voteId); + ErrorMap errorMap = checkVote(poll, vote, choices); + errorMap.failIfNotEmpty(); + getVoteDao().delete(vote); commit(); 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 5bd35e44..c5615258 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 @@ -9,7 +9,7 @@ require("../components/HumanInput.tag.html"); <div class="form-wrapper"> <form id="voteForm" class="voter separator" ref="formAddVote"> <HumanInput onsubmit="{voteInEdition ? updateVote : addVote}"></HumanInput> - <div class="header separator-bottom"> + <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} > @@ -33,7 +33,7 @@ require("../components/HumanInput.tag.html"); <strong>{__.results}</strong> </div> </div> - <div each={choice, index in poll.choices} class="choice separator-bottom"> + <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> @@ -66,10 +66,10 @@ require("../components/HumanInput.tag.html"); </span> </div> </div> - <div class="footer"> + <div class="footer separator-top" if="{poll.canVote}"> <div class="current-voter-actions separator-right"> <div class="current-voter-buttons"> - <button if={poll.canVote && !voteInEdition} + <button if={!voteInEdition} class="c-button c-button--brand pull-right" type="submit" name="newVote" @@ -139,7 +139,7 @@ require("../components/HumanInput.tag.html"); </button> <button type="button" class="c-button c-button--rounded u-xsmall c-button--error" - if="{poll.permission || !poll.closed && vote.permission}" + if="{!poll.closed && (poll.permission || vote.permission)}" disabled="{voteInEdition != null || voting}" onclick="{parent.deleteVote(vote)}"> <i class="fa fa-trash"></i> @@ -214,6 +214,8 @@ require("../components/HumanInput.tag.html"); && this.refs.results0.offsetWidth / this.poll.choices.length >= MIN_CHOICE_COLUMN_WIDTH; }; + console.log(this.poll) + this.onPollChange = poll => { this.loaded = poll.choices !== undefined; this.poll = poll; -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.