Skip to content

Commit 187a3f8

Browse files
committed
Add additional business logic to header buttons
1 parent abed207 commit 187a3f8

1 file changed

Lines changed: 18 additions & 7 deletions

File tree

src/angular-app/bellows/core/navbar.controller.ts

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ 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-
showShareButton: boolean = false;
27+
isLexiconProject: boolean = false;
2828

2929
static $inject = [
3030
'$scope',
@@ -75,20 +75,31 @@ export class NavbarController implements angular.IController {
7575
this.currentUserIsProjectManager =
7676
(session.data.userProjectRole === ProjectRoles.MANAGER.key) ||
7777
(session.data.userProjectRole === ProjectRoles.TECH_SUPPORT.key);
78-
this.displayShareButton =
78+
this.displayHeaderButtons =
7979
(this.currentUserIsProjectManager || (this.project.allowSharing && this.session.data.userIsProjectMember));
8080
}
81+
console.log(`this.project: ${this.project}`);
82+
console.log(`this.currentUserIsProjectManager: ${this.currentUserIsProjectManager}`);
83+
console.log(`session.data.userProjectRole: ${session.data.userProjectRole}`);
84+
console.log(`this.displayShareButton ${this.displayHeaderButtons}`);
85+
console.log(`this.currentUserIsProjectManager ${this.currentUserIsProjectManager}`);
86+
console.log(`this.project.allowSharing: ${this.project.allowSharing}`);
87+
console.log(`this.session.data.userIsProjectMember: ${this.session.data.userIsProjectMember}`);
88+
8189
this.rights.canCreateProject =
8290
session.hasSiteRight(this.sessionService.domain.PROJECTS, this.sessionService.operation.CREATE);
8391
this.siteName = session.baseSite();
8492
});
8593
this.$scope.$on('$locationChangeStart', (event, next, current) => {
86-
if (current.includes('/lexicon') && !current.includes('/new-project')) {
87-
this.showShareButton = true;
94+
if (current.includes('/lexicon') && !current.includes('/new-project') && this.displayHeaderButtons) {
95+
this.isLexiconProject = true;
96+
console.log(`Current Path: ${location.pathname}`);
8897
}else{
89-
this.showShareButton = false;
98+
this.isLexiconProject = false;
9099
}
91-
})
100+
console.log(`location pathname: ${location.pathname}, next: ${next}, current: ${current}`);
101+
console.log(`this.isLexiconProject: ${this.isLexiconProject}`);
102+
});
92103
}
93104

94105
onUpdate = ($event: { interfaceConfig: InterfaceConfig}): void => {

0 commit comments

Comments
 (0)