Skip to content

Commit c2dd7d6

Browse files
committed
Hide Share button from My Projects Page
1 parent 002e477 commit c2dd7d6

2 files changed

Lines changed: 20 additions & 5 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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.showShareButton">
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: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,21 @@ export class NavbarController implements angular.IController {
2424
displayShareButton: boolean;
2525
projectTypeNames: ProjectTypeNames;
2626
siteName: string;
27+
showShareButton: 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;
@@ -76,6 +82,15 @@ export class NavbarController implements angular.IController {
7682
session.hasSiteRight(this.sessionService.domain.PROJECTS, this.sessionService.operation.CREATE);
7783
this.siteName = session.baseSite();
7884
});
85+
this.$scope.$on('$locationChangeStart', (event, next, current) => {
86+
if (current.includes('/lexicon') && !current.includes('/new-project')) {
87+
console.log(`Current Path ${location.pathname}`);
88+
this.showShareButton = true;
89+
}else{
90+
this.showShareButton = false;
91+
}
92+
console.log(`location pathname: ${location.pathname}, next: ${next}, current: ${current}`);
93+
})
7994
}
8095

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

0 commit comments

Comments
 (0)