Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide Share button from My Projects Page #1283

Merged
merged 2 commits into from
Mar 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
palmtreefrb marked this conversation as resolved.
Show resolved Hide resolved
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