Skip to content

Commit

Permalink
feat(orga): display participant page in sidebar for schools
Browse files Browse the repository at this point in the history
 Co-authored-by: <[email protected] >
 Co-authored-by: <[email protected]>
  • Loading branch information
rouxxi authored Nov 15, 2024
1 parent b4a4b88 commit c6227d3
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 43 deletions.
14 changes: 6 additions & 8 deletions orga/app/components/layout/sidebar.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,12 @@
{{t "navigation.main.missions"}}
</LinkTo>
{{/if}}
{{#if this.shouldDisplayParticipantsEntry}}
<LinkTo @route={{this.organizationLearnersList.route}} class="sidebar-nav__item">
<span class="sidebar-nav__item-icon">
<PixIcon @name="infoUser" role="none" />
</span>
{{t this.organizationLearnersList.label}}
</LinkTo>
{{/if}}
<LinkTo @route={{this.organizationLearnersList.route}} class="sidebar-nav__item">
<span class="sidebar-nav__item-icon">
<PixIcon @name="infoUser" role="none" />
</span>
{{t this.organizationLearnersList.label}}
</LinkTo>
<LinkTo @route="authenticated.team" class="sidebar-nav__item">
<span class="sidebar-nav__item-icon">
<PixIcon @name="users" role="none" />
Expand Down
4 changes: 0 additions & 4 deletions orga/app/components/layout/sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ export default class SidebarMenu extends Component {
return this.currentUser.canAccessCampaignsPage;
}

get shouldDisplayParticipantsEntry() {
return this.currentUser.canAccessParticipantsPage;
}

get organizationLearnersList() {
if (this.currentUser.isSCOManagingStudents) {
return {
Expand Down
4 changes: 0 additions & 4 deletions orga/app/services/current-user.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,6 @@ export default class CurrentUserService extends Service {
return !this.prescriber.missionsManagement;
}

get canAccessParticipantsPage() {
return !this.prescriber.missionsManagement;
}

get hasLearnerImportFeature() {
return this.prescriber.hasOrganizationLearnerImport;
}
Expand Down
10 changes: 1 addition & 9 deletions orga/tests/integration/components/layout/sidebar-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ module('Integration | Component | Layout::Sidebar', function (hooks) {
class CurrentUserStub extends Service {
organization = Object.create({ id: '1' });
canAccessCampaignsPage = true;
canAccessParticipantsPage = true;
}
this.owner.register('service:current-user', CurrentUserStub);
const intl = this.owner.lookup('service:intl');
Expand Down Expand Up @@ -125,7 +124,6 @@ module('Integration | Component | Layout::Sidebar', function (hooks) {
// given
class CurrentUserStub extends Service {
organization = Object.create({ id: '1', type: 'PRO' });
canAccessParticipantsPage = true;
}

this.owner.register('service:current-user', CurrentUserStub);
Expand All @@ -146,7 +144,6 @@ module('Integration | Component | Layout::Sidebar', function (hooks) {
class CurrentUserStub extends Service {
organization = Object.create({ id: '1', type: 'SUP' });
isSUPManagingStudents = true;
canAccessParticipantsPage = true;
}

this.owner.register('service:current-user', CurrentUserStub);
Expand All @@ -165,7 +162,6 @@ module('Integration | Component | Layout::Sidebar', function (hooks) {
class CurrentUserStub extends Service {
organization = Object.create({ id: '1', type: 'SUP' });
isSUPManagingStudents = false;
canAccessParticipantsPage = true;
}

this.owner.register('service:current-user', CurrentUserStub);
Expand All @@ -187,7 +183,6 @@ module('Integration | Component | Layout::Sidebar', function (hooks) {
organization = Object.create({ id: '1', type: 'SCO' });
isSCOManagingStudents = true;
canAccessMissionsPage = false;
canAccessParticipantsPage = true;
}

this.owner.register('service:current-user', CurrentUserStub);
Expand All @@ -206,7 +201,6 @@ module('Integration | Component | Layout::Sidebar', function (hooks) {
class CurrentUserStub extends Service {
organization = Object.create({ id: '1', type: 'SCO' });
isSCOManagingStudents = false;
canAccessParticipantsPage = true;
}

this.owner.register('service:current-user', CurrentUserStub);
Expand Down Expand Up @@ -306,7 +300,7 @@ module('Integration | Component | Layout::Sidebar', function (hooks) {
);
});

test('should not display Campagne and Participants menus', async function (assert) {
test('should not display Campagne', async function (assert) {
class CurrentUserStub extends Service {
organization = Object.create({ id: 5 });
canAccessMissionsPage = true;
Expand All @@ -318,9 +312,7 @@ module('Integration | Component | Layout::Sidebar', function (hooks) {
const screen = await render(hbs`<Layout::Sidebar />`);

assert.dom(screen.queryByText('Campagnes')).doesNotExist();
assert.dom(screen.queryByText('Participants')).doesNotExist();
assert.dom(screen.queryByText('Étudiants')).doesNotExist();
assert.dom(screen.queryByText('Élèves')).doesNotExist();
});
});

Expand Down
18 changes: 0 additions & 18 deletions orga/tests/unit/services/current-user-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,24 +338,6 @@ module('Unit | Service | current-user', function (hooks) {
});
});

module('#canAccessParticipantsPage', function () {
test('should return false if user has mission feature activated', function (assert) {
currentUserService.prescriber = {
missionsManagement: true,
};

assert.false(currentUserService.canAccessParticipantsPage);
});

test('should return true if user does not have missions feature activated', function (assert) {
currentUserService.prescriber = {
missionsManagement: false,
};

assert.true(currentUserService.canAccessParticipantsPage);
});
});

module('#canAccessImportPage', function (hooks) {
hooks.beforeEach(function () {
currentUserService.prescriber = { hasOrganizationLearnerImport: false };
Expand Down

0 comments on commit c6227d3

Please sign in to comment.