Commit 7b346f7d by zubair-arbi

Merge pull request #9441 from edx/zub/bugfix/ecom-2066-fix-error-display-on-getting-course-name

display course id instead of name in course name placeholder, if ajax…
parents c11049ee 8ca590d4
......@@ -32,7 +32,7 @@ var edx = edx || {};
providerId;
// Add the receipt info to the template context
this.courseKey = this.getOrderCourseKey(data)
this.courseKey = this.getOrderCourseKey(data);
this.username = this.$el.data('username');
_.extend(context, {
receipt: this.receiptContext(data),
......@@ -43,15 +43,21 @@ var edx = edx || {};
this.trackLinks();
this.getCourseData(this.courseKey).then(this.renderCourse, this.renderError)
this.renderCourseNamePlaceholder(this.courseKey);
providerId = this.getCreditProviderId(data);
if (providerId) {
this.getProviderData(providerId).then(this.renderProvider, this.renderError)
}
},
renderCourse: function(course) {
$(".course_name_placeholder").text(course.name);
renderCourseNamePlaceholder: function(courseId) {
// Display the course Id or name (if available) in the placeholder
var $courseNamePlaceholder = $(".course_name_placeholder");
$courseNamePlaceholder.text(courseId);
this.getCourseData(courseId).then(function(responseData) {
$courseNamePlaceholder.text(responseData.name);
});
},
renderProvider: function (context) {
var templateHtml = $("#provider-tpl").html(),
......@@ -136,7 +142,7 @@ var edx = edx || {};
url: _.sprintf(courseDetailUrl, courseId),
type: 'GET',
dataType: 'json'
}).retry({times: 5, timeout: 2000, statusCodes: [404]});
});
},
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment