From ec591a774352af7f88bc5afa62921ddb010666f1 Mon Sep 17 00:00:00 2001 From: Alexandre Monney Date: Thu, 7 Nov 2024 17:26:19 +0100 Subject: [PATCH] feat(orga): add attestations in ember router and one entry in sidebar --- orga/app/components/layout/sidebar.hbs | 8 ++++++++ orga/app/components/layout/sidebar.js | 4 ++++ orga/app/router.js | 1 + .../integration/components/layout/sidebar-test.js | 15 +++++++++++++++ 4 files changed, 28 insertions(+) diff --git a/orga/app/components/layout/sidebar.hbs b/orga/app/components/layout/sidebar.hbs index f10a5a9a5d7..459c41eff58 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 95c55b9d3b7..c505befdbdd 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 29850fec3ef..a2a6d05ec64 100644 --- a/orga/tests/integration/components/layout/sidebar-test.js +++ b/orga/tests/integration/components/layout/sidebar-test.js @@ -316,6 +316,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 {