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 e0f6d81ee723af886fc10ea2bfb53846f990a099 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Tue Sep 12 14:28:58 2017 +0200 gestion des CGU (ref #141) --- .../src/main/web/tag/admin/GtuCard.tag.html | 122 +++++++++++++++++++++ .../src/main/web/tag/admin/Gtus.tag.html | 86 +++++++++++++++ .../main/web/tag/components/GtuValidation.tag.html | 35 ++++++ .../src/main/web/tag/popup/GtuChangeModal.tag.html | 54 +++++++++ 4 files changed, 297 insertions(+) diff --git a/pollen-ui-riot-js/src/main/web/tag/admin/GtuCard.tag.html b/pollen-ui-riot-js/src/main/web/tag/admin/GtuCard.tag.html new file mode 100644 index 00000000..3d4123cc --- /dev/null +++ b/pollen-ui-riot-js/src/main/web/tag/admin/GtuCard.tag.html @@ -0,0 +1,122 @@ +<GtuCard> + + <div class="card-actions"> + <a class="error" + title={__.delete} + onclick={deleteGtu}> + <i class="fa fa-times"></i> + </a> + </div> + + <div class="card-content"> + + <div class="gtu-name" + title={opts.gtu.name}> + {opts.gtu.name} + </div> + + <div class="gtu-date"> + {formatDate(opts.gtu.uploadDate)} + </div> + + <div class="gtu-badges"> + <span class="c-badge c-badge--rounded c-badge--success" + if={opts.gtu.current}> + <i class="fa fa-cog"/> {__.current} + </span> + </div> + + <a class="c-button c-button--info gtu-download" + href="{session.configuration.endPoint}/v1/resources/{opts.gtu.id}/download" + target="_blank"> + <i class="fa fa-download"></i> + {__.download} + </a> + </div> + + <script type="es6"> + this.session = require("../../js/Session"); + let resourceService = require("../../js/ResourceService"); + this.installBundle(this.session, "gtu"); + + this.deleteGtu = (e) => { + e.preventDefault(); + e.stopPropagation(); + this.confirm(this.__.deleteGtu).then((confirm) => { + if (confirm) { + resourceService.delete(this.opts.gtu.id).then(() => { + this.opts.onGtuChange(); + }); + } + }); + }; + + </script> + + <style> + + gtucard { + position: relative; + display: block; + padding: 5px; + margin: 10px; + box-shadow: 0 0 10px hsla(0,0%,7%,.6); + width: 300px; + overflow: hidden; + } + + .card-actions { + position: absolute; + top: 0; + right: 0; + transform: translate3d(16px, 0px, 0px); + transition: transform 0.6s; + } + + gtucard:hover .card-actions { + transform: translate3d(0px, 0px, 0px); + } + + .card-content { + display: flex; + flex-direction: column; + align-items: flex-start; + } + + .card-content > * { + margin-bottom: 10px; + } + + .gtu-name { + width: 100%; + font-size: 1.5em; + height: 1em; + text-align: center; + } + + .gtu-date { + font-style: italic; + width: 100%; + height: 1em; + text-align: center; + } + + .gtu-name, + .gtu-date { + overflow: hidden; + text-overflow: ellipsis; + } + + .gtu-download { + align-self: center; + } + + .gtu-badges { + width: 100%; + display: flex; + justify-content: space-around; + height: 1.5em; + } + + </style> +</GtuCard> diff --git a/pollen-ui-riot-js/src/main/web/tag/admin/Gtus.tag.html b/pollen-ui-riot-js/src/main/web/tag/admin/Gtus.tag.html new file mode 100644 index 00000000..83a610e7 --- /dev/null +++ b/pollen-ui-riot-js/src/main/web/tag/admin/Gtus.tag.html @@ -0,0 +1,86 @@ +require("./GtuCard.tag.html"); +<Gtus> + <div class="container" show="{loaded}"> + <h1>{__.title}</h1> + + <div class="main-content"> + <div class="c-alert c-alert--info"> + {count === 0 ? __.noGtu : (count + " " + (count === 1 ? __.one : __.many))} + </div> + + <div class="elements"> + <div class="element" each={element in gtus}> + <GtuCard gtu={element} on-gtu-change={parent.refresh}/> + </div> + </div> + + <div class="actions-right"> + <div> + <button type="button" + class="c-button c-button--success" + onclick="{addGtu}"> + <i class="fa fa-upload"/> + {__.add} + </button> + + <input type="file" + class="hidden" + ref="choiceGtu" + onchange={onGtuInputChange}/> + </div> + </div> + + + </div> + </div> + + <script type="es6"> + this.loaded = false; + let session = require("../../js/Session"); + this.installBundle(session, "gtus"); + + let resourceService = require("../../js/ResourceService"); + + this.gtus = []; + this.count = 0; + this.refresh = () => { + resourceService.gtus().then(result => { + this.gtus = result; + this.count = result.length; + this.loaded = true; + this.update(); + }); + }; + + this.addGtu = () => { + this.refs.choiceGtu.click(); + }; + + this.onGtuInputChange = () => { + let gtuFile = this.refs.choiceGtu.files[0]; + if (gtuFile) { + this.confirm(this.__.addGtu, this.__.add, "success").then(confirm => { + if (confirm) { + resourceService.create(gtuFile, "GTU").then(() => { + this.refresh(); + }); + } + }); + } + }; + + this.refresh(); + + </script> + <style> + .elements { + display: flex; + flex-wrap: wrap; + justify-content: flex-start; + } + + .hidden { + display: none; + } + </style> +</Gtus> diff --git a/pollen-ui-riot-js/src/main/web/tag/components/GtuValidation.tag.html b/pollen-ui-riot-js/src/main/web/tag/components/GtuValidation.tag.html new file mode 100644 index 00000000..45c6307e --- /dev/null +++ b/pollen-ui-riot-js/src/main/web/tag/components/GtuValidation.tag.html @@ -0,0 +1,35 @@ +<GtuValidation> + <div class="o-form-element"> + <label class="c-field c-field--choice gtu-validation"> + <input type="checkbox" + ref="validationCheckbox" + required + onclick={validationClick}> + {__.before} + <a class="c-link" + href="{session.configuration.endPoint}/v1/gtu" + target="_blank"> + {__.link} + </a> + {__.after} + </label> + </div> + + <script type="es6"> + this.session = require("../../js/Session"); + this.installBundle(this.session, "gtu_validation"); + + this.value = () => { + return this.refs.validationCheckbox.checked; + }; + + </script> + + <style> + .c-field.c-field--choice.gtu-validation { + width: 100%; + text-align: center; + } + </style> + +</GtuValidation> diff --git a/pollen-ui-riot-js/src/main/web/tag/popup/GtuChangeModal.tag.html b/pollen-ui-riot-js/src/main/web/tag/popup/GtuChangeModal.tag.html new file mode 100644 index 00000000..c1b0ba31 --- /dev/null +++ b/pollen-ui-riot-js/src/main/web/tag/popup/GtuChangeModal.tag.html @@ -0,0 +1,54 @@ +/*- + * #%L + * Pollen :: UI (Riot Js) + * %% + * Copyright (C) 2009 - 2017 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ + require("../components/GtuValidation.tag.html"); + require("./Modal.tag.html"); +<GtuChangeModal> + <Modal ref="modal" header={__.title} onsubmit={submit} label={__.action}> + <GtuValidation /> + </Modal> + + <script type="es6"> + let session = require("../../js/Session"); + let userService = require("../../js/UserService"); + + this.installBundle(session, "gtu_change"); + + this.open = () => { + let promise = this.refs.modal.open().then(() => { + this.update(); + }, () => {}); + this.update(); + return promise; + }; + + this.submit = () => { + return userService.gtuValidate(); + }; + + this.listen("user", user => { + if (user && !user.gtuValidated) { + this.open(); + } + }); + + </script> + +</GtuChangeModal> -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.