generated from KTH/node-web
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #369 from KTH/issues/KUI-1275
feat(KUI-1275): replace client side breadcrumbs with handlebar helper
- Loading branch information
Showing
9 changed files
with
55 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Logic is based on old Breadcrumb component in kth-reactstrap: https://github.com/KTH/kth-reactstrap/blob/master/src/components/utbildningsinfo/Breadcrumbs.js | ||
// Be aware that this entire file is replicated in multiple apps, so changes here should probably be synced to the other apps. | ||
// See https://confluence.sys.kth.se/confluence/x/6wYJDQ for more information. | ||
const baseItems = { | ||
university: { | ||
en: { url: '/en', label: 'KTH' }, | ||
sv: { url: '/', label: 'KTH' }, | ||
}, | ||
student: { | ||
en: { url: '/en/student', label: 'Student at KTH' }, | ||
sv: { url: '/student', label: 'Student på KTH' }, | ||
}, | ||
directory: { | ||
en: { url: '/student/kurser/kurser-inom-program?l=en', label: 'Course and programme directory' }, | ||
sv: { url: '/student/kurser/kurser-inom-program', label: 'Kurs- och programkatalogen' }, | ||
}, | ||
} | ||
|
||
function createAboutCourseItem(language, courseCode) { | ||
const label = language === 'en' ? 'About course' : 'Om kursen' | ||
return { | ||
label: `${label} ${courseCode}`, | ||
url: `/student/kurser/kurs/${courseCode.toUpperCase()}?l=${language}`, | ||
} | ||
} | ||
|
||
function createBreadcrumbs(language, courseCode) { | ||
const items = [baseItems.university[language], baseItems.student[language], baseItems.directory[language]] | ||
if (courseCode) { | ||
items.push(createAboutCourseItem(language, courseCode)) | ||
} | ||
return items | ||
} | ||
|
||
module.exports = { | ||
createBreadcrumbs, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters