branch develop updated (11cdd9e -> 30bdaa0)
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 11cdd9e maj de webmotion new 30bdaa0 affichage des urls pour administrer ou voter pour un sondage ou modifier un vote 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 30bdaa03b9407e34853dc4a646a219ff520e1bff Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Thu Mar 30 11:41:28 2017 +0200 affichage des urls pour administrer ou voter pour un sondage ou modifier un vote Summary of changes: pollen-ui-riot-js/src/main/web/css/main.css | 4 +- pollen-ui-riot-js/src/main/web/i18n.json | 6 +++ pollen-ui-riot-js/src/main/web/js/Poll.js | 18 +++++--- pollen-ui-riot-js/src/main/web/tag/Pollen.tag.html | 3 ++ .../src/main/web/tag/poll/Poll.tag.html | 53 +++++++++++++++++++++- .../src/main/web/tag/poll/Votes.tag.html | 4 +- 6 files changed, 76 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 30bdaa03b9407e34853dc4a646a219ff520e1bff Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Thu Mar 30 11:41:28 2017 +0200 affichage des urls pour administrer ou voter pour un sondage ou modifier un vote --- pollen-ui-riot-js/src/main/web/css/main.css | 4 +- pollen-ui-riot-js/src/main/web/i18n.json | 6 +++ pollen-ui-riot-js/src/main/web/js/Poll.js | 18 +++++--- pollen-ui-riot-js/src/main/web/tag/Pollen.tag.html | 3 ++ .../src/main/web/tag/poll/Poll.tag.html | 53 +++++++++++++++++++++- .../src/main/web/tag/poll/Votes.tag.html | 4 +- 6 files changed, 76 insertions(+), 12 deletions(-) diff --git a/pollen-ui-riot-js/src/main/web/css/main.css b/pollen-ui-riot-js/src/main/web/css/main.css index a21ac65..78185ba 100644 --- a/pollen-ui-riot-js/src/main/web/css/main.css +++ b/pollen-ui-riot-js/src/main/web/css/main.css @@ -91,9 +91,9 @@ a { margin: 15px auto 0 auto; } -@media (max-width: 640px) { +@media (max-width: 1034px) { .container { - margin: 0 5px; + margin: 15px 5px 0 5px; } } diff --git a/pollen-ui-riot-js/src/main/web/i18n.json b/pollen-ui-riot-js/src/main/web/i18n.json index a000711..ce0ed9d 100644 --- a/pollen-ui-riot-js/src/main/web/i18n.json +++ b/pollen-ui-riot-js/src/main/web/i18n.json @@ -28,6 +28,9 @@ "poll_vote": "vote", "poll_votes": "votes", "poll_closedFrom": "Fermé depuis le", + "poll_urlForAdmin" : "Administation", + "poll_urlForVote" : "Vote", + "poll_urlForEditVote" : "Modification du vote", "poll_results_title": "Résultats", "poll_results_noResult": "Les résultats ne sont pas encore disponibles.", "poll_results_rank": "Rang :", @@ -311,6 +314,9 @@ "poll_vote": "vote", "poll_votes": "votes", "poll_closedFrom": "Closing from", + "poll_urlForAdmin" : "Administation", + "poll_urlForVote" : "Vote", + "poll_urlForEditVote" : "Edit vote", "poll_results_noResult": "Results are not yet available.", "poll_results_title": "Results", "poll_results_vote": "vote", 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 0bee740..200d9e6 100644 --- a/pollen-ui-riot-js/src/main/web/js/Poll.js +++ b/pollen-ui-riot-js/src/main/web/js/Poll.js @@ -18,11 +18,15 @@ class Poll { this.comments = []; } - init(pollId, permission) { - this._initPromise = pollService.getPoll(pollId, permission).then(result => { + init(pollId, voteId, permission) { + this._initPromise = pollService.getPoll(pollId, !voteId && permission).then(result => { delete this.id; delete this.permission; + delete this.voteId; + delete this.votePermission; Object.assign(this, result); + this.voteId = voteId; + this.votePermission = voteId && permission; this.choices = undefined; this.votes = undefined; this.comments = undefined; @@ -115,7 +119,7 @@ class Poll { return this._initPromise.then(() => { var promises = [ choiceService.getChoices(this.id, this.permission), - voteService.getVotes(this.id, this.permission), + voteService.getVotes(this.id, this.votePermission || this.permission), voteCountingTypeService.getVoteCountingType(this.voteCountingType) ]; if (this.resultIsVisible) { @@ -244,7 +248,9 @@ class Poll { addVote(vote) { if (this.id) { - return voteService.addVote(this.id, vote).then(() => { + return voteService.addVote(this.id, vote).then((result) => { + this.voteId = result.id; + this.votePermission = result.permission; return Promise.all([this.reloadPoll(), this.loadVotes()]); }); } @@ -253,7 +259,7 @@ class Poll { updateVote(vote) { if (this.id) { - return voteService.updateVote(this.id, vote, this.permission || vote.permission || "").then(() => { + return voteService.updateVote(this.id, vote, this.votePermission || this.permission || vote.permission || "").then(() => { return Promise.all([this.reloadPoll(), this.loadVotes()]); }); } @@ -262,7 +268,7 @@ class Poll { deleteVote(vote) { if (this.id) { - return voteService.deleteVote(this.id, vote.id, this.permission || vote.permission || "").then(() => { + return voteService.deleteVote(this.id, vote.id, this.votePermission || this.permission || vote.permission || "").then(() => { return Promise.all([this.reloadPoll(), this.loadVotes()]); }); } diff --git a/pollen-ui-riot-js/src/main/web/tag/Pollen.tag.html b/pollen-ui-riot-js/src/main/web/tag/Pollen.tag.html index b9c8a4e..37b56f7 100644 --- a/pollen-ui-riot-js/src/main/web/tag/Pollen.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/Pollen.tag.html @@ -115,6 +115,9 @@ require("./UserProfile.tag.html"); route("/poll/*/vote/*", (pollId, permission) => { riot.mount(this.refs.content, "poll", {pollId: pollId, tabName: "votes", permission: permission}); }); + route("/poll/*/vote/*/*", (pollId, voteId, permission) => { + riot.mount(this.refs.content, "poll", {pollId: pollId, tabName: "votes", voteId: voteId, permission: permission}); + }); route("/poll/*/comment", (pollId) => { riot.mount(this.refs.content, "poll", {pollId: pollId, tabName: "comments"}); }); 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 fbc3646..7f5a4b8 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 @@ -46,6 +46,38 @@ require("./Settings.tag.html"); </div> <div class="container"> + <div class="c-input-group u-small" + if={poll.permission || poll.voteId}> + <div class="o-field select-url"> + <select class="c-field" + ref="urlSelect" + onchange={onUrlChange}> + <option if={poll.permission} + value="{window.location.origin}{window.location.pathname}#poll/{poll.id}/vote/{poll.permission}"> + {__.urlForAdmin} + </option> + <option if={poll.voteId} + value="{window.location.origin}{window.location.pathname}#poll/{poll.id}/vote/{poll.voteId}/{poll.votePermission}"> + {__.urlForEditVote} + </option> + <option if={poll.permission} + value="{window.location.origin}{window.location.pathname}#poll/{poll.id}/vote"> + {__.urlForVote} + </option> + </select> + </div> + <div class="o-field"> + <input class="c-field" + type="text" + readonly="true" + ref="urlInputRead"> + </div> + <button class="c-button c-button--info" + onclick={copyUrl}> + <i class="fa fa-clipboard" aria-hidden="true"></i> + </button> + </div> + <div class="poll-info"> <h1>{poll.title}<h1> @@ -98,16 +130,17 @@ require("./Settings.tag.html"); this.session = require("../../js/Session"); this.installBundle(this.session, "poll"); - this.selectedTab = this.opts.tabName; + this.selectedTab = this.opts.tabName || "votes"; this.poll = require("../../js/Poll"); this.onPollChange = poll => { this.poll = poll; + this.onUrlChange(); this.update(); }; this.bus.on("poll", this.onPollChange); - this.poll.init(this.opts.pollId, this.opts.permission); + this.poll.init(this.opts.pollId, this.opts.voteId, this.opts.permission); this.closePoll = (e) => { e.preventDefault(); @@ -137,6 +170,17 @@ require("./Settings.tag.html"); } }; + this.onUrlChange = () => { + if (this.refs.urlSelect) { + this.refs.urlInputRead.value = this.refs.urlSelect.value; + } + }; + + this.copyUrl = () => { + this.refs.urlInputRead.select(); + document.execCommand("copy"); + }; + this.on("before-unmount", () => { this.bus.off("poll", this.onPollChange); }); @@ -209,5 +253,10 @@ require("./Settings.tag.html"); z-index: 1; } + .select-url { + flex-grow: 0; + flex-basis: auto; + } + </style> </Poll> 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 a308826..2402b97 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 @@ -81,13 +81,13 @@ require("./Podium.tag.html"); </div> </div> <button type="button" - if={poll.voteIsVisible && poll.voteCount > 0 && !showVotes} + if={poll.votes && poll.votes.length && !showVotes} class="expand c-button c-button--info" onclick="{onShowVotes}"> <i class="fa fa-caret-right"/> </button> <button type="button" - if={poll.voteIsVisible && poll.voteCount > 0 && showVotes} + if={poll.votes && poll.votes.length && showVotes} class="collapse c-button c-button--info" onclick="{onHideVotes}"> <i class="fa fa-caret-left"/> -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm