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
|
||||
###
|
||||
|
||||
NavigationBarDirective = (currentUserService, navigationBarService,
|
||||
locationService, navUrlsService) ->
|
||||
|
||||
NavigationBarDirective = (currentUserService, navigationBarService, locationService, navUrlsService, config) ->
|
||||
link = (scope, el, attrs, ctrl) ->
|
||||
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, "isAuthenticated", () -> currentUserService.isAuthenticated())
|
||||
taiga.defineImmutableProperty(scope.vm, "isEnabledHeader", () -> navigationBarService.isEnabledHeader())
|
||||
|
||||
scope.vm.publicRegisterEnabled = config.get("publicRegisterEnabled")
|
||||
|
||||
scope.vm.login = ->
|
||||
nextUrl = encodeURIComponent(locationService.url())
|
||||
locationService.url(navUrlsService.resolve("login"))
|
||||
|
@ -43,6 +37,12 @@ NavigationBarDirective = (currentUserService, navigationBarService,
|
|||
locationService.url(navUrlsService.resolve("register"))
|
||||
locationService.search({next: nextUrl})
|
||||
|
||||
scope.$on "$routeChangeSuccess", () ->
|
||||
if locationService.path() == "/"
|
||||
scope.vm.active = true
|
||||
else
|
||||
scope.vm.active = false
|
||||
|
||||
directive = {
|
||||
templateUrl: "navigation-bar/navigation-bar.html"
|
||||
scope: {}
|
||||
|
@ -55,7 +55,8 @@ NavigationBarDirective.$inject = [
|
|||
"tgCurrentUserService",
|
||||
"tgNavigationBarService",
|
||||
"$tgLocation",
|
||||
"$tgNavUrls"
|
||||
"$tgNavUrls",
|
||||
"$tgConfig"
|
||||
]
|
||||
|
||||
angular.module("taigaNavigationBar").directive("tgNavigationBar", NavigationBarDirective)
|
||||
|
|
|
@ -3,27 +3,31 @@ nav.navbar(ng-if="vm.isEnabledHeader")
|
|||
a.logo(
|
||||
href="#",
|
||||
tg-nav="home",
|
||||
title="{{'PROJECT.NAVIGATION.HOMEPAGE' | translate}}")
|
||||
|
||||
title="{{'PROJECT.NAVIGATION.HOMEPAGE' | translate}}"
|
||||
)
|
||||
include ../../svg/logo.svg
|
||||
|
||||
a(
|
||||
href="https://taiga.io/support/",
|
||||
target="_blank",
|
||||
title="{{'PROJECT.NAVIGATION.HELP_TITLE' | translate}}",
|
||||
translate="PROJECT.NAVIGATION.HELP")
|
||||
translate="PROJECT.NAVIGATION.HELP"
|
||||
)
|
||||
|
||||
div.nav-right(ng-if="!vm.isAuthenticated")
|
||||
a.login(
|
||||
ng-click="vm.login()"
|
||||
href="#",
|
||||
title="{{ 'LOGIN_COMMON.ACTION_SIGN_IN' | translate }}"
|
||||
) {{ 'LOGIN_COMMON.ACTION_SIGN_IN' | translate }}
|
||||
translate="LOGIN_COMMON.ACTION_SIGN_IN"
|
||||
)
|
||||
a.register(
|
||||
ng-click="vm.register()"
|
||||
ng-if="vm.publicRegisterEnabled"
|
||||
href="#",
|
||||
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")
|
||||
a(tg-nav="home",
|
||||
|
|
Loading…
Reference in New Issue