Skip to content

Commit 2d40d0a

Browse files
palmtreefrbmegahirt
authored andcommitted
Hide Share button from My Projects Page
Remove consol.log() Add additional business logic to header buttons refactor rename twig header variable param. remove console.log debug files
1 parent fcc0c75 commit 2d40d0a

2 files changed

Lines changed: 22 additions & 8 deletions

File tree

src/Site/views/languageforge/container/languageforge.html.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
<breadcrumbs id="top" class="breadcrumbs d-none d-md-block"></breadcrumbs>
8282
</div>
8383
<ul class="nav navbar-nav">
84-
<li class="nav-item" ng-if="$ctrl.project" id="settings-dropdown-button" uib-dropdown data-ng-class="{'app-settings-available': $ctrl.header.settings.length > 0 && $ctrl.currentUserIsProjectManager}">
84+
<li class="nav-item" ng-if="$ctrl.isLexiconProject" id="settings-dropdown-button" uib-dropdown data-ng-class="{'app-settings-available': $ctrl.header.settings.length > 0 && $ctrl.currentUserIsProjectManager}">
8585
<a id="settingsBtn" class="btn btn-primary my-auto" uib-dropdown-toggle title="Settings" href="#">
8686
<i class="fa fa-cog iconPadding"></i><span>Settings</span>
8787
</a>
@@ -95,7 +95,7 @@
9595
{% endverbatim %}
9696
</div>
9797
</li>
98-
<li class='nav-item' ng-if="$ctrl.project && $ctrl.displayShareButton">
98+
<li class='nav-item' ng-if="$ctrl.isLexiconProject">
9999
<a id="shareBtn" class="btn btn-primary my-auto" title="Share" href="#"
100100
ng-click="$ctrl.openShareWithOthersModal()">
101101
<i class="fa fa-share-alt iconPadding"></i><span>Share</span>

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

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)