Merge pull request #863 from taigaio/issue/3882/sign-up
Remove sign up link if not register enabledstable
commit
9510d573ff
|
@ -17,22 +17,16 @@
|
||||||
# File: navigation-bar.directive.coffee
|
# File: navigation-bar.directive.coffee
|
||||||
###
|
###
|
||||||
|
|
||||||
NavigationBarDirective = (currentUserService, navigationBarService,
|
NavigationBarDirective = (currentUserService, navigationBarService, locationService, navUrlsService, config) ->
|
||||||
locationService, navUrlsService) ->
|
|
||||||
|
|
||||||
link = (scope, el, attrs, ctrl) ->
|
link = (scope, el, attrs, ctrl) ->
|
||||||
scope.vm = {}
|
scope.vm = {}
|
||||||
|
|
||||||
scope.$on "$routeChangeSuccess", () ->
|
|
||||||
if locationService.path() == "/"
|
|
||||||
scope.vm.active = true
|
|
||||||
else
|
|
||||||
scope.vm.active = false
|
|
||||||
|
|
||||||
taiga.defineImmutableProperty(scope.vm, "projects", () -> currentUserService.projects.get("recents"))
|
taiga.defineImmutableProperty(scope.vm, "projects", () -> currentUserService.projects.get("recents"))
|
||||||
taiga.defineImmutableProperty(scope.vm, "isAuthenticated", () -> currentUserService.isAuthenticated())
|
taiga.defineImmutableProperty(scope.vm, "isAuthenticated", () -> currentUserService.isAuthenticated())
|
||||||
taiga.defineImmutableProperty(scope.vm, "isEnabledHeader", () -> navigationBarService.isEnabledHeader())
|
taiga.defineImmutableProperty(scope.vm, "isEnabledHeader", () -> navigationBarService.isEnabledHeader())
|
||||||
|
|
||||||
|
scope.vm.publicRegisterEnabled = config.get("publicRegisterEnabled")
|
||||||
|
|
||||||
scope.vm.login = ->
|
scope.vm.login = ->
|
||||||
nextUrl = encodeURIComponent(locationService.url())
|
nextUrl = encodeURIComponent(locationService.url())
|
||||||
locationService.url(navUrlsService.resolve("login"))
|
locationService.url(navUrlsService.resolve("login"))
|
||||||
|
@ -43,6 +37,12 @@ NavigationBarDirective = (currentUserService, navigationBarService,
|
||||||
locationService.url(navUrlsService.resolve("register"))
|
locationService.url(navUrlsService.resolve("register"))
|
||||||
locationService.search({next: nextUrl})
|
locationService.search({next: nextUrl})
|
||||||
|
|
||||||
|
scope.$on "$routeChangeSuccess", () ->
|
||||||
|
if locationService.path() == "/"
|
||||||
|
scope.vm.active = true
|
||||||
|
else
|
||||||
|
scope.vm.active = false
|
||||||
|
|
||||||
directive = {
|
directive = {
|
||||||
templateUrl: "navigation-bar/navigation-bar.html"
|
templateUrl: "navigation-bar/navigation-bar.html"
|
||||||
scope: {}
|
scope: {}
|
||||||
|
@ -55,7 +55,8 @@ NavigationBarDirective.$inject = [
|
||||||
"tgCurrentUserService",
|
"tgCurrentUserService",
|
||||||
"tgNavigationBarService",
|
"tgNavigationBarService",
|
||||||
"$tgLocation",
|
"$tgLocation",
|
||||||
"$tgNavUrls"
|
"$tgNavUrls",
|
||||||
|
"$tgConfig"
|
||||||
]
|
]
|
||||||
|
|
||||||
angular.module("taigaNavigationBar").directive("tgNavigationBar", NavigationBarDirective)
|
angular.module("taigaNavigationBar").directive("tgNavigationBar", NavigationBarDirective)
|
||||||
|
|
|
@ -3,27 +3,31 @@ nav.navbar(ng-if="vm.isEnabledHeader")
|
||||||
a.logo(
|
a.logo(
|
||||||
href="#",
|
href="#",
|
||||||
tg-nav="home",
|
tg-nav="home",
|
||||||
title="{{'PROJECT.NAVIGATION.HOMEPAGE' | translate}}")
|
title="{{'PROJECT.NAVIGATION.HOMEPAGE' | translate}}"
|
||||||
|
)
|
||||||
include ../../svg/logo.svg
|
include ../../svg/logo.svg
|
||||||
|
|
||||||
a(
|
a(
|
||||||
href="https://taiga.io/support/",
|
href="https://taiga.io/support/",
|
||||||
target="_blank",
|
target="_blank",
|
||||||
title="{{'PROJECT.NAVIGATION.HELP_TITLE' | translate}}",
|
title="{{'PROJECT.NAVIGATION.HELP_TITLE' | translate}}",
|
||||||
translate="PROJECT.NAVIGATION.HELP")
|
translate="PROJECT.NAVIGATION.HELP"
|
||||||
|
)
|
||||||
|
|
||||||
div.nav-right(ng-if="!vm.isAuthenticated")
|
div.nav-right(ng-if="!vm.isAuthenticated")
|
||||||
a.login(
|
a.login(
|
||||||
ng-click="vm.login()"
|
ng-click="vm.login()"
|
||||||
href="#",
|
href="#",
|
||||||
title="{{ 'LOGIN_COMMON.ACTION_SIGN_IN' | translate }}"
|
title="{{ 'LOGIN_COMMON.ACTION_SIGN_IN' | translate }}"
|
||||||
) {{ 'LOGIN_COMMON.ACTION_SIGN_IN' | translate }}
|
translate="LOGIN_COMMON.ACTION_SIGN_IN"
|
||||||
|
)
|
||||||
a.register(
|
a.register(
|
||||||
ng-click="vm.register()"
|
ng-click="vm.register()"
|
||||||
|
ng-if="vm.publicRegisterEnabled"
|
||||||
href="#",
|
href="#",
|
||||||
title="{{ 'REGISTER_FORM.ACTION_SIGN_UP' | translate }}"
|
title="{{ 'REGISTER_FORM.ACTION_SIGN_UP' | translate }}"
|
||||||
) {{ 'REGISTER_FORM.ACTION_SIGN_UP' | translate }}
|
translate="REGISTER_FORM.ACTION_SIGN_UP"
|
||||||
|
)
|
||||||
|
|
||||||
div.nav-right(ng-if="vm.isAuthenticated")
|
div.nav-right(ng-if="vm.isAuthenticated")
|
||||||
a(tg-nav="home",
|
a(tg-nav="home",
|
||||||
|
|
Loading…
Reference in New Issue