Skip to content

Commit

Permalink
Merge pull request #1283 from sillsdev/feature/hide-share-button-from…
Browse files Browse the repository at this point in the history
…-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.
  • Loading branch information
megahirt authored Mar 10, 2022
2 parents fcc0c75 + c5a1172 commit 5820ae2
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
<breadcrumbs id="top" class="breadcrumbs d-none d-md-block"></breadcrumbs>
</div>
<ul class="nav navbar-nav">
<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}">
<li class="nav-item" ng-if="$ctrl.isLexiconProject && $ctrl.currentUserIsProjectManager" id="settings-dropdown-button" uib-dropdown>
<a id="settingsBtn" class="btn btn-primary my-auto" uib-dropdown-toggle title="Settings" href="#">
<i class="fa fa-cog iconPadding"></i><span>Settings</span>
</a>
Expand All @@ -95,7 +95,7 @@
{% endverbatim %}
</div>
</li>
<li class='nav-item' ng-if="$ctrl.project && $ctrl.displayShareButton">
<li class='nav-item' ng-if="$ctrl.isLexiconProject && $ctrl.displayShareButton">
<a id="shareBtn" class="btn btn-primary my-auto" title="Share" href="#"
ng-click="$ctrl.openShareWithOthersModal()">
<i class="fa fa-share-alt iconPadding"></i><span>Share</span>
Expand Down
14 changes: 1 addition & 13 deletions src/Site/views/languageforge/theme/default/sass/_global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -264,18 +264,6 @@
}
}

#settings-dropdown-button:not(.app-settings-available) {
.dropdown-toggle {
visibility: hidden;
}
}

#settings-dropdown-button.app-settings-available {
.dropdown-toggle {
visibility: visible;
}
}

#settingsBtn {
margin: 12px;
margin-right: 6px;
Expand All @@ -287,7 +275,7 @@
font-size: 1rem;
}
}

#settingsBtn::after {
display:none;
}
Expand Down
22 changes: 18 additions & 4 deletions src/angular-app/bellows/core/navbar.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,21 @@ export class NavbarController implements angular.IController {
displayShareButton: boolean;
projectTypeNames: ProjectTypeNames;
siteName: string;
isLexiconProject: boolean = false;

static $inject = ['$uibModal',
'projectService', 'sessionService',
static $inject = [
'$scope',
'$uibModal',
'projectService',
'sessionService',
'offlineCacheUtils',
'applicationHeaderService'];
constructor(private readonly $modal: ModalService,
constructor(private readonly $scope: angular.IScope,
private readonly $modal: ModalService,
private readonly projectService: ProjectService, private readonly sessionService: SessionService,
private readonly offlineCacheUtils: OfflineCacheUtilsService,
private readonly applicationHeaderService: ApplicationHeaderService) { }
private readonly applicationHeaderService: ApplicationHeaderService,
) { }

$onInit(): void {
this.projectTypeNames = this.projectService.data.projectTypeNames;
Expand Down Expand Up @@ -72,10 +78,18 @@ export class NavbarController implements angular.IController {
this.displayShareButton =
(this.currentUserIsProjectManager || (this.project.allowSharing && this.session.data.userIsProjectMember));
}

this.rights.canCreateProject =
session.hasSiteRight(this.sessionService.domain.PROJECTS, this.sessionService.operation.CREATE);
this.siteName = session.baseSite();
});
this.$scope.$on('$locationChangeStart', (event, next, current) => {
if (current.includes('/lexicon') && !current.includes('/new-project')) {
this.isLexiconProject = true;
} else {
this.isLexiconProject = false;
}
});
}

onUpdate = ($event: { interfaceConfig: InterfaceConfig}): void => {
Expand Down
2 changes: 1 addition & 1 deletion test/app/bellows/project-settings.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('Bellows E2E Project Settings app', () => {
await loginPage.loginAsMember();
await projectsPage.get();
await projectsPage.clickOnProject(constants.testProjectName);
expect<string>(await settingsPage.settingsMenuLink.getAttribute('class')).not.toContain('app-settings-available');
expect<boolean>(await settingsPage.settingsMenuLink.isPresent()).toBe(false);
});

it('System Admin can manage project', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('Lexicon E2E Configuration Fields', () => {
});

it('can go to Configuration and select unified Fields tab', async () => {
expect<any>(await configPage.settingsMenuLink.isDisplayed()).toBe(true);
expect<any>(await configPage.settingsMenuLink.isPresent()).toBe(true);
await configPage.get();
expect<any>(await configPage.applyButton.isDisplayed()).toBe(true);
expect<any>(await configPage.applyButton.isEnabled()).toBe(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ describe('Lexicon E2E Configuration Input Systems', () => {
await loginPage.loginAsUser();
await projectsPage.get();
await projectsPage.clickOnProject(constants.testProjectName);
expect<any>(await configPage.settingsMenuLink.getAttribute('class')).not.toContain('app-settings-available');
expect<boolean>(await configPage.settingsMenuLink.isPresent()).toBe(false);
});

it('setup: login as manager, select test project, goto configuration', async () => {
await loginPage.loginAsManager();
await projectsPage.get();
await projectsPage.clickOnProject(constants.testProjectName);
expect<any>(await configPage.settingsMenuLink.isDisplayed()).toBe(true);
expect<any>(await configPage.settingsMenuLink.isPresent()).toBe(true);
await configPage.get();
expect<any>(await configPage.applyButton.isDisplayed()).toBe(true);
expect<any>(await configPage.applyButton.isEnabled()).toBe(false);
Expand Down

0 comments on commit 5820ae2

Please sign in to comment.