diff --git a/app/modules/navigation-bar/navigation-bar.directive.coffee b/app/modules/navigation-bar/navigation-bar.directive.coffee index c32a792f..bce9ea39 100644 --- a/app/modules/navigation-bar/navigation-bar.directive.coffee +++ b/app/modules/navigation-bar/navigation-bar.directive.coffee @@ -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) diff --git a/app/modules/navigation-bar/navigation-bar.jade b/app/modules/navigation-bar/navigation-bar.jade index 2c6a4a81..e81794cc 100644 --- a/app/modules/navigation-bar/navigation-bar.jade +++ b/app/modules/navigation-bar/navigation-bar.jade @@ -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",