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 00f2c6af9ac54c3d1b803f4d262544260b48fc37 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Thu Sep 7 11:17:19 2017 +0200 Pour les participant d'un sondage, ne pas proposer d'inporter une list de favoris si l'utilisateur n'en a pas définis (ref #132) --- pollen-ui-riot-js/src/main/web/i18n/en.json | 1 - pollen-ui-riot-js/src/main/web/i18n/fr.json | 1 - .../tag/voterList/ImportFavoritListModal.tag.html | 29 +++++----------------- .../src/main/web/tag/voterList/VoterList.tag.html | 25 ++++++++++++++++--- .../i18n/pollen-votecounting-api_fr_FR.properties | 2 +- 5 files changed, 28 insertions(+), 30 deletions(-) diff --git a/pollen-ui-riot-js/src/main/web/i18n/en.json b/pollen-ui-riot-js/src/main/web/i18n/en.json index 16119427..26bedde7 100644 --- a/pollen-ui-riot-js/src/main/web/i18n/en.json +++ b/pollen-ui-riot-js/src/main/web/i18n/en.json @@ -481,7 +481,6 @@ "voterList_addVoterList": "Add sub-list", "voterList_exportFavoriteList": "Export to new favorite list", "voterList_importFavoriteList": "Import favorite list", - "voterList_importFavoriteList_none": "None favorite list saved", "voterList_delete": "Delete list", "voterList_deleteMessage": "Delete list ?", "voterList_mainList": "Poll main list : ", diff --git a/pollen-ui-riot-js/src/main/web/i18n/fr.json b/pollen-ui-riot-js/src/main/web/i18n/fr.json index 00ac76f8..1893e0eb 100644 --- a/pollen-ui-riot-js/src/main/web/i18n/fr.json +++ b/pollen-ui-riot-js/src/main/web/i18n/fr.json @@ -481,7 +481,6 @@ "voterList_addVoterList": "Ajouter une sous-liste", "voterList_exportFavoriteList": "Exporter dans une nouvelle liste de votants", "voterList_importFavoriteList": "Importer une liste de votants", - "voterList_importFavoriteList_none": "Aucune liste de votants enregistrées", "voterList_delete": "Supprimer la liste", "voterList_deleteMessage": "Supprimer la liste ?", "voterList_mainList": "Liste principale du sondage : ", diff --git a/pollen-ui-riot-js/src/main/web/tag/voterList/ImportFavoritListModal.tag.html b/pollen-ui-riot-js/src/main/web/tag/voterList/ImportFavoritListModal.tag.html index d3ed3cc0..a6001128 100644 --- a/pollen-ui-riot-js/src/main/web/tag/voterList/ImportFavoritListModal.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/voterList/ImportFavoritListModal.tag.html @@ -2,21 +2,17 @@ require("../popup/Modal.tag.html"); <ImportFavoritListModal> - <modal header={__.importFavoriteList} + <Modal header={__.importFavoriteList} onsubmit={import} - ref="importFavoriteListModal"> - <div show={favoriteLists.length === 0}> - {__.importFavoriteList_none} - </div> + ref="modal"> <select class="c-field" - show={favoriteLists.length > 0} ref="selectFavoriteListToImport"> - <option each={favoriteList in parent.favoriteLists} + <option each={favoriteList in parent.opts.favoriteLists} value={favoriteList.id}> {favoriteList.name} </option> </select> - </modal> + </Modal> <script type="es6"> let session = require("../../js/Session"); @@ -24,25 +20,12 @@ require("../popup/Modal.tag.html"); let favoriteListService = require("../../js/FavoriteListService"); let voterListService = require("../../js/VoterListService"); - this.favoriteLists = []; - this.open = () => { - let pagination = { - order: "name", - desc: false, - pageSize: -1, - pageNumber: 0 - }; - return favoriteListService.favoriteLists(pagination).then((result) => { - this.favoriteLists = result.elements; - let promise = this.refs.importFavoriteListModal.open(); - this.parent.update(); - return promise; - }); + return this.refs.modal.open(); }; this.import = () => { - let favoriteListId = this.refs.importFavoriteListModal.refs.selectFavoriteListToImport.value; + let favoriteListId = this.refs.modal.refs.selectFavoriteListToImport.value; return voterListService.importFavoriteList(this.opts.voterList, favoriteListId).then(() => { this.errors = {}; this.update(); diff --git a/pollen-ui-riot-js/src/main/web/tag/voterList/VoterList.tag.html b/pollen-ui-riot-js/src/main/web/tag/voterList/VoterList.tag.html index 52aacacc..eb45e0c0 100644 --- a/pollen-ui-riot-js/src/main/web/tag/voterList/VoterList.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/voterList/VoterList.tag.html @@ -43,7 +43,7 @@ require("../components/ContextualMenu.tag.html"); <i class="fa fa-users" aria-hidden="true"></i> {parent.__.addVoterList} </a> - <a if={parent.user} + <a if={parent.user && parent.favoriteLists.length} onclick={parent.importFavoriteList} > <i class="fa fa-arrow-down" aria-hidden="true"></i> <i class="fa fa-users" aria-hidden="true"></i> @@ -71,16 +71,18 @@ require("../components/ContextualMenu.tag.html"); voter-list={opts.form.currentVoterList}/> <ImportFavoritListModal ref="importFavoriteListModal" - voter-list={opts.form.currentVoterList}/> + voter-list={opts.form.currentVoterList} + favorite-lists={favoriteLists}/> <script type="es6"> let session = require("../../js/Session"); this.installBundle(session, "voterList"); let voterListService = require("../../js/VoterListService"); - let favoriteListsService = require("../../js/FavoriteListService"); + let favoriteListService = require("../../js/FavoriteListService"); let route = require("riot-route"); this.user = session.getUser(); + this.favoriteLists = []; this.onUserChange = user => { this.user = user; @@ -119,6 +121,19 @@ require("../components/ContextualMenu.tag.html"); this.update(); }; + this.loadFavoriteList = () => { + let pagination = { + order: "name", + desc: false, + pageSize: -1, + pageNumber: 0 + }; + favoriteListService.favoriteLists(pagination).then((result) => { + this.favoriteLists = result.elements; + this.update(); + }); + }; + this.importFavoriteList = () => { this.refs.importFavoriteListModal.open().then(() => { this.update(); @@ -128,7 +143,7 @@ require("../components/ContextualMenu.tag.html"); this.exportToFavoriteList = () => { if (session.getUser() && !this.opts.form.currentVoterList.temp) { - favoriteListsService.importFromVoterList(this.opts.form.currentVoterList.id).then((result) => { + favoriteListService.importFromVoterList(this.opts.form.currentVoterList.id).then((result) => { route("/favoriteLists/" + result.id); }, errors => { this.bus.trigger("message", errors, "error"); @@ -155,6 +170,8 @@ require("../components/ContextualMenu.tag.html"); this.opts.form.mainVoterList.name = this.__.mainList + this.opts.form.model.title; }; + this.loadFavoriteList(); + </script> <style> diff --git a/pollen-votecounting-api/src/main/resources/i18n/pollen-votecounting-api_fr_FR.properties b/pollen-votecounting-api/src/main/resources/i18n/pollen-votecounting-api_fr_FR.properties index eda9c200..e2fa489c 100644 --- a/pollen-votecounting-api/src/main/resources/i18n/pollen-votecounting-api_fr_FR.properties +++ b/pollen-votecounting-api/src/main/resources/i18n/pollen-votecounting-api_fr_FR.properties @@ -1 +1 @@ -pollen.voteCountingType.help=Vote %s \: %s +pollen.voteCountingType.help=Méthode %s \: %s -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.