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 1645f16ae56bb56aec8b69f8e33d8c2fc95119f8 Author: Kevin Morin <morin@codelutin.com> Date: Mon Sep 18 16:59:48 2017 +0200 fixes #101 nombre d'éléments dans les écrans de liste --- pollen-ui-riot-js/src/main/web/i18n/en.json | 21 +++-- pollen-ui-riot-js/src/main/web/i18n/fr.json | 29 ++++--- .../src/main/web/tag/admin/Users.tag.html | 34 +++++++- .../web/tag/favoriteList/FavoriteList.tag.html | 98 ++++++++++++++++++---- .../web/tag/favoriteList/FavoriteLists.tag.html | 32 ++++++- .../src/main/web/tag/poll/Polls.tag.html | 32 ++++++- 6 files changed, 204 insertions(+), 42 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 b162539b..fbde0ab4 100644 --- a/pollen-ui-riot-js/src/main/web/i18n/en.json +++ b/pollen-ui-riot-js/src/main/web/i18n/en.json @@ -161,8 +161,11 @@ "polls_name": "Name", "polls_sort": "Sort by", "polls_noPoll": "No poll", - "polls_one": "poll", - "polls_many": "polls", + "polls_one": "{0} poll", + "polls_many": "{0} polls", + "polls_noFound": "No found over ", + "polls_oneFound": "{0} found over ", + "polls_manyFound": "{0} founds over ", "signup_title": "Create an account", "signup_email": "Email", "signup_email_placeholder": "Enter your email", @@ -361,8 +364,11 @@ "poll_created_voteUrl": "Vote on poll", "users_title": "All users", "users_noUser": "No user", - "users_one": "user", - "users_many": "users", + "users_one": "{0} user", + "users_many": "{0} users", + "users_noFound": "No found over ", + "users_oneFound": "{0} found over ", + "users_manyFound": "{0} founds over ", "user_banned": "banned", "user_emailValidate": "email validation waiting", "user_emailIsValidate": "email validate", @@ -417,8 +423,11 @@ "choice_fileSizeMax_title": "File to big", "choice_fileSizeMax_message": "File \"{0}\" for size {1} can't be over {2}.", "favoriteList_title": "My favorite lists", - "favoriteList_one": "favorite list", - "favoriteList_many": "favorite lists", + "favoriteList_one": "{0} favorite list", + "favoriteList_many": "{0} favorite lists", + "favoriteList_noFound": "No found over ", + "favoriteList_oneFound": "{0} found over ", + "favoriteList_manyFound": "{0} founds over ", "favoriteList_addFavoriteList": "Add new favorite list", "favoriteList_export": "Export favorite lists", "favoriteList_children": "sub-lists", 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 3fea5fed..47f8b0d8 100644 --- a/pollen-ui-riot-js/src/main/web/i18n/fr.json +++ b/pollen-ui-riot-js/src/main/web/i18n/fr.json @@ -161,8 +161,11 @@ "polls_name": "Nom", "polls_sort": "Trier par", "polls_noPoll": "Aucun sondage", - "polls_one": "sondage", - "polls_many": "sondages", + "polls_one": "{0} sondage", + "polls_many": "{0} sondages", + "polls_noFound": "Aucun trouvé sur ", + "polls_oneFound": "{0} trouvé sur ", + "polls_manyFound": "{0} trouvés sur ", "signup_title": "Créer un compte", "signup_email": "Email", "signup_email_placeholder": "Entrez votre adresse email", @@ -361,8 +364,11 @@ "poll_created_voteUrl": "Voter", "users_title": "Les utilisateurs", "users_noUser": "Aucun utilisateur", - "users_one": "utilisateur", - "users_many": "utilisateurs", + "users_one": "{0} utilisateur", + "users_many": "{0} utilisateurs", + "users_noFound": "Aucun trouvé sur ", + "users_oneFound": "{0} trouvé sur ", + "users_manyFound": "{0} trouvés sur ", "user_banned": "Banni", "user_emailValidate": "En cours de validation", "user_emailIsValidate": "Courriel validé", @@ -417,14 +423,17 @@ "choice_fileSizeMax_title": "Fichier trop lourd", "choice_fileSizeMax_message": "Le fichier « {0} » de taille de {1} ne doit pas dépasser {2}.", "favoriteList_title": "Mes listes de votants", - "favoriteList_one": "liste de votants", - "favoriteList_many": "listes de votants", + "favoriteList_one": "{0} liste de votants", + "favoriteList_many": "{0} listes de votants", + "favoriteList_noFound": "Aucune trouvée sur ", + "favoriteList_oneFound": "{0} trouvée sur ", + "favoriteList_manyFound": "{0} trouvées sur ", "favoriteList_addFavoriteList": "Ajouter une nouvelle liste de votants", "favoriteList_export": "Exporter les listes de votants", - "favoriteList_children": "sous-listes", - "favoriteList_child": "sous-liste", - "favoriteList_members": "membres", - "favoriteList_member": "membre", + "favoriteList_children": "{0} sous-listes", + "favoriteList_child": "{0} sous-liste", + "favoriteList_members": "{0} membres", + "favoriteList_member": "{0} membre", "favoriteList_noMember": "Aucun membre", "favoriteList_new": "Nouvelle liste", "favoriteList_edit": "Modifier cette liste", diff --git a/pollen-ui-riot-js/src/main/web/tag/admin/Users.tag.html b/pollen-ui-riot-js/src/main/web/tag/admin/Users.tag.html index fa33c0f6..32954ce8 100644 --- a/pollen-ui-riot-js/src/main/web/tag/admin/Users.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/admin/Users.tag.html @@ -8,7 +8,7 @@ require("./UserCard.tag.html"); <div class="main-content"> <div class="c-alert c-alert--info"> - {count === 0 ? __.noUser : (count + " " + (count === 1 ? __.one : __.many))} + {getCountLabel()} </div> <Search onsearch="{refresh}" search="{search}" /> @@ -38,18 +38,46 @@ require("./UserCard.tag.html"); pageNumber: 0 }; this.search = {value: ""}; + this.count = 0; + this.filteredCount = 0; let userService = require("../../js/UserService"); + this.getCountLabel = () => { + let label; + if (this.count === 0) { + label = this._l("noUser"); + } else { + if (this.count === 1) { + label = this._l("one", this.count); + } else { + label = this._l("many", this.count); + } + if (this.filteredCount != this.count) { + if (this.filteredCount === 0) { + label = this._l("noFound") + label; + } else if (this.filteredCount === 1) { + label = this._l("oneFound", this.filteredCount) + label; + } else { + label = this._l("manyFound", this.filteredCount) + label; + } + } + } + return label; + }; + this.refresh = () => { this.refs.lazyLoad.reload(); }; this.lazyLoad = pagination => { return userService.users(pagination, this.search.value).then((result) => { - this.loaded = true; + if (!this.loaded) { + this.loaded = true; this.count = result.pagination.count; - this.update(); + } + this.filteredCount = result.pagination.count; + this.update(); return result; }); }; 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 1b3ec55f..cf8fd4f8 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 @@ -24,18 +24,10 @@ require("../components/LoadingCard.tag.html"); <div class="main-content"> <div class="c-alert c-alert--info"> - <span if={favoriteList.countChildren > 0}> - {favoriteList.countChildren} {favoriteList.countChildren > 1 ? __.children : __.child} - </span> - <span if={favoriteList.countChildren === 0 && favoriteList.countMembers == 0}> - {__.noMember} - </span> - <span if={favoriteList.countMembers > 0}> - {favoriteList.countMembers} {favoriteList.countMembers > 1 ? __.members : __.member} - </span> + {getCountLabel()} </div> - <Search onsearch={refresh} search={search}/> + <Search onsearch={refresh} search={search} if={favoriteList.countChildren + favoriteList.countMembers > 1}/> <LazyLoad pagination={pagination} onload={lazyLoad} load-size="20" ref="lazyLoad" class="elements"> <yield to="element"> @@ -91,21 +83,84 @@ require("../components/LoadingCard.tag.html"); pageNumber: 0 }; this.favoriteList = { - id: this.opts.favoriteListId + id: this.opts.favoriteListId, + countMembers: 0, + filteredCountMembers: 0, + countChildren: 0, + filteredCountChildren: 0 }; this.children = []; - favoriteListService.favoriteList(this.favoriteList.id).then(results => { - this.favoriteList = results; - this.loaded = true; - this.update(); - }); + this.getCountLabel = () => { + let label; + if (this.favoriteList.countChildren === 0 && this.favoriteList.countMembers == 0) { + label = this._l("noMember"); + + } else { + let childrenLabel = ""; + if (this.favoriteList.countChildren > 0) { + if (this.favoriteList.countChildren === 1) { + childrenLabel = this._l("child", this.favoriteList.countChildren); + } else { + childrenLabel = this._l("children", this.favoriteList.countChildren); + } + if (this.favoriteList.filteredCountChildren + && this.favoriteList.filteredCountChildren != this.favoriteList.countChildren + || this.favoriteList.filteredCountMembers + && this.favoriteList.filteredCountMembers != this.favoriteList.countMembers) { + if (this.favoriteList.filteredCountChildren === 0) { + childrenLabel = this._l("noFound") + childrenLabel; + } else if (this.favoriteList.filteredCountChildren === 1) { + childrenLabel = this._l("oneFound", this.favoriteList.filteredCountChildren) + childrenLabel; + } else { + childrenLabel = this._l("manyFound", this.favoriteList.filteredCountChildren) + childrenLabel; + } + } + childrenLabel += " / "; + } + + let membersLabel = ""; + if (this.favoriteList.countMembers > 0) { + if (this.favoriteList.countMembers === 1) { + membersLabel = this._l("member", this.favoriteList.countMembers); + } else { + membersLabel = this._l("members", this.favoriteList.countMembers); + } + if (this.favoriteList.filteredCountChildren + && this.favoriteList.filteredCountChildren != this.favoriteList.countChildren + || this.favoriteList.filteredCountMembers + && this.favoriteList.filteredCountMembers != this.favoriteList.countMembers) { + if (this.favoriteList.filteredCountMembers === 0) { + membersLabel = this._l("noFound") + membersLabel; + } else if (this.favoriteList.filteredCountMembers === 1) { + membersLabel = this._l("oneFound", this.favoriteList.filteredCountMembers) + membersLabel; + } else { + membersLabel = this._l("manyFound", this.favoriteList.filteredCountMembers) + membersLabel; + } + } + } + label = childrenLabel + membersLabel; + } + return label; + } + + this.reloadFavoriteListInfos = () => { + favoriteListService.favoriteList(this.favoriteList.id).then(results => { + this.favoriteList = results; + this.loaded = true; + console.log("reloadFavoriteListInfos"); + console.log(results); + this.update(); + }); + }; + this.reloadFavoriteListInfos(); this.search = {value: ""}; this.addMember = () => { this.refs.createMemberModal.open().then(() => { this.update(); + this.reloadFavoriteListInfos(); this.refresh(); }, () => {}); this.update(); @@ -114,6 +169,7 @@ require("../components/LoadingCard.tag.html"); this.importCsv = () => { this.refs.importCsvModal.open().then(() => { this.update(); + this.reloadFavoriteListInfos(); this.refresh(); }, () => {}); this.update(); @@ -122,6 +178,7 @@ require("../components/LoadingCard.tag.html"); this.importLdap = () => { this.refs.importLdapModal.open().then(() => { this.update(); + this.reloadFavoriteListInfos(); this.refresh(); }, () => {}); this.update(); @@ -130,6 +187,7 @@ require("../components/LoadingCard.tag.html"); this.createChildList = () => { this.refs.createChildListModal.open().then(() => { this.update(); + this.reloadFavoriteListInfos(); this.refresh(); }, () => {}); this.update(); @@ -140,7 +198,13 @@ require("../components/LoadingCard.tag.html"); }; this.lazyLoad = pagination => { - return favoriteListService.allChildren(this.favoriteList.id, pagination, this.search.value); + return favoriteListService.allChildren(this.favoriteList.id, pagination, this.search.value).then(results => { + let length = results.elements.length; + this.favoriteList.filteredCountChildren = results.elements.filter(element => element.child).length; + this.favoriteList.filteredCountMembers = length - this.favoriteList.filteredCountChildren; + this.update(); + return results; + }); }; </script> 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 db7706c8..dbe9237c 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 @@ -17,7 +17,7 @@ require("./FavoriteListEditModal.tag.html"); <div class="main-content"> <div class="c-alert c-alert--info"> - {count === 0 ? __.noFavoriteList : (count + " " + (count === 1 ? __.one : __.many))} + {getCountLabel()} <a class="c-button c-button--info" if={count > 0} href="{session.configuration.endPoint}/v1/favoriteLists/exports" @@ -27,7 +27,7 @@ require("./FavoriteListEditModal.tag.html"); </a> </div> - <Search onsearch="{refresh}" search="{search}" /> + <Search onsearch="{refresh}" search="{search}" if={count > 1}/> <LazyLoad pagination={pagination} onload={lazyLoad} load-size="20" ref="lazyLoad" class="elements"> <yield to="element"> @@ -81,8 +81,33 @@ require("./FavoriteListEditModal.tag.html"); pageNumber: 0 }; this.favoriteLists = []; + this.count = 0; + this.filteredCount = 0; this.importErrors = {}; + this.getCountLabel = () => { + let label; + if (this.count === 0) { + label = this._l("noFavoriteList"); + } else { + if (this.count === 1) { + label = this._l("one", this.count); + } else { + label = this._l("many", this.count); + } + if (this.filteredCount != this.count) { + if (this.filteredCount === 0) { + label = this._l("noFound") + label; + } else if (this.filteredCount === 1) { + label = this._l("oneFound", this.filteredCount) + label; + } else { + label = this._l("manyFound", this.filteredCount) + label; + } + } + } + return label; + }; + this.search = {value: ""}; this.refresh = () => { @@ -94,8 +119,9 @@ require("./FavoriteListEditModal.tag.html"); if (!this.loaded) { this.count = result.pagination.count; this.loaded = true; - this.update(); } + this.filteredCount = result.pagination.count + this.update(); return result; }); }; diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/Polls.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/Polls.tag.html index 8fb9e3e7..4ce12bf5 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/Polls.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/Polls.tag.html @@ -8,10 +8,10 @@ require("../components/Search.tag.html"); <div class="main-content"> <div class="c-alert c-alert--info"> - {count === 0 ? __.noPoll : (count + " " + (count === 1 ? __.one : __.many))} + {getCountLabel()} </div> - <Search onsearch="{refresh}" search="{search}" /> + <Search onsearch="{refresh}" search="{search}" if="{count > 1}"/> <LazyLoad pagination={pagination} onload={lazyLoad} load-size="20" ref="lazyLoad" class="elements"> <yield to="element"> @@ -63,9 +63,34 @@ require("../components/Search.tag.html"); pageNumber: 0 }; this.search = {value: ""}; + this.count = 0; + this.filteredCount = 0; let pollService = require("../../js/PollService"); + this.getCountLabel = () => { + let label; + if (this.count === 0) { + label = this._l("noPoll"); + } else { + if (this.count === 1) { + label = this._l("one", this.count); + } else { + label = this._l("many", this.count); + } + if (this.filteredCount != this.count) { + if (this.filteredCount === 0) { + label = this._l("noFound") + label; + } else if (this.filteredCount === 1) { + label = this._l("oneFound", this.filteredCount) + label; + } else { + label = this._l("manyFound", this.filteredCount) + label; + } + } + } + return label; + }; + this.refresh = () => { this.refs.lazyLoad.reload(); }; @@ -75,8 +100,9 @@ require("../components/Search.tag.html"); if (!this.loaded) { this.count = result.pagination.count; this.loaded = true; - this.update(); } + this.filteredCount = result.pagination.count; + this.update(); return result; }); }; -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.