This is an automated email from the git hooks/post-receive script. New commit to branch feature/23_manage_notification in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 8189c5790c888339c60a0eccf4d90cf315211c13 Author: Kevin Morin <morin@codelutin.com> Date: Tue May 9 11:28:54 2017 +0200 refs #23 ajout des confs pour les notifications --- pollen-ui-riot-js/src/main/web/i18n.json | 20 +++++- .../src/main/web/tag/poll/Settings.tag.html | 78 +++++++++++++++++++++- 2 files changed, 95 insertions(+), 3 deletions(-) diff --git a/pollen-ui-riot-js/src/main/web/i18n.json b/pollen-ui-riot-js/src/main/web/i18n.json index d29d150..7685492 100644 --- a/pollen-ui-riot-js/src/main/web/i18n.json +++ b/pollen-ui-riot-js/src/main/web/i18n.json @@ -77,6 +77,7 @@ "poll_voteStart": "Les votes ont commencé, certaines options ne sont pas modifiables.", "poll_votes_title": "Votes", "poll_votes_deleteVote": "Supprimer le vote ?", + "poll_votes_anonymousVoter": "Anonyme", "poll_votes_authorPlaceHolder": "Renseignez votre nom", "poll_votes_toVote": "Voter", "poll_votes_tooManyChoicesSelected": "Trop de choix sélectionnés. Maximum :", @@ -194,6 +195,7 @@ "poll_settings_basic_usage_detail_closing": "Il peut être clos manuellement par son créateur", "poll_settings_basic_usage_detail_comments": "Tout le monde peut voir les votes et les commentaires", "poll_settings_basic_usage_detail_results": "Les résultats sont visibles de tous et disponible en continus", + "poll_settings_basic_usage_detail_notifications": "Aucune notification de vote et pas de rappel de la fin proche d'un sondage", "poll_settings_previous": "Précédent", "poll_settings_next": "Continuer", "poll_settings_skip": "Passer", @@ -206,11 +208,11 @@ "poll_settings_resultVisibility_everybody": "Tout le monde", "poll_settings_resultVisibility_voter": "Les participants", "poll_settings_commentVisibility": "Qui peut voir les commentaires ?", - "poll_settings_commentVisibility_nobody": "Personnes", + "poll_settings_commentVisibility_nobody": "Personne", "poll_settings_commentVisibility_everybody": "Tout le monde", "poll_settings_commentVisibility_voter": "Les participants", "poll_settings_voteVisibility": "Qui peut voir les votes ?", - "poll_settings_voteVisibility_anonymous": "Personnes", + "poll_settings_voteVisibility_anonymous": "Personne", "poll_settings_voteVisibility_creator": "Uniquement le créateur", "poll_settings_voteVisibility_everybody": "Tout le monde", "poll_settings_voteVisibility_voter": "Les participants", @@ -229,6 +231,7 @@ "poll_settings_nav_anonymousVote": "Anonimisation", "poll_settings_nav_comments": "Commentaires", "poll_settings_nav_commentVisibility": "Visiblité", + "poll_settings_nav_notification": "Notifications", "poll_settings_poll_configuration": "Configuration du sondage", "poll_settings_continuousResult": "Voir les résultats en continue", "poll_settings_choicesConfiguration": "Configuration des choix", @@ -257,6 +260,12 @@ "poll_settings_freePoll": "Tout le monde peut voter (Sondage public)", "poll_settings_restrictedPoll": "Seul les invités peuvent voter (Sondage privé)", "poll_settings_restrictedPoll_withMe": "Je participe au sondage", + "poll_settings_voteNotification": "Recevoir des notifications de vote", + "poll_settings_voteNotification_never": "Jamais", + "poll_settings_voteNotification_everyVote": "À chaque vote", + "poll_settings_voteNotification_dailySummary": "Un résumé une fois par jour", + "poll_settings_notifyMeBeforePollEnds": "Recevoir une notification avant la fin des votes", + "poll_settings_notifyMeHoursBeforePollEnds": "Combien d'heures avant ?", "poll_choices_title": "Liste des choix", "poll_choices_label": "Choix", "poll_choices_description": "Description", @@ -468,6 +477,7 @@ "poll_voteStart": "Votes are started, some options can't be updated.", "poll_votes_title": "Votes", "poll_votes_deleteVote": "Delete vote?", + "poll_votes_anonymousVoter": "Anonymous", "poll_votes_authorPlaceHolder": "Fill your name", "poll_votes_toVote": "Vote", "poll_votes_tooManyChoicesSelected": "Too many choices selected. Maximum:", @@ -639,6 +649,12 @@ "poll_settings_freePoll": "Everybody can vote (Public poll)", "poll_settings_restrictedPoll": "Only invited people can vote (Private poll)", "poll_settings_restrictedPoll_withMe": "I also want to participate", + "poll_settings_voteNotification": "Receive vote notifications", + "poll_settings_voteNotification_never": "Never", + "poll_settings_voteNotification_everyVote": "For every vote", + "poll_settings_voteNotification_dailySummary": "A daily summary", + "poll_settings_notifyMeBeforePollEnds": "Receive a notification before the end of the votes", + "poll_settings_notifyMeHoursBeforePollEnds": "How many hours before?", "poll_choices_title": "Choices List", "poll_choices_label": "Choice", "poll_choices_description": "Description", diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/Settings.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/Settings.tag.html index 90ed0c1..6426841 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/Settings.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/Settings.tag.html @@ -45,6 +45,7 @@ <li>{__.basic_usage_detail_closing}</li> <li>{__.basic_usage_detail_comments}</li> <li>{__.basic_usage_detail_results}</li> + <li>{__.basic_usage_detail_notifications}</li> </ul> </div> </div> @@ -192,7 +193,8 @@ id="endDate" value={form.model.endDate} class="c-field" - type="datetime-local"> + type="datetime-local" + onchange="{onEndDateChanged}"> </div> </div> <div class="o-form-element"> @@ -282,6 +284,49 @@ </div> </div> </div> + <hr> + <div class="form-section"> + <div class="section-title"> + <h4>{__.nav_notification}</h4> + </div> + <div class="section-content"> + <div class="o-form-element"> + <label class="c-label"> + {__.voteNotification} + </label> + <select class="c-field" + ref="voteNotification" + value={form.model.voteNotification} + disabled={!form.model.creatorEmail}> + <option value="NEVER">{__.voteNotification_never}</option> + <option value="EVERY_VOTE">{__.voteNotification_everyVote}</option> + <option value="DAILY_SUMMARY">{__.voteNotification_dailySummary}</option> + </select> + </div> + <div class="o-form-element"> + <label class="c-toggle c-toggle--info"> + {__.notifyMeBeforePollEnds} + <input type="checkbox" + checked={notifyMeBeforePollEnds} + onclick={toggleNotifyMeBeforePollEnds} + disabled={disableNotifyMeBeforePollEnds}> + <div class="c-toggle__track"> + <div class="c-toggle__handle"></div> + </div> + </label> + <div if={notifyMeBeforePollEnds}> + <label class="c-label"> + {__.notifyMeHoursBeforePollEnds} + </label> + <input type="number" + class="c-field" + ref="notifyMeHoursBeforePollEnds" + value={form.model.notifyMeHoursBeforePollEnds} + min="{notifyMeBeforePollEnds ? 1 : 0}"> + </div> + </div> + </div> + </div> </div> <script type="es6"> @@ -295,11 +340,21 @@ this.voteCountingTypes = new Map(this.form.voteCountingTypes.map((t) => [t.id.toString(), t])); this.canLimitNumberOfChoices = this.voteCountingTypes.get(this.form.model.voteCountingType.toString()).canLimitNumberOfChoices; this.form.model.votePeriod = this.form.model.beginDate || this.form.model.endDate; + this.notifyMeBeforePollEnds = this.form.model.creatorEmail && this.form.model.notifyMeHoursBeforePollEnds > 0; + this.disableNotifyMeBeforePollEnds = !this.form.model.creatorEmail || !this.form.model.votePeriod || !this.form.model.endDate; this.on("mount", () => { this.refs.voteCountingType.value = this.form.model.voteCountingType; + if (!this.form.model.creatorEmail) { + this.refs.voteNotification.value = "NEVER"; + } }); + this.updateDisableNotifyMeBeforePollEnds = () => { + this.disableNotifyMeBeforePollEnds = !this.form.model.creatorEmail || !this.form.model.votePeriod || !this.refs.endDate.value; + this.notifyMeBeforePollEnds &= !this.disableNotifyMeBeforePollEnds; + }; + this.toggleChoiceAddAllowed = () => { this.form.model.choiceAddAllowed = !this.form.model.choiceAddAllowed; }; @@ -313,8 +368,14 @@ this.toggleVotePeriod = () => { this.form.model.votePeriod = !this.form.model.votePeriod; + this.updateDisableNotifyMeBeforePollEnds(); }; + this.onEndDateChanged = () => { + + this.updateDisableNotifyMeBeforePollEnds(); + } + this.toggleAnonymousVote = () => { this.form.model.anonymousVoteAllowed = !this.form.model.anonymousVoteAllowed; }; @@ -337,6 +398,13 @@ this.form.model.limitChoices &= this.canLimitNumberOfChoices; }; + this.toggleNotifyMeBeforePollEnds = e => { + if (!this.notifyMeBeforePollEnds) { + this.refs.notifyMeHoursBeforePollEnds = undefined; + } + this.notifyMeBeforePollEnds = !this.notifyMeBeforePollEnds; + }; + this.submit = () => { if (!this.showOptions && this.form.creation) { this.form.setSettingsDefault(); @@ -358,6 +426,14 @@ this.form.model.endDate = this.refs.votePeriod.checked ? this.refs.endDate.value : undefined; this.form.model.continuousResults = this.refs.continuousResults.checked; + + this.form.model.voteNotification = this.refs.voteNotification.value; + this.form.model.notificationLocale = this.session.locale; + if (this.notifyMeBeforePollEnds) { + this.form.model.notifyMeHoursBeforePollEnds = this.refs.notifyMeHoursBeforePollEnds.value; + } else { + this.form.model.notifyMeHoursBeforePollEnds = 0; + } } }; -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.