course title link to course home when enrolled

This commit is contained in:
McKenzie Welter
2017-12-22 12:23:28 -05:00
parent 97ba86da7c
commit 82fb6e7ec0
3 changed files with 26 additions and 17 deletions

View File

@@ -185,6 +185,7 @@
setActiveCourseRun: function(courseRun, userPreferences) {
var startDateString,
courseTitleLink = '',
isEnrolled = this.isEnrolledInSession() && courseRun.key;
if (courseRun) {
if (this.valueIsDefined(courseRun.advertised_start)) {
@@ -192,6 +193,11 @@
} else {
startDateString = this.formatDate(courseRun.start, userPreferences);
}
if (isEnrolled && courseRun.course_url) {
courseTitleLink = courseRun.course_url;
} else if (!isEnrolled && courseRun.marketing_url) {
courseTitleLink = courseRun.marketing_url;
}
this.set({
certificate_url: courseRun.certificate_url,
course_run_key: courseRun.key || '',
@@ -210,7 +216,8 @@
start_date: startDateString,
upcoming_course_runs: this.getUpcomingCourseRuns(),
upgrade_url: courseRun.upgrade_url,
price: this.getCertificatePriceString(courseRun)
price: this.getCertificatePriceString(courseRun),
course_title_link: courseTitleLink
});
// This is used to render the date for completed and in progress courses