Skip to content

Commit

Permalink
feat(orga): add attestations in ember router and one entry in sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandre-Monney committed Nov 15, 2024
1 parent 547e62c commit cf1c3b0
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
8 changes: 8 additions & 0 deletions orga/app/components/layout/sidebar.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@
{{t "navigation.main.certifications"}}
</LinkTo>
{{/if}}
{{#if this.shouldDisplayAttestationsEntry}}
<LinkTo @route="authenticated.attestations" class="sidebar-nav__item">
<span class="sidebar-nav__item-icon">
<PixIcon @name="assignment" role="none" />
</span>
{{t "navigation.main.attestations"}}
</LinkTo>
{{/if}}
{{#if this.shouldDisplayMissionsEntry}}
<LinkTo @route="authenticated.missions" class="sidebar-nav__item">
<span class="sidebar-nav__item-icon">
Expand Down
4 changes: 4 additions & 0 deletions orga/app/components/layout/sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ export default class SidebarMenu extends Component {
return this.currentUser.isAdminInOrganization && this.currentUser.isSCOManagingStudents;
}

get shouldDisplayAttestationsEntry() {
return this.currentUser.canAccessAttestationsPage;
}

get shouldDisplayPlacesEntry() {
return this.currentUser.canAccessPlacesPage;
}
Expand Down
1 change: 1 addition & 0 deletions orga/app/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ Router.map(function () {
});
});
this.route('certifications');
this.route('attestations');
this.route('preselect-target-profile', { path: '/selection-sujets' });
this.route('places');
this.route('missions', function () {
Expand Down
15 changes: 15 additions & 0 deletions orga/tests/integration/components/layout/sidebar-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,21 @@ module('Integration | Component | Layout::Sidebar', function (hooks) {
});
});

module('When the user has the attestations feature', function () {
test('should display Attestations entry with link to attestation page', async function (assert) {
class CurrentUserStub extends Service {
organization = Object.create({ id: 5 });
canAccessAttestationsPage = true;
}
this.owner.register('service:current-user', CurrentUserStub);

const screen = await render(hbs`<Layout::Sidebar />`);

const attestationsLink = screen.getByRole('link', { name: t('navigation.main.attestations') });
assert.dom(attestationsLink).hasAttribute('href', '/attestations');
});
});

test('[a11y] it should contain accessibility aria-label nav', async function (assert) {
// given
class CurrentUserStub extends Service {
Expand Down

0 comments on commit cf1c3b0

Please sign in to comment.