Skip to content

Commit 5820ae2

Browse files
authored
Merge pull request #1283 from sillsdev/feature/hide-share-button-from-my-project-page
Hide Share button from My Projects Page Due to multiple authors, I have done a traditional merge with squashed commits so that each author gets one commit.
2 parents fcc0c75 + c5a1172 commit 5820ae2

6 files changed

Lines changed: 25 additions & 23 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 && $ctrl.currentUserIsProjectManager" id="settings-dropdown-button" uib-dropdown>
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 && $ctrl.displayShareButton">
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/Site/views/languageforge/theme/default/sass/_global.scss

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -264,18 +264,6 @@
264264
}
265265
}
266266

267-
#settings-dropdown-button:not(.app-settings-available) {
268-
.dropdown-toggle {
269-
visibility: hidden;
270-
}
271-
}
272-
273-
#settings-dropdown-button.app-settings-available {
274-
.dropdown-toggle {
275-
visibility: visible;
276-
}
277-
}
278-
279267
#settingsBtn {
280268
margin: 12px;
281269
margin-right: 6px;
@@ -287,7 +275,7 @@
287275
font-size: 1rem;
288276
}
289277
}
290-
278+
291279
#settingsBtn::after {
292280
display:none;
293281
}

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

Lines changed: 18 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+
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;
@@ -72,10 +78,18 @@ export class NavbarController implements angular.IController {
7278
this.displayShareButton =
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')) {
88+
this.isLexiconProject = true;
89+
} else {
90+
this.isLexiconProject = false;
91+
}
92+
});
7993
}
8094

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

test/app/bellows/project-settings.e2e-spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ describe('Bellows E2E Project Settings app', () => {
1515
await loginPage.loginAsMember();
1616
await projectsPage.get();
1717
await projectsPage.clickOnProject(constants.testProjectName);
18-
expect<string>(await settingsPage.settingsMenuLink.getAttribute('class')).not.toContain('app-settings-available');
18+
expect<boolean>(await settingsPage.settingsMenuLink.isPresent()).toBe(false);
1919
});
2020

2121
it('System Admin can manage project', async () => {

test/app/languageforge/lexicon/settings/config-fields.e2e-spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ describe('Lexicon E2E Configuration Fields', () => {
4040
});
4141

4242
it('can go to Configuration and select unified Fields tab', async () => {
43-
expect<any>(await configPage.settingsMenuLink.isDisplayed()).toBe(true);
43+
expect<any>(await configPage.settingsMenuLink.isPresent()).toBe(true);
4444
await configPage.get();
4545
expect<any>(await configPage.applyButton.isDisplayed()).toBe(true);
4646
expect<any>(await configPage.applyButton.isEnabled()).toBe(false);

test/app/languageforge/lexicon/settings/config-input-systems.e2e-spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ describe('Lexicon E2E Configuration Input Systems', () => {
1717
await loginPage.loginAsUser();
1818
await projectsPage.get();
1919
await projectsPage.clickOnProject(constants.testProjectName);
20-
expect<any>(await configPage.settingsMenuLink.getAttribute('class')).not.toContain('app-settings-available');
20+
expect<boolean>(await configPage.settingsMenuLink.isPresent()).toBe(false);
2121
});
2222

2323
it('setup: login as manager, select test project, goto configuration', async () => {
2424
await loginPage.loginAsManager();
2525
await projectsPage.get();
2626
await projectsPage.clickOnProject(constants.testProjectName);
27-
expect<any>(await configPage.settingsMenuLink.isDisplayed()).toBe(true);
27+
expect<any>(await configPage.settingsMenuLink.isPresent()).toBe(true);
2828
await configPage.get();
2929
expect<any>(await configPage.applyButton.isDisplayed()).toBe(true);
3030
expect<any>(await configPage.applyButton.isEnabled()).toBe(false);

0 commit comments

Comments
 (0)