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: {
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])

View File

@ -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])
###################

View File

@ -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 <br />
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 <br />
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 <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
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 <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
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

View File

@ -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)