diff --git a/app/coffee/config.coffee b/app/coffee/config.coffee index d4a2952f..944e437e 100644 --- a/app/coffee/config.coffee +++ b/app/coffee/config.coffee @@ -25,13 +25,19 @@ class ConfigService extends taiga.Service defaults: { host: "localhost:8000" scheme: "http" - defaultLanguage: "en" + debug: false + + defaultLanguage: "en" languageOptions: { "es": "Spanish" "en": "English" } + pubblicRegisterEnabled: false + + termsOfServiceUrl: null + privacyPolicyUrl: null } initialize: (localconfig) -> @@ -41,11 +47,13 @@ class ConfigService extends taiga.Service get: (key, defaultValue=null) -> return @.config[key] || defaultValue + # Initialize config loading local configuration. init = ($log, localconfig, config) -> $log.debug("Initializing configuration", localconfig) config.initialize(localconfig) + module = angular.module("taigaConfig", ["taigaLocalConfig"]) module.service("$tgConfig", ConfigService) module.run(["$log", "localconfig", "$tgConfig", init]) diff --git a/app/coffee/modules/auth.coffee b/app/coffee/modules/auth.coffee index 4d89b2af..fc04a44f 100644 --- a/app/coffee/modules/auth.coffee +++ b/app/coffee/modules/auth.coffee @@ -191,8 +191,11 @@ module.directive("tgLogin", ["$tgAuth", "$tgConfirm", "$location", "$tgConfig", ## Register Directive ################### -RegisterDirective = ($auth, $confirm, $location) -> +RegisterDirective = ($auth, $confirm, $location, $config) -> link = ($scope, $el, $attrs) -> + $scope.privacyPolicyUrl = $config.get("privacyPolicyUrl") + $scope.termsOfServiceUrl = $config.get("termsOfServiceUrl") + $scope.data = {} form = $el.find("form").checksley() @@ -222,7 +225,7 @@ RegisterDirective = ($auth, $confirm, $location) -> return {link:link} -module.directive("tgRegister", ["$tgAuth", "$tgConfirm", "$location", RegisterDirective]) +module.directive("tgRegister", ["$tgAuth", "$tgConfirm", "$location", "$tgConfig", RegisterDirective]) ################### @@ -315,8 +318,11 @@ module.directive("tgChangePasswordFromRecovery", ["$tgAuth", "$tgConfirm", "$loc ## Invitation ################### -InvitationDirective = ($auth, $confirm, $location, $params) -> +InvitationDirective = ($auth, $confirm, $location, $params, $config) -> link = ($scope, $el, $attrs) -> + $scope.privacyPolicyUrl = $config.get("privacyPolicyUrl") + $scope.termsOfServiceUrl = $config.get("termsOfServiceUrl") + token = $params.token promise = $auth.getInvitation(token) @@ -392,7 +398,7 @@ InvitationDirective = ($auth, $confirm, $location, $params) -> return {link:link} -module.directive("tgInvitation", ["$tgAuth", "$tgConfirm", "$location", "$routeParams", +module.directive("tgInvitation", ["$tgAuth", "$tgConfirm", "$location", "$routeParams", "$tgConfig", InvitationDirective]) ################### diff --git a/app/partials/views/modules/invitation-register-form.jade b/app/partials/views/modules/invitation-register-form.jade index a721fcad..a76233ad 100644 --- a/app/partials/views/modules/invitation-register-form.jade +++ b/app/partials/views/modules/invitation-register-form.jade @@ -15,10 +15,14 @@ form.register-form a.button.button-register.button-gray(href="", title="Sign up") Sign up input(type="submit", style="display:none") - p.register-text - // TODO - span By clicking "Sign up", you agree to our
- a(href="", title="See terms of service") terms of service - span and - a(href="", title="See privacy policy") privacy policy. - + p.register-text(ng-if="termsOfServiceUrl && privacyPolicyUrl") + span By clicking "Sign up", you agree to our
+ a(tg-bo-href="termsOfServiceUrl", title="See terms of service", target="_blank") terms of service + span and + a(tg-bo-href="privacyPolicyUrl", title="See privacy policy", target="_blank") privacy policy. + p.register-text(ng-if="termsOfServiceUrl && !privacyPolicyUrl") + span By clicking "Sign up", you agree to our
+ a(tg-bo-href="termsOfServiceUrl", title="See terms of service", target="_blank") terms of service + p.register-text(ng-if="!termsOfServiceUrl && privacyPolicyUrl") + span By clicking "Sign up", you agree to our
+ a(tg-bo-href="privacyPolicyUrl", title="See privacy policy", target="_blank") privacy policy. diff --git a/app/partials/views/modules/register-form.jade b/app/partials/views/modules/register-form.jade index ee6036b0..e1d34cf5 100644 --- a/app/partials/views/modules/register-form.jade +++ b/app/partials/views/modules/register-form.jade @@ -15,10 +15,17 @@ div.register-form-container(tg-register) fieldset a.button.button-register.button-gray(href="", title="Sign up") Sign up input(type="submit", class="hidden") - p.register-text - // TODO + + p.register-text(ng-if="termsOfServiceUrl && privacyPolicyUrl") span By clicking "Sign up", you agree to our
- a(href="", title="See terms of service") terms of service + a(tg-bo-href="termsOfServiceUrl", title="See terms of service", target="_blank") terms of service span and - a(href="", title="See privacy policy") privacy policy. + a(tg-bo-href="privacyPolicyUrl", title="See privacy policy", target="_blank") privacy policy. + p.register-text(ng-if="termsOfServiceUrl && !privacyPolicyUrl") + span By clicking "Sign up", you agree to our
+ a(tg-bo-href="termsOfServiceUrl", title="See terms of service", target="_blank") terms of service + p.register-text(ng-if="!termsOfServiceUrl && privacyPolicyUrl") + span By clicking "Sign up", you agree to our
+ a(tg-bo-href="privacyPolicyUrl", title="See privacy policy", target="_blank") privacy policy. + a.register-text-top(href="", title="Login", tg-nav="login") Are you already registered? Log in diff --git a/config/main.coffee.example b/config/main.coffee.example index a8a71c8f..e44e4470 100644 --- a/config/main.coffee.example +++ b/config/main.coffee.example @@ -1,13 +1,16 @@ config = { host: "localhost:8000" scheme: "http" + debug: true - pubblicRegisterEnabled: true + defaultLanguage: "en" languageOptions: { "es": "Spanish" "en": "English" } + + pubblicRegisterEnabled: true } angular.module("taigaLocalConfig", []).value("localconfig", config)