From b6a1cf05007517d3e7eec985e016d732c85a42db Mon Sep 17 00:00:00 2001 From: Murat Merdoglu <64781656+muratmerdoglu-dp@users.noreply.github.com> Date: Fri, 5 Jul 2024 11:16:25 +0200 Subject: [PATCH] BC-7618 - Missing breadcrumbs (#3476) BC-7618 - fix missing breadcrumbs --- controllers/coursegroups.js | 3 +- controllers/courses.js | 3 +- controllers/files.js | 33 ++++++++----- controllers/help.js | 15 ++++-- controllers/teams.js | 7 +-- controllers/topics.js | 3 +- views/files/files.hbs | 64 ++++++++++-------------- views/lib/loggedin.hbs | 97 +++++++++++++++++++------------------ 8 files changed, 117 insertions(+), 108 deletions(-) diff --git a/controllers/coursegroups.js b/controllers/coursegroups.js index 2c77c16161..bfaca17a49 100644 --- a/controllers/coursegroups.js +++ b/controllers/coursegroups.js @@ -161,13 +161,14 @@ router.get('/:courseGroupId/', (req, res, next) => { lessons, doneSubmissions, openSubmissions, - breadcrumb: [{ + breadcrumbs: [{ title: res.$t("courses.headline.myCourses"), url: '/rooms-overview', }, { title: course.name, url: `/rooms/${course._id}`, + dataTestId: 'navigate-to-course-from-group', }, ], })); diff --git a/controllers/courses.js b/controllers/courses.js index 6bd15983ac..00a2b87243 100644 --- a/controllers/courses.js +++ b/controllers/courses.js @@ -786,10 +786,11 @@ router.get('/:courseId/', async (req, res, next) => { ltiTools, courseGroups, baseUrl, - breadcrumb: [ + breadcrumbs: [ { title: res.$t('courses.headline.myCourses'), url: '/rooms-overview', + dataTestId: 'navigate-to-course-from-tools', }, ], filesUrl: `/files/courses/${req.params.courseId}`, diff --git a/controllers/files.js b/controllers/files.js index 1374a3e920..b7f758fc17 100644 --- a/controllers/files.js +++ b/controllers/files.js @@ -116,8 +116,9 @@ const getBreadcrumbs = (req, dirId, breadcrumbs = []) => api(req).get(`/files/${ } breadcrumbs.push({ - label: directory.name, + title: directory.name, id: directory._id, + dataTestId: 'navigate-to-my-personal-files-folder', }); return Promise.resolve(breadcrumbs); @@ -565,8 +566,9 @@ router.get('/my/:folderId?/:subFolderId?', FileGetter, async (req, res, next) => .map(addThumbnails); let breadcrumbs = [{ - label: res.$t('files.label.myPersonalData'), + title: res.$t('files.label.myPersonalData'), url: basePath, + dataTestId: 'navigate-to-my-personal-files', }]; if (req.params.folderId) { @@ -627,8 +629,9 @@ router.get('/shared/', (req, res) => { title: res.$t('files.headline.sharedFiles'), path: '/', breadcrumbs: [{ - label: res.$t('files.label.filesSharedWithMe'), + title: res.$t('files.label.filesSharedWithMe'), url: '/files/shared/', + dataTestId: 'navigate-to-my-shared-files', }], canUploadFile: false, canCreateDir: false, @@ -651,8 +654,9 @@ router.get('/courses/', (req, res, next) => { const basePath = '/files/courses/'; getScopeDirs(req, res, 'courses').then(async (directories) => { const breadcrumbs = [{ - label: res.$t('files.label.filesFromMyCourse'), + title: res.$t('files.label.filesFromMyCourse'), url: basePath, + dataTestId: 'navigate-to-my-course-files', }]; res.render('files/files', { @@ -673,11 +677,13 @@ router.get('/courses/:courseId/:folderId?', FileGetter, async (req, res, next) = let canCreateFile = true; let breadcrumbs = [{ - label: res.$t('files.label.filesFromMyCourse'), + title: res.$t('files.label.filesFromMyCourse'), url: basePath, + dataTestId: 'navigate-to-my-courses-files', }, { - label: record.name, + title: record.name, url: basePath + record._id, + dataTestId: 'navigate-to-my-files-in-course', }]; if (req.params.folderId) { @@ -718,8 +724,9 @@ router.get('/teams/', (req, res, next) => { const basePath = '/files/teams/'; getScopeDirs(req, res, 'teams').then(async (directories) => { const breadcrumbs = [{ - label: res.$t('files.label.filesFromMyTeam'), + title: res.$t('files.label.filesFromMyTeam'), url: basePath, + dataTestId: 'navigate-to-my-team-files', }]; res.render('files/files', { @@ -741,11 +748,13 @@ router.get('/teams/:teamId/:folderId?', FileGetter, async (req, res, next) => { res.locals.files.files = res.locals.files.files.map(addThumbnails); let breadcrumbs = [{ - label: res.$t('files.label.filesFromMyTeam'), + title: res.$t('files.label.filesFromMyTeam'), url: basePath, + dataTestId: 'navigate-to-my-teams-files', }, { - label: team.name, + title: team.name, url: basePath + team._id, + dataTestId: 'navigate-to-my-files-in-team', }]; if (req.params.folderId) { @@ -792,7 +801,7 @@ router.get('/teams/:teamId/:folderId?', FileGetter, async (req, res, next) => { router.get('/classes/', (req, res, next) => { getScopeDirs(req, res, 'classes').then(async (directories) => { const breadcrumbs = [{ - label: res.$t('files.label.filesFromMyClasses'), + title: res.$t('files.label.filesFromMyClasses'), url: '/files/classes/', }]; @@ -813,10 +822,10 @@ router.get('/classes/:classId/:folderId?', FileGetter, (req, res, next) => { const files = res.locals.files.map(addThumbnails); let breadcrumbs = [{ - label: res.$t('files.label.filesFromMyClasses'), + title: res.$t('files.label.filesFromMyClasses'), url: req.query.CKEditor ? '#' : changeQueryParams(req.originalUrl, { dir: '' }, basePath), }, { - label: record.name, + title: record.name, url: changeQueryParams(req.originalUrl, { dir: '' }, basePath + record._id), }]; diff --git a/controllers/help.js b/controllers/help.js index 7e61f048bd..4f34e7120b 100644 --- a/controllers/help.js +++ b/controllers/help.js @@ -48,10 +48,11 @@ router.get('/releases', (req, res, next) => { }); res.render('help/releases', { - breadcrumb: [ + breadcrumbs: [ { title: res.$t('help.headline.helpSection'), url: '/help/articles', + dataTestId: 'navigate-to-help-article-from-release-note', }, ], release: releases.data, @@ -62,10 +63,11 @@ router.get('/releases', (req, res, next) => { router.get('/confluence/:id', (req, res, next) => { res.render('help/confluence', { - breadcrumb: [ + breadcrumbs: [ { title: res.$t('help.headline.helpSection'), url: '/help/articles', + dataTestId: 'navigate-to-help-article', }, ], articleId: req.params.id, @@ -76,10 +78,11 @@ router.get('/confluence/:id', (req, res, next) => { router.get('/faq/people', (req, res, next) => { res.render('help/people', { title: res.$t('help.headline.contactDetails'), - breadcrumb: [ + breadcrumbs: [ { title: res.$t('help.headline.helpSection'), url: '/help/articles', + dataTestId: 'navigate-to-help-article-from-contact', }, ], }); @@ -88,10 +91,11 @@ router.get('/faq/people', (req, res, next) => { router.get('/lernNuggets', (req, res, next) => { res.render('help/lern-nuggets', { title: res.$t('help.headline.privacyCourse'), - breadcrumb: [ + breadcrumbs: [ { title: res.$t('help.headline.helpSection'), url: '/help/articles', + dataTestId: 'navigate-to-help-article-from-document', }, ], }); @@ -110,10 +114,11 @@ router.get('/faq/documents', async (req, res, next) => { return res.render('help/accordion-sections', { title: res.$t('help.headline.documentsToDownload'), - breadcrumb: [ + breadcrumbs: [ { title: res.$t('help.headline.helpSection'), url: '/help/articles', + dataTestId: 'navigate-to-help-article-from-document', }, ], sections: documents, diff --git a/controllers/teams.js b/controllers/teams.js index c44928b9e5..991015938f 100644 --- a/controllers/teams.js +++ b/controllers/teams.js @@ -659,10 +659,11 @@ router.get('/:teamId', async (req, res, next) => { ...course, title: course.name, activeTab: req.query.activeTab, - breadcrumb: [ + breadcrumbs: [ { title: res.$t('teams.headline.myTeams'), url: '/teams', + dataTestId: 'navigate-to-course-from-team', }, {}, ], @@ -1141,7 +1142,7 @@ router.get('/:teamId/members', async (req, res, next) => { users: filteredUsers, federalStates, currentFederalState: currentFederalStateId, - breadcrumb: [ + breadcrumbs: [ { title: res.$t('teams.headline.myTeams'), url: '/teams', @@ -1351,7 +1352,7 @@ router.get('/:teamId/topics', async (req, res, next) => { myhomeworks: homeworksData.filter((task) => task.private), ltiToolIds, courseGroups: courseGroupsData, - breadcrumb: [ + breadcrumbs: [ { title: res.$t('teams.headline.myTeams'), url: '/teams', diff --git a/controllers/topics.js b/controllers/topics.js index 3206794bf5..bad186fdad 100644 --- a/controllers/topics.js +++ b/controllers/topics.js @@ -379,13 +379,14 @@ router.get('/:topicId', (req, res, next) => { courseId: req.params.courseId, isCourseGroupTopic: courseGroup._id !== undefined, isTeacher, - breadcrumb: [{ + breadcrumbs: [{ title: res.$t('courses.headline.myCourses'), url: '/rooms-overview', }, { title: course.name, url: `/rooms/${course._id}`, + dataTestId: 'navigate-to-course-from-topic', }, courseGroup._id ? { title: `${courseGroup.name} > Themen`, diff --git a/views/files/files.hbs b/views/files/files.hbs index acbedc017c..a991376b57 100644 --- a/views/files/files.hbs +++ b/views/files/files.hbs @@ -12,45 +12,33 @@ {{#content "page"}}
-
-
-
-

- {{#each breadcrumbs}} - {{{stripOnlyScript this.label}}} / - - {{/each}} -

-
-
-
-
- {{#if useNextcloud}} - - - {{$t "teams._team.files.button.toNextcloud"}} - {{$t "teams._team.files.button.newTag"}} - - {{/if}} +
+ {{#if useNextcloud}} + + + {{$t "teams._team.files.button.toNextcloud"}} + {{$t "teams._team.files.button.newTag"}} + + {{/if}} - {{#if courseUrl}} - - - {{ toCourseText }} - - {{/if}} -
-
- {{#if useNextcloud}} - - {{/if}} -
- {{#if canUploadFile}} - {{#embed "files/file-upload"}}{{/embed}} - {{/if}} + {{#if courseUrl}} + + + {{ toCourseText }} + + {{/if}} +
+
+ {{#if useNextcloud}} + + {{/if}} +
+ {{#if canUploadFile}} + {{#embed "files/file-upload"}}{{/embed}} + {{/if}} {{#if sortOptions}}
diff --git a/views/lib/loggedin.hbs b/views/lib/loggedin.hbs index 9069faaf55..65a17a9b02 100644 --- a/views/lib/loggedin.hbs +++ b/views/lib/loggedin.hbs @@ -121,18 +121,6 @@ - {{#if breadcrumb}} - - {{/if}} -