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 479808da9d961edc6a8817e1e5ff86a66e88240d Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Thu Sep 14 11:25:15 2017 +0200 ne pas afficher l'acceptation des CGU si pas de CGU (ref #141) --- pollen-ui-riot-js/src/main/web/js/Session.js | 10 ++++++++++ pollen-ui-riot-js/src/main/web/tag/PollenFooter.tag.html | 5 ++--- .../src/main/web/tag/components/GtuValidation.tag.html | 8 ++++++-- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/pollen-ui-riot-js/src/main/web/js/Session.js b/pollen-ui-riot-js/src/main/web/js/Session.js index 363d7f60..9155c4eb 100644 --- a/pollen-ui-riot-js/src/main/web/js/Session.js +++ b/pollen-ui-riot-js/src/main/web/js/Session.js @@ -21,6 +21,7 @@ */ let singleton = require("./Singleton"); let authService = require("./AuthService"); +let resourceService = require("./ResourceService"); let bus = require("./PollenBus.js"); let logger = require("./Logger"); let pageTracker = require("./PageTracker"); @@ -84,10 +85,12 @@ class Session { this.user = null; bus.trigger("user", this.user, oldUser); }); + this.isGtu = false; } start() { this.updateUser(); + this.updateGtu(); } updateUser() { @@ -100,6 +103,13 @@ class Session { } } + updateGtu() { + resourceService.isGtu().then(result => { + this.isGtu = result; + bus.trigger("isGtu", this.isGtu); + }); + } + getUser() { return this.user; } diff --git a/pollen-ui-riot-js/src/main/web/tag/PollenFooter.tag.html b/pollen-ui-riot-js/src/main/web/tag/PollenFooter.tag.html index acbcf0e5..131d505b 100644 --- a/pollen-ui-riot-js/src/main/web/tag/PollenFooter.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/PollenFooter.tag.html @@ -25,7 +25,7 @@ <a href="http://list.chorem.org/cgi-bin/mailman/listinfo/pollen-users">{__.contact}</a> <a href="https://gitlab.nuiton.org/chorem/pollen">{__.participate}</a> <a href="http://www.gnu.org/licenses/agpl.html">{__.license}</a> - <a if={isGtu} href="{session.configuration.endPoint}/v1/gtu" target="_blank">{__.gtu}</a> + <a if={session.isGtu} href="{session.configuration.endPoint}/v1/gtu" target="_blank">{__.gtu}</a> <a href="http://www.codelutin.com/" target="_blank">Code Lutin</a> </div> @@ -34,8 +34,7 @@ let resourceService = require("../js/ResourceService"); this.installBundle(this.session, "footer"); - resourceService.isGtu().then(result => { - this.isGtu = result; + this.listen("isGtu", () => { this.update(); }); 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 index 45c6307e..dce2e05a 100644 --- 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 @@ -1,5 +1,5 @@ <GtuValidation> - <div class="o-form-element"> + <div class="o-form-element" if={session.isGtu}> <label class="c-field c-field--choice gtu-validation"> <input type="checkbox" ref="validationCheckbox" @@ -20,9 +20,13 @@ this.installBundle(this.session, "gtu_validation"); this.value = () => { - return this.refs.validationCheckbox.checked; + return this.session.isGtu && this.refs.validationCheckbox.checked; }; + this.listen("isGtu", () => { + this.update(); + }); + </script> <style> -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.