Skip to content

Commit

Permalink
BC-7618 - Missing breadcrumbs (#3476)
Browse files Browse the repository at this point in the history
BC-7618 - fix missing breadcrumbs
  • Loading branch information
muratmerdoglu-dp authored and bergatco committed Jul 5, 2024
1 parent d88b234 commit b6a1cf0
Show file tree
Hide file tree
Showing 8 changed files with 117 additions and 108 deletions.
3 changes: 2 additions & 1 deletion controllers/coursegroups.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
],
}));
Expand Down
3 changes: 2 additions & 1 deletion controllers/courses.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`,
Expand Down
33 changes: 21 additions & 12 deletions controllers/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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,
Expand All @@ -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', {
Expand All @@ -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) {
Expand Down Expand Up @@ -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', {
Expand All @@ -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) {
Expand Down Expand Up @@ -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/',
}];

Expand All @@ -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),
}];

Expand Down
15 changes: 10 additions & 5 deletions controllers/help.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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',
},
],
});
Expand All @@ -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',
},
],
});
Expand All @@ -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,
Expand Down
7 changes: 4 additions & 3 deletions controllers/teams.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
{},
],
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down
3 changes: 2 additions & 1 deletion controllers/topics.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`,
Expand Down
64 changes: 26 additions & 38 deletions views/files/files.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -12,45 +12,33 @@

{{#content "page"}}
<div class="route-files">
<section class="section-title">
<div class="container-fluid">
<div class="row">
<h2 class="h5">
{{#each breadcrumbs}}
<a class="{{#if @last}}active{{/if}}" href="{{this.url}}" data-testid="file-section-title">{{{stripOnlyScript this.label}}}</a><span> /
</span>
{{/each}}
</h2>
</div>
</div>
</section>
<div style="clear: both">
{{#if useNextcloud}}
<a href="{{../nextcloudUrl}}" target="_blank" class="btn btn-add btn-primary pull-right{{#unless ../nextcloudUrl}}disabled{{/unless}}" style="margin-left: 5px">
<i class="fa fa-external-link" aria-hidden="true"></i>
{{$t "teams._team.files.button.toNextcloud"}}
<span class="tag">{{$t "teams._team.files.button.newTag"}}</span>
</a>
{{/if}}
<div style="clear: both">
{{#if useNextcloud}}
<a href="{{../nextcloudUrl}}" target="_blank" class="btn btn-add btn-primary pull-right{{#unless ../nextcloudUrl}}disabled{{/unless}}" style="margin-left: 5px">
<i class="fa fa-external-link" aria-hidden="true"></i>
{{$t "teams._team.files.button.toNextcloud"}}
<span class="tag">{{$t "teams._team.files.button.newTag"}}</span>
</a>
{{/if}}

{{#if courseUrl}}
<a href="{{courseUrl}}" data-testid="navigate-to-course-btn" class="btn btn-secondary pull-right">
<i class="fa fa-users"></i>
{{ toCourseText }}
</a>
{{/if}}
</div>
<div style="clear: both">
{{#if useNextcloud}}
<div class="alert info-custom" role="alert">
<i class="fa fa-info-circle pr-1"></i>
<div>{{{$t "info.text.nextcloudLink" (dict "title" theme.title)}}}</div>
</div>
{{/if}}
</div>
{{#if canUploadFile}}
{{#embed "files/file-upload"}}{{/embed}}
{{/if}}
{{#if courseUrl}}
<a href="{{courseUrl}}" data-testid="navigate-to-course-btn" class="btn btn-secondary pull-right">
<i class="fa fa-users"></i>
{{ toCourseText }}
</a>
{{/if}}
</div>
<div style="clear: both">
{{#if useNextcloud}}
<div class="alert info-custom" role="alert">
<i class="fa fa-info-circle pr-1"></i>
<div>{{{$t "info.text.nextcloudLink" (dict "title" theme.title)}}}</div>
</div>
{{/if}}
</div>
{{#if canUploadFile}}
{{#embed "files/file-upload"}}{{/embed}}
{{/if}}
{{#if sortOptions}}
<div class="pull-right personal-files-filter">
<label for="sortBy" style="position: absolute;left:-999px;">{{$t "files.label.sortBy"}}</label>
Expand Down
Loading

0 comments on commit b6a1cf0

Please sign in to comment.