Add links to external pages of terms of services and privacy policy

stable
David Barragán Merino 2014-08-05 10:56:05 +02:00
parent 8f5eead730
commit 276cf85369
5 changed files with 45 additions and 17 deletions

View File

@ -25,13 +25,19 @@ class ConfigService extends taiga.Service
defaults: { defaults: {
host: "localhost:8000" host: "localhost:8000"
scheme: "http" scheme: "http"
defaultLanguage: "en"
debug: false debug: false
defaultLanguage: "en"
languageOptions: { languageOptions: {
"es": "Spanish" "es": "Spanish"
"en": "English" "en": "English"
} }
pubblicRegisterEnabled: false pubblicRegisterEnabled: false
termsOfServiceUrl: null
privacyPolicyUrl: null
} }
initialize: (localconfig) -> initialize: (localconfig) ->
@ -41,11 +47,13 @@ class ConfigService extends taiga.Service
get: (key, defaultValue=null) -> get: (key, defaultValue=null) ->
return @.config[key] || defaultValue return @.config[key] || defaultValue
# Initialize config loading local configuration. # Initialize config loading local configuration.
init = ($log, localconfig, config) -> init = ($log, localconfig, config) ->
$log.debug("Initializing configuration", localconfig) $log.debug("Initializing configuration", localconfig)
config.initialize(localconfig) config.initialize(localconfig)
module = angular.module("taigaConfig", ["taigaLocalConfig"]) module = angular.module("taigaConfig", ["taigaLocalConfig"])
module.service("$tgConfig", ConfigService) module.service("$tgConfig", ConfigService)
module.run(["$log", "localconfig", "$tgConfig", init]) module.run(["$log", "localconfig", "$tgConfig", init])

View File

@ -191,8 +191,11 @@ module.directive("tgLogin", ["$tgAuth", "$tgConfirm", "$location", "$tgConfig",
## Register Directive ## Register Directive
################### ###################
RegisterDirective = ($auth, $confirm, $location) -> RegisterDirective = ($auth, $confirm, $location, $config) ->
link = ($scope, $el, $attrs) -> link = ($scope, $el, $attrs) ->
$scope.privacyPolicyUrl = $config.get("privacyPolicyUrl")
$scope.termsOfServiceUrl = $config.get("termsOfServiceUrl")
$scope.data = {} $scope.data = {}
form = $el.find("form").checksley() form = $el.find("form").checksley()
@ -222,7 +225,7 @@ RegisterDirective = ($auth, $confirm, $location) ->
return {link:link} 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 ## Invitation
################### ###################
InvitationDirective = ($auth, $confirm, $location, $params) -> InvitationDirective = ($auth, $confirm, $location, $params, $config) ->
link = ($scope, $el, $attrs) -> link = ($scope, $el, $attrs) ->
$scope.privacyPolicyUrl = $config.get("privacyPolicyUrl")
$scope.termsOfServiceUrl = $config.get("termsOfServiceUrl")
token = $params.token token = $params.token
promise = $auth.getInvitation(token) promise = $auth.getInvitation(token)
@ -392,7 +398,7 @@ InvitationDirective = ($auth, $confirm, $location, $params) ->
return {link:link} return {link:link}
module.directive("tgInvitation", ["$tgAuth", "$tgConfirm", "$location", "$routeParams", module.directive("tgInvitation", ["$tgAuth", "$tgConfirm", "$location", "$routeParams", "$tgConfig",
InvitationDirective]) InvitationDirective])
################### ###################

View File

@ -15,10 +15,14 @@ form.register-form
a.button.button-register.button-gray(href="", title="Sign up") Sign up a.button.button-register.button-gray(href="", title="Sign up") Sign up
input(type="submit", style="display:none") input(type="submit", style="display:none")
p.register-text p.register-text(ng-if="termsOfServiceUrl && privacyPolicyUrl")
// TODO span By clicking "Sign up", you agree to our <br />
span By clicking "Sign up", you agree to our <br /> a(tg-bo-href="termsOfServiceUrl", title="See terms of service", target="_blank") terms of service
a(href="", title="See terms of service") terms of service span and
span and a(tg-bo-href="privacyPolicyUrl", title="See privacy policy", target="_blank") privacy policy.
a(href="", title="See privacy policy") privacy policy. p.register-text(ng-if="termsOfServiceUrl && !privacyPolicyUrl")
span By clicking "Sign up", you agree to our <br />
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 <br />
a(tg-bo-href="privacyPolicyUrl", title="See privacy policy", target="_blank") privacy policy.

View File

@ -15,10 +15,17 @@ div.register-form-container(tg-register)
fieldset fieldset
a.button.button-register.button-gray(href="", title="Sign up") Sign up a.button.button-register.button-gray(href="", title="Sign up") Sign up
input(type="submit", class="hidden") 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 <br /> span By clicking "Sign up", you agree to our <br />
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 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 <br />
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 <br />
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 a.register-text-top(href="", title="Login", tg-nav="login") Are you already registered? Log in

View File

@ -1,13 +1,16 @@
config = { config = {
host: "localhost:8000" host: "localhost:8000"
scheme: "http" scheme: "http"
debug: true debug: true
pubblicRegisterEnabled: true
defaultLanguage: "en" defaultLanguage: "en"
languageOptions: { languageOptions: {
"es": "Spanish" "es": "Spanish"
"en": "English" "en": "English"
} }
pubblicRegisterEnabled: true
} }
angular.module("taigaLocalConfig", []).value("localconfig", config) angular.module("taigaLocalConfig", []).value("localconfig", config)