diff --git a/orga/app/components/layout/sidebar.hbs b/orga/app/components/layout/sidebar.hbs index 42555f7d115..56ddc8844ef 100644 --- a/orga/app/components/layout/sidebar.hbs +++ b/orga/app/components/layout/sidebar.hbs @@ -23,6 +23,14 @@ {{t "navigation.main.certifications"}} {{/if}} + {{#if this.shouldDisplayAttestationsEntry}} + + + + + {{t "navigation.main.attestations"}} + + {{/if}} {{#if this.shouldDisplayMissionsEntry}} diff --git a/orga/app/components/layout/sidebar.js b/orga/app/components/layout/sidebar.js index e9c9cea1ca7..1b76d12fa03 100644 --- a/orga/app/components/layout/sidebar.js +++ b/orga/app/components/layout/sidebar.js @@ -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; } diff --git a/orga/app/router.js b/orga/app/router.js index f17c0597969..ab9d2155d22 100644 --- a/orga/app/router.js +++ b/orga/app/router.js @@ -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 () { diff --git a/orga/tests/integration/components/layout/sidebar-test.js b/orga/tests/integration/components/layout/sidebar-test.js index b6c9af9ed5f..bf44e22e7db 100644 --- a/orga/tests/integration/components/layout/sidebar-test.js +++ b/orga/tests/integration/components/layout/sidebar-test.js @@ -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``); + + 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 {