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 dc69fb7f1b1240950442d9bb1709d1d273a641f6 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Tue May 23 10:56:40 2017 +0200 participants a un sondage : ajout des actions en bas d'une liste, demande de confirmation avant --- pollen-ui-riot-js/src/main/web/i18n.json | 8 +- .../src/main/web/tag/popup/Modal.tag.html | 6 + .../src/main/web/tag/voterList/VoterList.tag.html | 152 +------------------ .../web/tag/voterList/VoterListActions.tag.html | 164 +++++++++++++++++++++ .../web/tag/voterList/VoterListMember.tag.html | 97 ++++++------ 5 files changed, 225 insertions(+), 202 deletions(-) diff --git a/pollen-ui-riot-js/src/main/web/i18n.json b/pollen-ui-riot-js/src/main/web/i18n.json index a3a3894..2b57c10 100644 --- a/pollen-ui-riot-js/src/main/web/i18n.json +++ b/pollen-ui-riot-js/src/main/web/i18n.json @@ -406,11 +406,13 @@ "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 : ", "voterList_member_name": "Nom", "voterList_member_email": "Courriel", "voterList_member_weight": "Poids", "voterList_member_delete": "Supprimer le participant", + "voterList_member_deleteMessage": "Supprimer le participant ?", "modal_cancel": "Annuler", "modal_ok": "Ok" }, @@ -809,11 +811,13 @@ "voterList_importFavoriteList": "Import favorite list", "voterList_importFavoriteList_none": "None favorite list saved", "voterList_mainList": "Poll main list : ", - "voterList_delete": "delete list", + "voterList_delete": "Delete list", + "voterList_deleteMessage": "Delete list ?", "voterList_member_name": "Name", "voterList_member_email": "Email", "voterList_member_weight": "Weight", - "voterList_member_delete": "delete member", + "voterList_member_delete": "Delete member", + "voterList_member_deleteMessage": "Delete member ?", "modal_cancel": "Annuler", "modal_ok": "Ok" } diff --git a/pollen-ui-riot-js/src/main/web/tag/popup/Modal.tag.html b/pollen-ui-riot-js/src/main/web/tag/popup/Modal.tag.html index 8ad00b8..9eedabe 100644 --- a/pollen-ui-riot-js/src/main/web/tag/popup/Modal.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/popup/Modal.tag.html @@ -56,4 +56,10 @@ </script> + <style> + .o-modal { + width: auto; + } + </style> + </modal> 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 7cbb624..1700c02 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 @@ -1,4 +1,5 @@ require("./VoterListMember.tag.html"); +require("./VoterListActions.tag.html"); require("../popup/Modal.tag.html"); <VoterList> @@ -34,55 +35,7 @@ require("../popup/Modal.tag.html"); </div> </div> </div> - <div class="voter-list-actions"> - <button class="c-button c-button--success" - type="button" - show={!opts.form.model.isClosed} - disabled={opts.form.model.isClosed} - onclick={addMember} - title={__.addMember}> - <i class="fa fa-plus" aria-hidden="true"></i> - <i class="fa fa-user" aria-hidden="true"></i> - </button> - <button class="c-button c-button--success" - type="button" - show={!opts.form.model.isClosed} - disabled={opts.form.model.isClosed} - onclick={addVoterList} - title={__.addVoterList}> - <i class="fa fa-plus" aria-hidden="true"></i> - <i class="fa fa-users" aria-hidden="true"></i> - </button> - - <button class="c-button c-button--success" - type="button" - onclick={importFavoriteList} - show={user && !opts.form.model.isClosed} - disabled={!user || opts.form.model.isClosed} - title={__.importFavoriteList}> - <i class="fa fa-arrow-down" aria-hidden="true"></i> - <i class="fa fa-users" aria-hidden="true"></i> - </button> - - <button class="c-button c-button--info" - type="button" - onclick={exportToFavoriteList} - show={user && !opts.voterList.temp} - disabled={!user || opts.voterList.temp} - title={__.exportFavoriteList}> - <i class="fa fa-arrow-up" aria-hidden="true"></i> - <i class="fa fa-users" aria-hidden="true"></i> - </button> - - <button class="c-button c-button--error" - type="button" - show={opts.voterList.parentId && !opts.form.model.isClosed} - disabled={!opts.voterList.parentId || opts.form.model.isClosed} - onclick={delete} - title={__.delete}> - <i class="fa fa-times" aria-hidden="true"></i> - </button> - </div> + <VoterListActions voter-list={opts.voterList} form={parent.opts.form}/> </div> </div> @@ -91,114 +44,33 @@ require("../popup/Modal.tag.html"); <VoterList each={voterlist in opts.voterList.subLists} voter-list={voterlist} form={parent.opts.form} ref="voterLists"/> <voterListmember each={member in opts.voterList.members} member={member} form={parent.opts.form} ref="voterListMembers"/> - + <VoterListActions voter-list={opts.voterList} form={parent.opts.form}/> </div> - <modal title={__.importFavoriteList} - ref="importFavoriteListModal"> - <div show={favoriteLists.length === 0}> - {__.importFavoriteList_none} - </div> - <select class="c-field" - show={favoriteLists.length > 0} - ref="selectFavoriteListToImport"> - <option each={favoriteList in parent.favoriteLists} - value={favoriteList.id}> - {favoriteList.name} - </option> - </select> - </modal> - <script type="es6"> let session = require("../../js/Session"); this.installBundle(session, "voterList"); let voterListService = require("../../js/VoterListService"); let favoriteListsService = require("../../js/FavoriteListService"); - let route = require("riot-route"); - this.favoriteLists = []; this.expand = false; - this.user = session.getUser(); - - this.onUserChange = user => { - this.user = user; - this.update(); - }; - - this.bus.on("user", this.onUserChange); - - this.on("before-unmount", () => { - this.bus.off("user", this.onUserChange); - }); this.toggleExpand = () => { if (this.expand) { this.expand = false; } else { - this.expandWithAdd(false, false); + this.expandable(); } }; - this.expandWithAdd = (addMember, addVoterList) => { - voterListService.loadList(this.opts.voterList).then(() => { - if (addMember) { - voterListService.addMember(this.opts.voterList); - } - if (addVoterList) { - voterListService.addVoterList(this.opts.voterList); - } + this.expandable = () => { + return voterListService.loadList(this.opts.voterList).then(() => { this.expand = true; this.update(); + return Promise.resolve(); }); }; - this.addMember = () => { - this.expandWithAdd(true, false); - }; - - this.addVoterList = () => { - this.expandWithAdd(false, true); - }; - - this.delete = () => { - if (this.opts.voterList.parentId) { - voterListService.deleteVoterList(this.opts.voterList); - this.parent.update(); - } - }; - - this.importFavoriteList = () => { - if (session.getUser()) { - let pagination = { - order: "name", - desc: false, - pageSize: -1, - pageNumber: 0 - }; - favoriteListsService.favoriteLists(pagination).then((result) => { - this.favoriteLists = result.elements; - this.refs.importFavoriteListModal.open().then(() => { - let favoriteListId = this.refs.importFavoriteListModal.refs.selectFavoriteListToImport.value; - voterListService.importFavoriteList(this.opts.voterList, favoriteListId).then(() => { - this.expandWithAdd(false, false); - }); - }, () => {}); - this.update(); - }); - } - }; - - this.exportToFavoriteList = () => { - if (session.getUser() && !this.opts.voterList.temp) { - favoriteListsService.importFromVoterList(this.opts.voterList.id).then((result) => { - route("/favoriteLists/" + result.id); - }, errors => { - this.bus.trigger("error", errors); - this.update(); - }); - } - }; - this.submit = () => { if (this.opts.voterList.parentId) { this.opts.voterList.name = this.refs.name.value; @@ -269,15 +141,5 @@ require("../popup/Modal.tag.html"); flex-grow: 0; } - .voter-list-actions { - margin-top: 0.5em; - display: flex; - justify-content: flex-end; - } - - .voter-list-actions .c-button { - margin-left: 5px; - } - </style> </voterList> 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 new file mode 100644 index 0000000..a25cca1 --- /dev/null +++ b/pollen-ui-riot-js/src/main/web/tag/voterList/VoterListActions.tag.html @@ -0,0 +1,164 @@ +<VoterListActions> + + <button class="c-button c-button--success" + type="button" + show={!opts.form.model.isClosed} + disabled={opts.form.model.isClosed} + onclick={addMember} + title={__.addMember}> + <i class="fa fa-plus" aria-hidden="true"></i> + <i class="fa fa-user" aria-hidden="true"></i> + </button> + <button class="c-button c-button--success" + type="button" + show={!opts.form.model.isClosed} + disabled={opts.form.model.isClosed} + onclick={addVoterList} + title={__.addVoterList}> + <i class="fa fa-plus" aria-hidden="true"></i> + <i class="fa fa-users" aria-hidden="true"></i> + </button> + + <button class="c-button c-button--success" + type="button" + onclick={importFavoriteList} + show={user && !opts.form.model.isClosed} + disabled={!user || opts.form.model.isClosed} + title={__.importFavoriteList}> + <i class="fa fa-arrow-down" aria-hidden="true"></i> + <i class="fa fa-users" aria-hidden="true"></i> + </button> + + <button class="c-button c-button--info" + type="button" + onclick={exportToFavoriteList} + show={user && !opts.voterList.temp} + disabled={!user || opts.voterList.temp} + title={__.exportFavoriteList}> + <i class="fa fa-arrow-up" aria-hidden="true"></i> + <i class="fa fa-users" aria-hidden="true"></i> + </button> + + <button class="c-button c-button--error" + type="button" + show={opts.voterList.parentId && !opts.form.model.isClosed} + disabled={!opts.voterList.parentId || opts.form.model.isClosed} + onclick={delete} + title={__.delete}> + <i class="fa fa-times" aria-hidden="true"></i> + </button> + + <modal title={__.importFavoriteList} + ref="importFavoriteListModal"> + <div show={favoriteLists.length === 0}> + {__.importFavoriteList_none} + </div> + <select class="c-field" + show={favoriteLists.length > 0} + ref="selectFavoriteListToImport"> + <option each={favoriteList in parent.favoriteLists} + value={favoriteList.id}> + {favoriteList.name} + </option> + </select> + </modal> + + <modal title={__.delete} + ref="deleteConfirm"> + {parent.__.deleteMessage} + </modal> + + <script type="es6"> + let session = require("../../js/Session"); + this.installBundle(session, "voterList"); + let voterListService = require("../../js/VoterListService"); + let favoriteListsService = require("../../js/FavoriteListService"); + let route = require("riot-route"); + + this.favoriteLists = []; + this.user = session.getUser(); + + this.onUserChange = user => { + this.user = user; + this.update(); + }; + + this.bus.on("user", this.onUserChange); + + this.on("before-unmount", () => { + this.bus.off("user", this.onUserChange); + }); + + this.addMember = () => { + this.parent.expandable().then(() => { + voterListService.addMember(this.opts.voterList); + this.parent.update(); + }); + }; + + this.addVoterList = () => { + this.parent.expandable().then(() => { + voterListService.addVoterList(this.opts.voterList); + this.parent.update(); + }); + }; + + this.delete = () => { + if (this.opts.voterList.parentId) { + this.refs.deleteConfirm.open().then(() => { + voterListService.deleteVoterList(this.opts.voterList); + this.parent.parent.update(); + }, () => {}); + } + }; + + this.importFavoriteList = () => { + if (session.getUser()) { + let pagination = { + order: "name", + desc: false, + pageSize: -1, + pageNumber: 0 + }; + favoriteListsService.favoriteLists(pagination).then((result) => { + this.favoriteLists = result.elements; + this.refs.importFavoriteListModal.open().then(() => { + let favoriteListId = this.refs.importFavoriteListModal.refs.selectFavoriteListToImport.value; + this.parent.expandable().then(() => { + voterListService.importFavoriteList(this.opts.voterList, favoriteListId).then(() => { + return this.parent.expandable(); + }); + }); + }, () => {}); + this.parent.update(); + }); + } + }; + + this.exportToFavoriteList = () => { + if (session.getUser() && !this.opts.voterList.temp) { + favoriteListsService.importFromVoterList(this.opts.voterList.id).then((result) => { + route("/favoriteLists/" + result.id); + }, errors => { + this.bus.trigger("error", errors); + this.parent.update(); + }); + } + }; + </script> + + <style> + + voterlistactions { + margin-top: 0.5em; + display: flex; + justify-content: flex-end; + } + + voterlistactions > .c-button { + margin-left: 5px; + } + + </style> + +</VoterListActions> diff --git a/pollen-ui-riot-js/src/main/web/tag/voterList/VoterListMember.tag.html b/pollen-ui-riot-js/src/main/web/tag/voterList/VoterListMember.tag.html index c44b57b..795afcf 100644 --- a/pollen-ui-riot-js/src/main/web/tag/voterList/VoterListMember.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/voterList/VoterListMember.tag.html @@ -1,43 +1,37 @@ <VoterlistMember> - <div class="voter-list-member-icone"> - <i class="fa fa-user" aria-hidden="true"></i> - </div> - <div class="voter-list-member-fields"> - <div class="c-input-group"> - <div class="o-field"> - <input class="c-field" - type="text" - name="name" - ref="name" - disabled={opts.form.model.isClosed} - value={opts.member.name} - required - placeholder={__.name}> - </div> - <div class="o-field"> - <input class="c-field" - type="email" - name="email" - ref="email" - disabled={opts.form.model.isClosed} - value={opts.member.email} - required - placeholder={__.email}> - </div> - <div class="o-field o-field--icon-left field-weight"> - <i class="fa fa-fw fa-balance-scale c-icon" aria-hidden="true"></i> - <input class="c-field" - type="number" - name="weight" - ref="weight" - disabled={opts.form.model.isClosed} - value={opts.member.weight} - required - placeholder={__.weight}> - </div> + <div class="c-input-group"> + <div class="o-field o-field--icon-left "> + <i class="fa fa-user c-icon" aria-hidden="true"></i> + <input class="c-field" + type="text" + name="name" + ref="name" + disabled={opts.form.model.isClosed} + value={opts.member.name} + required + placeholder={__.name}> + </div> + <div class="o-field"> + <input class="c-field" + type="email" + name="email" + ref="email" + disabled={opts.form.model.isClosed} + value={opts.member.email} + required + placeholder={__.email}> + </div> + <div class="o-field o-field--icon-left field-weight"> + <i class="fa fa-fw fa-balance-scale c-icon" aria-hidden="true"></i> + <input class="c-field" + type="number" + name="weight" + ref="weight" + disabled={opts.form.model.isClosed} + value={opts.member.weight} + required + placeholder={__.weight}> </div> - </div> - <div class="voter-list-member-actions"> <button class="c-button c-button--error" type="button" show={!opts.form.model.isClosed} @@ -48,6 +42,11 @@ </button> </div> + <modal title={__.delete} + ref="deleteConfirm"> + {parent.__.deleteMessage} + </modal> + <script type="es6"> let session = require("../../js/Session"); this.installBundle(session, "voterList_member"); @@ -55,8 +54,10 @@ this.delete = () => { - voterListService.deleteMember(this.opts.member); - this.parent.update(); + this.refs.deleteConfirm.open().then(() => { + voterListService.deleteMember(this.opts.member); + this.parent.update(); + }, () => {}); }; this.submit = () => { @@ -70,18 +71,8 @@ <style> voterlistmember { - display: flex; + display: block; margin: 5px auto; - border-radius: 4px; - border: 1px solid #13a2ff; - box-shadow: 0 0 1px hsla(0,0%,7%,.6); - padding: 0.5em; - color: #13a2ff; - } - - .voter-list-member-icone { - margin: auto 5px auto 0; - font-size: 1.2em; } .voter-list-member-fields { @@ -93,9 +84,5 @@ flex-grow: 0; } - .voter-list-member-actions { - margin-left: 5px; - } - </style> </VoterlistMember> -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.