@@ -21,18 +21,24 @@ export class NavbarController implements angular.IController {
2121 project : Project ;
2222 interfaceConfig : InterfaceConfig ;
2323 currentUserIsProjectManager : boolean ;
24- displayShareButton : boolean ;
24+ displayHeaderButtons : boolean ;
2525 projectTypeNames : ProjectTypeNames ;
2626 siteName : string ;
27+ isLexiconProject : boolean = false ;
2728
28- static $inject = [ '$uibModal' ,
29- 'projectService' , 'sessionService' ,
29+ static $inject = [
30+ '$scope' ,
31+ '$uibModal' ,
32+ 'projectService' ,
33+ 'sessionService' ,
3034 'offlineCacheUtils' ,
3135 'applicationHeaderService' ] ;
32- constructor ( private readonly $modal : ModalService ,
36+ constructor ( private readonly $scope : angular . IScope ,
37+ private readonly $modal : ModalService ,
3338 private readonly projectService : ProjectService , private readonly sessionService : SessionService ,
3439 private readonly offlineCacheUtils : OfflineCacheUtilsService ,
35- private readonly applicationHeaderService : ApplicationHeaderService ) { }
40+ private readonly applicationHeaderService : ApplicationHeaderService ,
41+ ) { }
3642
3743 $onInit ( ) : void {
3844 this . projectTypeNames = this . projectService . data . projectTypeNames ;
@@ -69,13 +75,21 @@ export class NavbarController implements angular.IController {
6975 this . currentUserIsProjectManager =
7076 ( session . data . userProjectRole === ProjectRoles . MANAGER . key ) ||
7177 ( session . data . userProjectRole === ProjectRoles . TECH_SUPPORT . key ) ;
72- this . displayShareButton =
78+ this . displayHeaderButtons =
7379 ( this . currentUserIsProjectManager || ( this . project . allowSharing && this . session . data . userIsProjectMember ) ) ;
7480 }
81+
7582 this . rights . canCreateProject =
7683 session . hasSiteRight ( this . sessionService . domain . PROJECTS , this . sessionService . operation . CREATE ) ;
7784 this . siteName = session . baseSite ( ) ;
7885 } ) ;
86+ this . $scope . $on ( '$locationChangeStart' , ( event , next , current ) => {
87+ if ( current . includes ( '/lexicon' ) && ! current . includes ( '/new-project' ) && this . displayHeaderButtons ) {
88+ this . isLexiconProject = true ;
89+ } else {
90+ this . isLexiconProject = false ;
91+ }
92+ } ) ;
7993 }
8094
8195 onUpdate = ( $event : { interfaceConfig : InterfaceConfig } ) : void => {
0 commit comments