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 5842a5b1ca898b96baf2053e5249ac5ab79e0766 Author: Kevin Morin <morin@codelutin.com> Date: Wed Jun 21 11:17:38 2017 +0200 refs #72 modif de la page de résumé (dans un onglet) --- pollen-ui-riot-js/package.json | 2 +- pollen-ui-riot-js/src/main/web/conf.js | 2 +- pollen-ui-riot-js/src/main/web/i18n.json | 24 ++--- pollen-ui-riot-js/src/main/web/tag/Pollen.tag.html | 6 +- .../src/main/web/tag/poll/EditPoll.tag.html | 75 +++++++------ .../src/main/web/tag/poll/Poll.tag.html | 64 ----------- .../src/main/web/tag/poll/Summary.tag.html | 120 ++++++--------------- 7 files changed, 96 insertions(+), 197 deletions(-) diff --git a/pollen-ui-riot-js/package.json b/pollen-ui-riot-js/package.json index 8fcb8ae2..ac02cda4 100644 --- a/pollen-ui-riot-js/package.json +++ b/pollen-ui-riot-js/package.json @@ -24,7 +24,7 @@ } ], "scripts": { - "start": "./node_modules/.bin/webpack-dev-server --hot --inline --host 0.0.0.0 --public felteu:8080", + "start": "./node_modules/.bin/webpack-dev-server --hot --inline --host 0.0.0.0 --public localhost:8080", "package": "./node_modules/.bin/webpack --bail" }, "devDependencies": { diff --git a/pollen-ui-riot-js/src/main/web/conf.js b/pollen-ui-riot-js/src/main/web/conf.js index 3579cf63..a6203bac 100644 --- a/pollen-ui-riot-js/src/main/web/conf.js +++ b/pollen-ui-riot-js/src/main/web/conf.js @@ -1,5 +1,5 @@ window.pollenConf = { - endPoint: "http://felteu:8888/pollen-rest-api", + endPoint: "http://localhost:8888/pollen-rest-api", piwikUrl: "", // add the piwik url, eg: http://localhost/piwik< piwikSiteId: "", // add the site id, eg: 3 defaultMessageTimeout: 15, diff --git a/pollen-ui-riot-js/src/main/web/i18n.json b/pollen-ui-riot-js/src/main/web/i18n.json index 266f64c7..01f0de84 100644 --- a/pollen-ui-riot-js/src/main/web/i18n.json +++ b/pollen-ui-riot-js/src/main/web/i18n.json @@ -22,15 +22,14 @@ "summary_voting": "Ouvert", "summary_fromDate": "à partir du", "summary_toDate": "jusqu'au", - "summary_admin": "Administration du sondage", - "summary_admininistrateNow": "Vous voulez modifier le sondage ? Cliquez sur le bouton suivant :", - "summary_editPoll": "Modifier le sondage", - "summary_urlForAdmin" : "Enregistrez l'adresse suivante pour administrer ce sondage ultérieurement", - "summary_urlForVote" : "Invitez de nouveaux participants en leur envoyant cette adresse", + "summary_administrate": "Administrer le sondage", "summary_sharing": "Partage", + "summary_shareByQR": "Afficher un QR code pour accéder au sondage", + "summary_shareByEmail": "Envoyer des invitations par email", "summary_invitations": "Nombre d'invitations à voter envoyées par email:", - "summary_voteNow": "Cliquez sur le bouton suivant pour voter :", "summary_vote": "Voter", + "summary_members": "Participants", + "summary_membersNb": "participants ont reçu un email avec un lien pour voter.", "poll_403": "Erreur : le sondage n'est pas accessible", "poll_closePoll": "Clôturer le sondage", "poll_reopenPoll": "Réouvrir le sondage", @@ -40,6 +39,7 @@ "poll_creationSuccess": "Votre sondage {0} a été créé avec succès.", "poll_saveSuccess": "Votre sondage {0} a été enregistré avec succès.", "poll_votes": "Votes", + "poll_summaryTab": "Résumé", "poll_settings": "Configuration", "poll_choices": "Choix", "poll_results": "Résultats", @@ -499,18 +499,18 @@ "summary_voting": "Open", "summary_fromDate": "from", "summary_toDate": "to", - "summary_admin": "Poll administration", - "summary_admininistrateNow": "You want to edit the poll? Click on the following button to do so:", - "summary_editPoll": "Edit the poll", - "summary_urlForAdmin" : "Save the following address to administrate the poll later", - "summary_urlForVote" : "Invite new participants with this address", + "summary_administrate": "Administrate the poll", "summary_sharing": "Sharing", + "summary.shareByQR": "Show the QR Code to go to the poll", + "summary.shareByEmail": "Send invitations by email", "summary_invitations": "Number of invitations to vote sent by email:", - "summary_voteNow": "Click on the following button to vote:", "summary_vote": "Vote", + "summary_members": "Participants", + "summary_membersNb": "participants received an email with a link to vote.", "poll_403": "Error : the poll is not available", "poll_choices": "Choices", "poll_votes": "Votes", + "poll_summaryTab": "Summary", "poll_settings": "Settings", "poll_closePoll": "Close poll", "poll_reopenPoll": "Reopen poll", 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 44754127..8bf594ed 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 @@ -156,9 +156,6 @@ require("./popup/InformationPopup.tag.html"); route("/poll/*/vote/*", (pollId, permission) => { riot.mount(this.refs.content, "poll", {pollId: pollId, tabName: "votes", permission: permission}); }); - route("/poll/*/summary/*", (pollId, permission) => { - riot.mount(this.refs.content, "summary", {pollId: pollId, permission: permission}); - }); route("/poll/*/vote/*/*", (pollId, voteId, permission) => { riot.mount(this.refs.content, "poll", {pollId: pollId, tabName: "votes", voteId: voteId, permission: permission}); }); @@ -192,6 +189,9 @@ require("./popup/InformationPopup.tag.html"); this.bus.trigger("pageChanged", "editPoll"); riot.mount(this.refs.content, "editpoll", {pollId: pollId, permission: permission, clone: true}); }); + route("/poll/*/summary/*/*", (pollId, permission) => { + riot.mount(this.refs.content, "editpoll", {pollId: pollId, permission: permission, showSummary:true}); + }); route("/poll/*", (pollId) => { riot.mount(this.refs.content, "poll", {pollId: pollId}); }); diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/EditPoll.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/EditPoll.tag.html index d7dc2ee3..472dd76d 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/EditPoll.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/EditPoll.tag.html @@ -22,28 +22,35 @@ require("./Description.tag.html"); require("./Choices.tag.html"); require("./Settings.tag.html"); require("./Voters.tag.html"); +require("./Summary.tag.html"); <EditPoll> <form show={loaded} ref="poll" onsubmit="{submitStep}" class="form"> <div class="tabs tabs-one-small"> - <div each={step, index in form.steps} - class="tab {selected : form.step === index}"> - <button type="submit" if="{form.step > index || !form.creation}" onclick="{goto(index)}"> + <div each={step, index in form.steps} class="tab {selected : !showSummary && form.step === index}"> + <button type="submit" if="{form.step > index || !form.creation}" class="{cursor-pointer: !form.creation}" onclick="{goto(index)}"> {getStepLabel(step)} </button> - <span if="{form.step <= index && form.creation}"> + <span if="{form.step <= index && form.creation}" class="cursor-pointer"> {getStepLabel(step)} </span> </div> + <div if="{showSummary}" class="tab selected"> + <button type="submit" class="cursor-pointer"> + {__.summaryTab} + </button> + </div> </div> <div class="container"> - <Description if={form.step === 0} form={form}/> - <Choices if={form.step === 1} form={form}/> - <Settings if={form.step === 2} form={form}/> - <Voters if={form.step === 3} form={form}/> - <div class="actions"> + <Description if={!showSummary && form.step === 0} form={form}/> + <Choices if={!showSummary && form.step === 1} form={form}/> + <Settings if={!showSummary && form.step === 2} form={form}/> + <Voters if={!showSummary && form.step === 3} form={form}/> + <Summary if={showSummary} form={form}/> + + <div class="actions" if={!showSummary}> <div class="actions-left"> <a class="c-button c-button--ghost-info" href={form.creation ? "#/home" : ("#/poll/" + form.model.id + "/vote/" + form.model.permission)}> @@ -81,26 +88,30 @@ require("./Voters.tag.html"); <script type="es6"> this.loaded = false; + this.showSummary = this.opts.showSummary; this.session = require("../../js/Session"); this.installBundle(this.session, "poll"); this.form = require("../../js/PollForm"); let Message = require("../../js/Message"); + let pollLoaded = () => { + this.loaded = true; + this.update(); + if (this.showSummary) { + this.bus.trigger("pageChanged", this.form.model.title); + } + }; if (this.opts.pollId) { - this.form.loadPoll(this.opts.pollId, this.opts.permission, this.opts.clone).then(() => { - this.loaded = true; - this.update(); - }); + this.form.loadPoll(this.opts.pollId, this.opts.permission, this.opts.clone).then(pollLoaded); } else { - this.form.init(this.opts.choiceType, this.session.getUser()).then(() => { - this.loaded = true; - this.update(); - }); + this.form.init(this.opts.choiceType, this.session.getUser()).then(pollLoaded); } this.getStepLabel = step => this.__["step_" + step]; this.goto = index => () => { + this.showSummary = false; + this.bus.trigger("pageChanged", "editPoll"); this.callAfterSubmit = () => this.form.setStep(index); }; @@ -127,23 +138,25 @@ require("./Voters.tag.html"); this.savePoll = () => { this.callAfterSubmit = () => { - let promiseSave; - let successMessage; + let errorFn = errors => { + this.bus.trigger("message", errors); + this.update(); + }; if (this.form.creation) { - promiseSave = this.form.create(); - successMessage = this._l("creationSuccess", this.form.model.title); + this.form.create().then(() => { + let route = require("riot-route"); + route("poll/" + this.form.model.id + "/summary/" + this.form.model.permission + "/creation"); + this.bus.trigger("successMessage", this._l("creationSuccess", this.form.model.title)); + }, errorFn); + } else { - promiseSave = this.form.save(); - successMessage = this._l("saveSuccess", this.form.model.title); + this.form.save().then(() => { + this.showSummary = true; + this.update(); + this.bus.trigger("successMessage", this._l("saveSuccess", this.form.model.title)); + this.bus.trigger("pageChanged", this.form.model.title); + }, errorFn); } - promiseSave.then(() => { - this.bus.trigger("message", new Message(successMessage, "success")); - let route = require("riot-route"); - route("poll/" + this.form.model.id + "/summary/" + this.form.model.permission); - }, errors => { - this.bus.trigger("message", errors); - this.update(); - }); }; }; 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 5db2f96e..39066540 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,70 +46,6 @@ require("./Report.tag.html"); </div> <div class="container"> - <div class="c-card poll-urls" - if={poll.permission}> - <div class="c-card__item"> - <div class="o-form-element"> - <label class="c-label" for="urlForAdmin">{__.urlForAdmin}</label> - <div class="c-input-group u-small"> - <div class="o-field"> - <input class="c-field" - id="urlForAdmin" - ref="urlForAdmin" - type="text" - readonly="true" - value="{window.location.origin}{window.location.pathname}#poll/{poll.id}/vote/{poll.permission}"> - </div> - <button class="c-button c-button--info" - onclick={copyUrl("urlForAdmin")}> - <i class="fa fa-clipboard" aria-hidden="true"></i> - </button> - </div> - </div> - <div class="o-form-element" - if={poll.pollType === "FREE"}> - <label class="c-label" for="urlForVote">{__.urlForVote}</label> - <div class="c-input-group u-small"> - <div class="o-field"> - <input class="c-field" - id="urlForVote" - ref="urlForVote" - type="text" - readonly="true" - value="{window.location.origin}{window.location.pathname}#poll/{poll.id}/vote"> - </div> - <button class="c-button c-button--info" - onclick={copyUrl("urlForVote")}> - <i class="fa fa-clipboard" aria-hidden="true"></i> - </button> - </div> - </div> - </div> - </div> - <div class="c-card poll-urls" - if={poll.voteId}> - <div class="c-card__item"> - <div class="o-form-element" - if={poll.voteId}> - <label class="c-label" for="urlForEditVote">{__.urlForEditVote}</label> - <div class="c-input-group u-small"> - <div class="o-field"> - <input class="c-field" - id="urlForEditVote" - ref="urlForEditVote" - type="text" - readonly="true" - value="{window.location.origin}{window.location.pathname}#poll/{poll.id}/vote/{poll.voteId}/{poll.votePermission}"> - </div> - <button class="c-button c-button--info" - onclick={copyUrl("urlForEditVote")}> - <i class="fa fa-clipboard" aria-hidden="true"></i> - </button> - </div> - </div> - </div> - </div> - <div class="poll-info"> <h1> diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/Summary.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/Summary.tag.html index eeeca6ad..6e79a749 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/Summary.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/Summary.tag.html @@ -6,106 +6,70 @@ require("../popup/QrCodeButton.tag.html"); <div class="container"> + <div if={successMessage} class="c-alert c-alert--success">{successMessage}</div> + <div class="poll-info"> <h2> - {poll.title} + {opts.form.model.title} </h2> - <p><em>{poll.description}</em></p> + <p><em>{opts.form.model.description}</em></p> - <div if="{poll.voteCountingTypeValue}"> + <div if="{opts.form.model.voteCountingTypeValue}"> {__.voteCountingType} : - <strong>{poll.voteCountingTypeValue.name}</strong> (<em>{poll.voteCountingTypeValue.helper}</em>) + <strong>{opts.form.model.voteCountingTypeValue.name}</strong> (<em>{opts.form.model.voteCountingTypeValue.helper}</em>) </div> </div> <div> <h3>{__.choices}</h3> - <div each={choice, index in poll.choices} class="{odd-row: index % 2 > 0}"> + <div each={choice, index in opts.form.choices} class="{odd-row: index % 2 > 0}"> <ChoiceView choice={choice} showdescription="true"/> </div> </div> <div> <h3>{__.dates}</h3> - <div if={poll.choiceAddAllowed}> + <div if={opts.form.model.choiceAddAllowed}> {__.addingChoices} - <span if={poll.beginChoiceDate}>{__.fromDate} <strong>{formatDate(poll.beginChoiceDate)}</strong></span> - <span if={poll.endChoiceDate}> {__.toDate} <strong>{formatDate(poll.endChoiceDate)}</strong></span> + <span if={opts.form.model.beginChoiceDate}>{__.fromDate} <strong>{formatDate(opts.form.model.beginChoiceDate)}</strong></span> + <span if={opts.form.model.endChoiceDate}> {__.toDate} <strong>{formatDate(opts.form.model.endChoiceDate)}</strong></span> </div> <div> {__.voting} - {__.fromDate} <strong>{formatDate(poll.beginDate)}</strong> - <span if={poll.endDate}> {__.toDate} <strong>{formatDate(poll.endDate)}</strong></span> - </div> - </div> - - <div> - <h3>{__.admin}</h3> - <p> - {__.admininistrateNow} - <a href="{window.location.origin}{window.location.pathname}#poll/{poll.id}/edit/{poll.permission}" class="c-button c-button--info"> - {__.editPoll} - </a> - </p> - <div> - <label class="c-label" for="urlForAdmin">{__.urlForAdmin}</label> - <div class="c-input-group u-small"> - <div class="o-field"> - <input class="c-field" - id="urlForAdmin" - ref="urlForAdmin" - type="text" - readonly="true" - value="{window.location.origin}{window.location.pathname}#poll/{poll.id}/vote/{poll.permission}"> - </div> - <button class="c-button c-button--info" - onclick={copyUrl("urlForAdmin")}> - <i class="fa fa-clipboard" aria-hidden="true"></i> - </button> - </div> + {__.fromDate} <strong>{formatDate(opts.form.model.beginDate)}</strong> + <span if={opts.form.model.endDate}> {__.toDate} <strong>{formatDate(opts.form.model.endDate)}</strong></span> </div> </div> - <div> + <div if={opts.form.model.pollType === "FREE"}> <h3>{__.sharing}</h3> - - <div if={poll.participants}> - {__.invitations} <strong>{poll.participants.length}</strong> + <div if={opts.form.model.participants && opts.form.model.participants.length > 0}> + {__.invitations} <strong>{opts.form.model.participants.length}</strong> </div> <div> - <QrCodeButton if={poll.pollType === "FREE"} value="{voteUrl}"/> - <a href="mailto:?subject={poll.title}&body={poll.title}%0D%0A{poll.description}%0D%0A{voteUrl}" class="c-button c-button--info"> + <QrCodeButton value="{voteUrl}" title="{__.shareByQR}"/> + <a href="mailto:?subject={opts.form.model.title}&body={opts.form.model.title}%0D%0A{opts.form.model.description}%0D%0A{voteUrl}" + title="{__.shareByEmail}" + class="c-button c-button--info"> <i class="fa fa-paper-plane"></i> </a> </div> + </div> - <div if={poll.pollType === "FREE"}> - <label class="c-label" for="urlForVote">{__.urlForVote}</label> - <div class="c-input-group u-small"> - <div class="o-field"> - <input class="c-field" - id="urlForVote" - ref="urlForVote" - type="text" - readonly="true" - value="{voteUrl}"> - </div> - <button class="c-button c-button--info" - onclick={copyUrl("urlForVote")}> - <i class="fa fa-clipboard" aria-hidden="true"></i> - </button> - </div> - </div> - + <div if={opts.form.model.pollType === "RESTRICTED"}> + <h3>{__.members}</h3> <div> - {__.voteNow} - <a href="{window.location.origin}{window.location.pathname}#poll/{poll.id}/vote/{poll.permission}" class="c-button c-button--info">{__.vote}</a> + <strong>{opts.form.model.participantCount}</strong> {__.membersNb} </div> - </div> - </div> + <div> + <a if={opts.form.model.pollType === "FREE"} + href="{window.location.origin}{window.location.pathname}#poll/{opts.form.model.id}/vote" class="c-button c-button--info">{__.vote}</a> + <a href="{window.location.origin}{window.location.pathname}#poll/{opts.form.model.id}/vote/{opts.form.model.permission}" + class="c-button c-button--info">{__.administrate}</a> + </div> </div> @@ -115,33 +79,19 @@ require("../popup/QrCodeButton.tag.html"); let route = require("riot-route"); this.installBundle(this.session, "summary"); - this.selectedTab = this.opts.tabName || "votes"; - this.showVoteCountingTypeHelper = false; - this.voteUrl; - - this.poll = require("../../js/Poll"); - this.onPollChange = poll => { - this.poll = poll; - this.voteUrl = window.location.origin + window.location.pathname + "#poll/" + this.poll.id + "/vote"; - this.update(); - this.bus.trigger("pageChanged", poll.title); - }; - - this.listen("poll", this.onPollChange); - this.poll.init(this.opts.pollId, this.opts.voteId, this.opts.permission).catch((error) => { - this.bus.trigger("message", new Message(this._l(error.status), "error")); - route("/"); - }).then(() => { - this.poll.loadChoices(); - this.poll.loadVoteCountingType(); - }); + this.voteUrl = "test"; this.copyUrl = (refInputUrl) => () => { this.refs[refInputUrl].select(); document.execCommand("copy"); }; + this.listen("successMessage", (successMessage) => { + this.successMessage = successMessage; + this.update(); + }); + </script> <style> -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.