branch feature/72_poll_creation_confirmation created (now 49bc888d)
This is an automated email from the git hooks/post-receive script. New change to branch feature/72_poll_creation_confirmation in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git at 49bc888d fix bad merge This branch includes the following new commits: new 881ffdc3 refs #72 creation de la page de résumé new b261cb45 refs #72 ajout d'autres types de message (pas seulement error) dans le toaster en bas à droite + affichage d'un message de succès de création et d'enregistrement + redirection vers le résumé plutôt que vers la page de vote new 49bc888d fix bad merge The 3 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 49bc888da9c0a1ec5ba2152e7d9113d41da59086 Author: Kevin Morin <morin@codelutin.com> Date: Mon Jun 19 17:29:29 2017 +0200 fix bad merge commit 881ffdc3d9a3f6038b2fd618c13647cd9df19cdd Author: Kevin Morin <morin@codelutin.com> Date: Mon Jun 19 16:34:27 2017 +0200 refs #72 creation de la page de résumé commit b261cb45466c092c2efe363a731d6d80bb2520ed Author: Kevin Morin <morin@codelutin.com> Date: Mon Jun 19 17:14:05 2017 +0200 refs #72 ajout d'autres types de message (pas seulement error) dans le toaster en bas à droite + affichage d'un message de succès de création et d'enregistrement + redirection vers le résumé plutôt que vers la page de vote -- 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 feature/72_poll_creation_confirmation in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 881ffdc3d9a3f6038b2fd618c13647cd9df19cdd Author: Kevin Morin <morin@codelutin.com> Date: Mon Jun 19 16:34:27 2017 +0200 refs #72 creation de la page de résumé --- pollen-ui-riot-js/src/main/web/i18n.json | 32 +++++ pollen-ui-riot-js/src/main/web/js/Poll.js | 6 + pollen-ui-riot-js/src/main/web/tag/Pollen.tag.html | 4 + .../src/main/web/tag/poll/ChoiceView.tag.html | 11 +- .../src/main/web/tag/poll/Description.tag.html | 15 +- .../src/main/web/tag/poll/Podium.tag.html | 6 +- .../src/main/web/tag/poll/Results.tag.html | 2 +- .../src/main/web/tag/poll/Summary.tag.html | 159 +++++++++++++++++++++ .../src/main/web/tag/poll/Votes.tag.html | 2 +- .../src/main/web/tag/popup/QrCodeButton.tag.html | 1 + 10 files changed, 227 insertions(+), 11 deletions(-) diff --git a/pollen-ui-riot-js/src/main/web/i18n.json b/pollen-ui-riot-js/src/main/web/i18n.json index 789c6a4b..5f07ea76 100644 --- a/pollen-ui-riot-js/src/main/web/i18n.json +++ b/pollen-ui-riot-js/src/main/web/i18n.json @@ -15,6 +15,22 @@ "main_favoriteLists" : "Listes de favoris", "pagination_all": "Tous", "pagination_resultsPerPage": "Résultats par page", + "summary_choices": "Choix", + "summary_voteCountingType": "Type de sondage", + "summary_dates": "Dates", + "summary_addingChoices": "Ajout de choix", + "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_sharing": "Partage", + "summary_invitations": "Nombre d'invitations à voter envoyées par email:", + "summary_voteNow": "Cliquez sur le bouton suivant pour voter :", + "summary_vote": "Voter", "poll_403": "Erreur : le sondage n'est pas accessible", "poll_closePoll": "Clôturer le sondage", "poll_reopenPoll": "Réouvrir le sondage", @@ -474,6 +490,22 @@ "main_favoriteLists" : "List of favorites", "pagination_all": "All", "pagination_resultsPerPage": "Results per page", + "summary_choices": "Choices", + "summary_voteCountingType": "Poll type", + "summary_dates": "Dates", + "summary_addingChoices": "Choice adding", + "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_sharing": "Sharing", + "summary_invitations": "Number of invitations to vote sent by email:", + "summary_voteNow": "Click on the following button to vote:", + "summary_vote": "Vote", "poll_403": "Error : the poll is not available", "poll_choices": "Choices", "poll_votes": "Votes", 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 41f6d4a5..c85ce33b 100644 --- a/pollen-ui-riot-js/src/main/web/js/Poll.js +++ b/pollen-ui-riot-js/src/main/web/js/Poll.js @@ -391,6 +391,12 @@ class Poll { return service.ignoreReport(this.id, target.id, report.id, this.permission || ""); } return Promise.reject("Init poll after ignore report"); + + loadVoteCountingType() { + voteCountingTypeService.getVoteCountingType(this.voteCountingType).then((voteCountingTypeValue) => { + this.voteCountingTypeValue = voteCountingTypeValue; + bus.trigger("poll", this); + }); } } 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 cbc3da8f..ed5d35f6 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 @@ -28,6 +28,7 @@ require("./SignCheck.tag.html"); require("./Home.tag.html"); require("./poll/EditPoll.tag.html"); require("./poll/Poll.tag.html"); +require("./poll/Summary.tag.html"); require("./poll/Polls.tag.html"); require("./Users.tag.html"); require("./UserProfile.tag.html"); @@ -155,6 +156,9 @@ 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}); }); diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/ChoiceView.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/ChoiceView.tag.html index b08d405d..c04378a9 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/ChoiceView.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/ChoiceView.tag.html @@ -1,6 +1,7 @@ require("./Report.tag.html"); <ChoiceView> - <div class="choice-view {with-info : opts.choice.choiceType === 'RESOURCE' || opts.choice.description}" + <div class="choice-view {center-choice : opts.center} + {with-info : opts.choice.choiceType === 'RESOURCE' || opts.choice.description && !opts.showdescription}" onclick={openModalImage} title={opts.choice.description}> <span class="choice-text" @@ -23,9 +24,10 @@ require("./Report.tag.html"); if={opts.choice.choiceType === "RESOURCE" && meta && !isImage(meta)}> {meta.name} </div> - <div if={opts.choice.choiceType === "RESOURCE" || opts.choice.description} class="info-label"> + <div if={opts.choice.choiceType === "RESOURCE" || opts.choice.description && !opts.showdescription} class="info-label"> <i class="fa fa-question-circle" aria-hidden="true"></i> </div> + <span if="{opts.choice.description && opts.showdescription}"> : <em>{opts.choice.description}</em></span> </div> <Report target={opts.choice}/> @@ -85,7 +87,7 @@ require("./Report.tag.html"); }; this.openModalImage = () => { - if (this.opts.choice.description || this.opts.choice.choiceType === "RESOURCE") { + if (this.opts.choice.description && !this.opts.showdescription || this.opts.choice.choiceType === "RESOURCE") { this.showModalImage = true; } }; @@ -113,6 +115,9 @@ require("./Report.tag.html"); .choice-view { flex-grow: 1; display: flex; + } + + .center-choice { justify-content: center; } diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/Description.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/Description.tag.html index 470617b4..c71b2f23 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/Description.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/Description.tag.html @@ -28,7 +28,15 @@ name="title" value="{form.model.title}" disabled={opts.form.model.isClosed} - placeholder="{__.titlePlaceHolder}"> + placeholder="{__.titlePlaceHolder}"/> + </div> + <div class="o-form-element"> + <label class="c-label" for="description">{__.description}</label> + <textarea ref="description" + class="c-field" + name="description" + disabled={opts.form.model.isClosed} + placeholder="{__.descriptionPlaceHolder}">{form.model.description}</textarea> </div> <div class="o-form-element"> <label class="c-label" for="name">{__.name}</label> @@ -39,7 +47,7 @@ name="name" value="{form.model.creatorName}" disabled={opts.form.model.isClosed} - placeholder="{__.namePlaceHolder}"> + placeholder="{__.namePlaceHolder}"/> </div> <div class="o-form-element"> <label class="c-label" for="email">{__.email}</label> @@ -49,7 +57,7 @@ name="email" value="{form.model.creatorEmail}" disabled={opts.form.model.isClosed} - placeholder="{__.emailPlaceHolder}"> + placeholder="{__.emailPlaceHolder}"/> </div> <script type="es6"> @@ -58,6 +66,7 @@ this.form = this.opts.form; this.submit = () => { this.form.model.title = this.refs.title.value; + this.form.model.description = this.refs.description.value; this.form.model.creatorName = this.refs.name.value; this.form.model.creatorEmail = this.refs.email.value; }; diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/Podium.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/Podium.tag.html index adcb2d98..939041ee 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/Podium.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/Podium.tag.html @@ -4,19 +4,19 @@ require("./ChoiceView.tag.html"); <div if={podium.step2} each={choice in podium.step2} class="podium-step second-step"> <div class="step-score colors-main-invers">2</div> <div class="choice"> - <ChoiceView choice={choice}/> + <ChoiceView choice={choice} center="true"/> </div> </div> <div if={podium.step1} each={choice in podium.step1} class="podium-step first-step"> <div class="step-score colors-main-invers">1</div> <div class="choice"> - <ChoiceView choice={choice}/> + <ChoiceView choice={choice} center="true"/> </div> </div> <div if={podium.step3} each={choice in podium.step3} class="podium-step third-step"> <div class="step-score colors-main-invers">3</div> <div class="choice"> - <ChoiceView choice={choice}/> + <ChoiceView choice={choice} center="true"/> </div> </div> </div> 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 7ae30b60..7788d11c 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 @@ -21,7 +21,7 @@ require("./Podium.tag.html"); <td class="score separator-top">{result.scoreOrder + 1}</td> <td class="votes separator-top">{result.scoreValue} {parent.__["unit_" + poll.voteCountingType + "_" + (result.scoreValue > 1 ? "many" : "one")]}</td> <td class="choice separator-top"> - <ChoiceView choice={poll.getChoice(result.choiceId)}/> + <ChoiceView choice={poll.getChoice(result.choiceId)} center="true"/> </td> </tr> </tbody> 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 new file mode 100644 index 00000000..be2481b1 --- /dev/null +++ b/pollen-ui-riot-js/src/main/web/tag/poll/Summary.tag.html @@ -0,0 +1,159 @@ +require("./Choices.tag.html"); +require("./Settings.tag.html"); +require("../popup/QrCodeButton.tag.html"); + +<Summary> + + <div class="container"> + + <div class="poll-info"> + <h2> + {poll.title} + </h2> + + <p><em>{poll.description}</em></p> + + <div if="{poll.voteCountingTypeValue}"> + {__.voteCountingType} : + <strong>{poll.voteCountingTypeValue.name}</strong> (<em>{poll.voteCountingTypeValue.helper}</em>) + </div> + </div> + + <div> + <h3>{__.choices}</h3> + <div each={choice, index in poll.choices} class="{odd-row: index % 2 > 0}"> + <ChoiceView choice={choice} showdescription="true"/> + </div> + </div> + + <div> + <h3>{__.dates}</h3> + <div if={poll.choiceAddAllowed}> + {__.addingChoices} + <span if={poll.beginChoiceDate}>{__.fromDate} <strong>{formatDate(poll.beginChoiceDate)}</strong></span> + <span if={poll.endChoiceDate}> {__.toDate} <strong>{formatDate(poll.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> + </div> + </div> + + <div> + <h3>{__.sharing}</h3> + + <div if={poll.participants}> + {__.invitations} <strong>{poll.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"> + <i class="fa fa-paper-plane"></i> + </a> + </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> + {__.voteNow} + <a href="{window.location.origin}{window.location.pathname}#poll/{poll.id}/vote/{poll.permission}" class="c-button c-button--info">{__.vote}</a> + </div> + + </div> + + </div> + + </div> + + <script type="es6"> + this.session = require("../../js/Session"); + let Error = require("../../js/Error"); + 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("error", new Error(this._l(error.status))); + route("/"); + }).then(() => { + this.poll.loadChoices(); + this.poll.loadVoteCountingType(); + }); + + this.copyUrl = (refInputUrl) => () => { + this.refs[refInputUrl].select(); + document.execCommand("copy"); + }; + + </script> + + <style> + + .container > div { + margin-bottom: 20px; + line-height: 25px; + } + + .odd-row { + background-color: #eee; + } + + </style> +</Summary> 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 e6023f3e..507aec83 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 @@ -30,7 +30,7 @@ require("./Podium.tag.html"); </div> <div each={choice in poll.choices} class="choice separator-top"> <div class="choice-value"> - <ChoiceView choice={choice}/> + <ChoiceView choice={choice} center="true"/> </div> <div class="current-choice" if={poll.canVote}> diff --git a/pollen-ui-riot-js/src/main/web/tag/popup/QrCodeButton.tag.html b/pollen-ui-riot-js/src/main/web/tag/popup/QrCodeButton.tag.html index 132c133b..2069818f 100644 --- a/pollen-ui-riot-js/src/main/web/tag/popup/QrCodeButton.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/popup/QrCodeButton.tag.html @@ -45,6 +45,7 @@ require("../QrCode.tag.html"); .o-modal .c-card .c-card__body { display: flex; + text-align: center; flex-direction: column; align-items: stretch; align-content: stretch; -- 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 feature/72_poll_creation_confirmation in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit b261cb45466c092c2efe363a731d6d80bb2520ed Author: Kevin Morin <morin@codelutin.com> Date: Mon Jun 19 17:14:05 2017 +0200 refs #72 ajout d'autres types de message (pas seulement error) dans le toaster en bas à droite + affichage d'un message de succès de création et d'enregistrement + redirection vers le résumé plutôt que vers la page de vote --- pollen-ui-riot-js/src/main/web/conf.js | 2 +- pollen-ui-riot-js/src/main/web/i18n.json | 4 ++ .../src/main/web/js/{Error.js => Message.js} | 18 +++--- pollen-ui-riot-js/src/main/web/js/Poll.js | 2 +- pollen-ui-riot-js/src/main/web/tag/Pollen.tag.html | 6 +- .../src/main/web/tag/PollenErrorManager.tag.html | 66 ---------------------- .../src/main/web/tag/PollenMessageManager.tag.html | 66 ++++++++++++++++++++++ .../web/tag/favoriteList/FavoriteList.tag.html | 12 ++-- .../web/tag/favoriteList/FavoriteLists.tag.html | 2 +- .../src/main/web/tag/poll/EditPoll.tag.html | 9 ++- .../src/main/web/tag/poll/Poll.tag.html | 4 +- .../src/main/web/tag/poll/Summary.tag.html | 4 +- .../src/main/web/tag/poll/Votes.tag.html | 2 +- .../web/tag/voterList/VoterListActions.tag.html | 2 +- 14 files changed, 106 insertions(+), 93 deletions(-) diff --git a/pollen-ui-riot-js/src/main/web/conf.js b/pollen-ui-riot-js/src/main/web/conf.js index 4c710cd8..3579cf63 100644 --- a/pollen-ui-riot-js/src/main/web/conf.js +++ b/pollen-ui-riot-js/src/main/web/conf.js @@ -2,6 +2,6 @@ window.pollenConf = { endPoint: "http://felteu:8888/pollen-rest-api", piwikUrl: "", // add the piwik url, eg: http://localhost/piwik< piwikSiteId: "", // add the site id, eg: 3 - defaultErrorTimeout: 15, + defaultMessageTimeout: 15, resourceMaxSize: 10000000 // octets => 10 Mo }; diff --git a/pollen-ui-riot-js/src/main/web/i18n.json b/pollen-ui-riot-js/src/main/web/i18n.json index 5f07ea76..266f64c7 100644 --- a/pollen-ui-riot-js/src/main/web/i18n.json +++ b/pollen-ui-riot-js/src/main/web/i18n.json @@ -37,6 +37,8 @@ "poll_clonePoll": "Cloner le sondage", "poll_deletePoll": "Supprimer le sondage", "poll_editPoll": "Modifier le sondage", + "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_settings": "Configuration", "poll_choices": "Choix", @@ -673,6 +675,8 @@ "header_createDatePoll": "New date poll", "home_createOtherPoll": "New standard poll", "home_createDatePoll": "New date poll", + "poll_creationSuccess": "Your poll {0} has been successfully created.", + "poll_saveSuccess": "Your poll {0} has been successfully saved.", "poll_description_cancel": "Cancel", "poll_description_next": "Next", "poll_description_title": "Title", diff --git a/pollen-ui-riot-js/src/main/web/js/Error.js b/pollen-ui-riot-js/src/main/web/js/Message.js similarity index 76% rename from pollen-ui-riot-js/src/main/web/js/Error.js rename to pollen-ui-riot-js/src/main/web/js/Message.js index b4b82f63..4f6d598d 100644 --- a/pollen-ui-riot-js/src/main/web/js/Error.js +++ b/pollen-ui-riot-js/src/main/web/js/Message.js @@ -23,21 +23,25 @@ if (!Object.values) { values.shim(); } -class Error { +class Message { - constructor(e, timeout) { - if (e instanceof Error) { - this.message = e.message; + constructor(e, type, timeout) { + if (e instanceof Message) { + this.content = e.content; + this.type = e.type; this.timeout = e.timeout; } else if (typeof e === "string" || e instanceof String) { - this.message = e; + this.content = e; } else { - this.message = Object.values(e).reduce((messages, messagesfield) => messages.concat(messagesfield), []); + this.content = Object.values(e).reduce((messages, messagesfield) => messages.concat(messagesfield), []); } if (!this.timeout) { this.timeout = timeout; } + if (!this.type) { + this.type = type; + } } } -module.exports = Error; +module.exports = Message; 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 c85ce33b..2f764188 100644 --- a/pollen-ui-riot-js/src/main/web/js/Poll.js +++ b/pollen-ui-riot-js/src/main/web/js/Poll.js @@ -9,7 +9,7 @@ let commentService = require("./CommentService"); let Pagination = require("./Pagination"); let resourceService = require("./ResourceService"); let bus = require("./PollenBus.js"); -let Error = require("./Error"); +let Message = require("./Message"); let pageTracker = require("./PageTracker"); class 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 ed5d35f6..44754127 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 @@ -21,7 +21,7 @@ require("./PollenWaiter.tag.html"); require("./PollenHeader.tag.html"); require("./PollenFooter.tag.html"); -require("./PollenErrorManager.tag.html"); +require("./PollenMessageManager.tag.html"); require("./SignIn.tag.html"); require("./SignUp.tag.html"); require("./SignCheck.tag.html"); @@ -48,7 +48,7 @@ require("./popup/InformationPopup.tag.html"); <PollenFooter/> - <PollenErrorManager/> + <PollenMessageManager/> <script type="es6"> let session = require("../js/Session"); @@ -235,7 +235,7 @@ require("./popup/InformationPopup.tag.html"); position: relative; } - pollenerrormanager { + pollenmessagemanager { position: fixed; bottom: 20px; right: 0px; diff --git a/pollen-ui-riot-js/src/main/web/tag/PollenErrorManager.tag.html b/pollen-ui-riot-js/src/main/web/tag/PollenErrorManager.tag.html deleted file mode 100644 index ea29f222..00000000 --- a/pollen-ui-riot-js/src/main/web/tag/PollenErrorManager.tag.html +++ /dev/null @@ -1,66 +0,0 @@ -<PollenErrorManager> - - <div each={error in errors} class="c-alert c-alert--error pollen-error" id="{error.id}"> - <button class="c-button c-button--close" onclick={closeError(error.id)}>×</button> - <span if={!Array.isArray(error.message)}> {error.message}</span> - <ul if={Array.isArray(error.message)}> - <li each={message in error.message}>{message}</li> - </ul> - </div> - - <script type="es6"> - let Error = require("../js/Error"); - let session = require("../js/Session"); - this.installBundle(session, "error_manager"); - - this.errorIndex = 0; - this.errors = []; - - this.handleErrors = (e) => { - var error = new Error(e); - if (!error.timeout) { - error.timeout = session.configuration.defaultErrorTimeout; - } - error.id = "error-" + this.errorIndex++; - - this.errors.push(error); - this.update(); - - setTimeout(() => { - this.closeError(error.id).apply(); - }, error.timeout * 1000); - }; - - this.on("mount", () => { - this.listen("error", this.handleErrors); - }); - - this.closeError = (errorId) => (e) => { - if (e) { - e.preventDefault(); - e.stopPropagation(); - } - - var errorElement = document.getElementById(errorId); - if (errorElement) { - errorElement.addEventListener("transitionend", () => { - errorElement.parentNode.removeChild(errorElement); - }); - errorElement.style.transform = "scaleY(0)"; - } - }; - - </script> - - <style> - .pollen-error { - width: 300px; - margin-right: 20px; - transform: scaleY(1); - transform-origin: 50% 100%; - transition: transform 0.5s; - } - - </style> - -</PollenErrorManager> diff --git a/pollen-ui-riot-js/src/main/web/tag/PollenMessageManager.tag.html b/pollen-ui-riot-js/src/main/web/tag/PollenMessageManager.tag.html new file mode 100644 index 00000000..8464d4e6 --- /dev/null +++ b/pollen-ui-riot-js/src/main/web/tag/PollenMessageManager.tag.html @@ -0,0 +1,66 @@ +<PollenMessageManager> + + <div each={message in messages} class="pollen-message c-alert c-alert--{message.type}" id="{message.id}"> + <button class="c-button c-button--close" onclick={closeMessage(message.id)}>×</button> + <span if={!Array.isArray(message.content)}> {message.content}</span> + <ul if={Array.isArray(message.content)}> + <li each={label in message.content}>{label}</li> + </ul> + </div> + + <script type="es6"> + let Message = require("../js/Message"); + let session = require("../js/Session"); + this.installBundle(session, "error_manager"); + + this.messageIndex = 0; + this.messages = []; + + this.handleMessages = (e) => { + var message = new Message(e); + if (!message.timeout) { + message.timeout = session.configuration.defaultMessageTimeout; + } + message.id = "message-" + this.messageIndex++; + + this.messages.push(message); + this.update(); + + setTimeout(() => { + this.closeMessage(message.id).apply(); + }, message.timeout * 1000); + }; + + this.on("mount", () => { + this.listen("message", this.handleMessages); + }); + + this.closeMessage = (messageId) => (e) => { + if (e) { + e.preventDefault(); + e.stopPropagation(); + } + + var messageElement = document.getElementById(messageId); + if (messageElement) { + messageElement.addEventListener("transitionend", () => { + messageElement.parentNode.removeChild(messageElement); + }); + messageElement.style.transform = "scaleY(0)"; + } + }; + + </script> + + <style> + .pollen-message { + width: 300px; + margin-right: 20px; + transform: scaleY(1); + transform-origin: 50% 100%; + transition: transform 0.5s; + } + + </style> + +</PollenMessageManager> diff --git a/pollen-ui-riot-js/src/main/web/tag/favoriteList/FavoriteList.tag.html b/pollen-ui-riot-js/src/main/web/tag/favoriteList/FavoriteList.tag.html index 09956572..f038cb97 100644 --- a/pollen-ui-riot-js/src/main/web/tag/favoriteList/FavoriteList.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/favoriteList/FavoriteList.tag.html @@ -306,7 +306,7 @@ require("./ChildListCard.tag.html"); this.refresh(); }, errors => { this.errors = errors; - this.bus.trigger("error", errors); + this.bus.trigger("message", errors); this.update(); }); } else { @@ -314,7 +314,7 @@ require("./ChildListCard.tag.html"); route("/favoriteLists/" + result.id); }, errors => { this.errors = errors; - this.bus.trigger("error", errors); + this.bus.trigger("message", errors); this.update(); }); } @@ -370,7 +370,7 @@ require("./ChildListCard.tag.html"); this.refresh(); }, errors => { this.addMemberErrors = errors; - this.bus.trigger("error", errors); + this.bus.trigger("message", errors); this.update(); }); }; @@ -385,7 +385,7 @@ require("./ChildListCard.tag.html"); this.refresh(); }, errors => { this.csvErrors = errors; - this.bus.trigger("error", errors); + this.bus.trigger("message", errors); this.update(); }); }; @@ -402,7 +402,7 @@ require("./ChildListCard.tag.html"); this.refresh(); }, errors => { this.ldapErrors = errors; - this.bus.trigger("error", errors); + this.bus.trigger("message", errors); this.update(); }); }; @@ -422,7 +422,7 @@ require("./ChildListCard.tag.html"); this.refresh(); }, errors => { this.childListErrors = errors; - this.bus.trigger("error", errors); + this.bus.trigger("message", errors); this.update(); }); }; diff --git a/pollen-ui-riot-js/src/main/web/tag/favoriteList/FavoriteLists.tag.html b/pollen-ui-riot-js/src/main/web/tag/favoriteList/FavoriteLists.tag.html index e3ecbdcf..3060fafd 100644 --- a/pollen-ui-riot-js/src/main/web/tag/favoriteList/FavoriteLists.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/favoriteList/FavoriteLists.tag.html @@ -136,7 +136,7 @@ require("./FavoriteListCard.tag.html"); this.refresh(); }, errors => { this.importErrors = errors; - this.bus.trigger("error", errors); + this.bus.trigger("message", errors); this.update(); }); }; 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 10972d11..d7dc2ee3 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 @@ -84,6 +84,7 @@ require("./Voters.tag.html"); this.session = require("../../js/Session"); this.installBundle(this.session, "poll"); this.form = require("../../js/PollForm"); + let Message = require("../../js/Message"); if (this.opts.pollId) { this.form.loadPoll(this.opts.pollId, this.opts.permission, this.opts.clone).then(() => { @@ -127,16 +128,20 @@ require("./Voters.tag.html"); this.savePoll = () => { this.callAfterSubmit = () => { let promiseSave; + let successMessage; if (this.form.creation) { promiseSave = this.form.create(); + successMessage = this._l("creationSuccess", this.form.model.title); } else { promiseSave = this.form.save(); + successMessage = this._l("saveSuccess", this.form.model.title); } promiseSave.then(() => { + this.bus.trigger("message", new Message(successMessage, "success")); let route = require("riot-route"); - route("poll/" + this.form.model.id + "/vote/" + this.form.model.permission); + route("poll/" + this.form.model.id + "/summary/" + this.form.model.permission); }, errors => { - this.bus.trigger("error", 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 1252bc14..5db2f96e 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 @@ -165,7 +165,7 @@ require("./Report.tag.html"); <script type="es6"> this.session = require("../../js/Session"); - let Error = require("../../js/Error"); + let Message = require("../../js/Message"); let route = require("riot-route"); this.installBundle(this.session, "poll"); @@ -183,7 +183,7 @@ 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))); + this.bus.trigger("message", new Message(this._l(error.status), "error")); route("/"); }); 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 be2481b1..eeeca6ad 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 @@ -111,7 +111,7 @@ require("../popup/QrCodeButton.tag.html"); <script type="es6"> this.session = require("../../js/Session"); - let Error = require("../../js/Error"); + let Message = require("../../js/Message"); let route = require("riot-route"); this.installBundle(this.session, "summary"); @@ -130,7 +130,7 @@ require("../popup/QrCodeButton.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))); + this.bus.trigger("message", new Message(this._l(error.status), "error")); route("/"); }).then(() => { this.poll.loadChoices(); 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 507aec83..0c6083b8 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 @@ -377,7 +377,7 @@ require("./Podium.tag.html"); this.choiceToAdd = this.poll.initChoice(this.choiceToAdd); this.update(); }, errors => { - this.bus.trigger("error", errors); + this.bus.trigger("message", errors); this.update(); }); }; diff --git a/pollen-ui-riot-js/src/main/web/tag/voterList/VoterListActions.tag.html b/pollen-ui-riot-js/src/main/web/tag/voterList/VoterListActions.tag.html index 7e3436eb..94559847 100644 --- a/pollen-ui-riot-js/src/main/web/tag/voterList/VoterListActions.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/voterList/VoterListActions.tag.html @@ -142,7 +142,7 @@ favoriteListsService.importFromVoterList(this.opts.voterList.id).then((result) => { route("/favoriteLists/" + result.id); }, errors => { - this.bus.trigger("error", errors); + this.bus.trigger("message", errors); this.parent.update(); }); } -- 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 feature/72_poll_creation_confirmation in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 49bc888da9c0a1ec5ba2152e7d9113d41da59086 Author: Kevin Morin <morin@codelutin.com> Date: Mon Jun 19 17:29:29 2017 +0200 fix bad merge --- pollen-ui-riot-js/src/main/web/js/Poll.js | 1 + 1 file changed, 1 insertion(+) 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 2f764188..0f5f7c05 100644 --- a/pollen-ui-riot-js/src/main/web/js/Poll.js +++ b/pollen-ui-riot-js/src/main/web/js/Poll.js @@ -391,6 +391,7 @@ class Poll { return service.ignoreReport(this.id, target.id, report.id, this.permission || ""); } return Promise.reject("Init poll after ignore report"); + } loadVoteCountingType() { voteCountingTypeService.getVoteCountingType(this.voteCountingType).then((voteCountingTypeValue) => { -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm