diff --git a/cms/djangoapps/contentstore/views/certificates.py b/cms/djangoapps/contentstore/views/certificates.py index caab0b8a80..d515489f95 100644 --- a/cms/djangoapps/contentstore/views/certificates.py +++ b/cms/djangoapps/contentstore/views/certificates.py @@ -354,7 +354,9 @@ def certificates_list_handler(request, course_key_string): handler_name='certificates.certificate_activation_handler', course_key=course_key ) - course_modes = [mode.slug for mode in CourseMode.modes_for_course(course.id)] + course_modes = [mode.slug for mode in CourseMode.modes_for_course( + course_id=course.id, include_expired=True + )] certificate_web_view_url = get_lms_link_for_certificate_web_view( user_id=request.user.id, course_key=course_key, diff --git a/cms/static/js/certificates/spec/views/certificate_preview_spec.js b/cms/static/js/certificates/spec/views/certificate_preview_spec.js index 92018b484d..49bb93be17 100644 --- a/cms/static/js/certificates/spec/views/certificate_preview_spec.js +++ b/cms/static/js/certificates/spec/views/certificate_preview_spec.js @@ -49,7 +49,7 @@ function(_, $, Course, CertificatePreview, TemplateHelpers, ViewHelpers, AjaxHel appendSetFixtures(''); this.view = new CertificatePreview({ el: $('.preview-certificate'), - course_modes: ['test1', 'test2', 'test3'], + course_modes: ['test1', 'test2', 'test3', 'audit'], certificate_web_view_url: '/users/1/courses/orgX/009/2016?preview=test1', certificate_activation_handler_url: '/certificates/activation/'+ window.course.id, is_active: true @@ -59,6 +59,10 @@ function(_, $, Course, CertificatePreview, TemplateHelpers, ViewHelpers, AjaxHel describe('Certificate preview', function() { + it('course mode "audit" should not be render in preview list', function () { + expect(this.view.course_modes.indexOf('audit') < 0).toBe(true); + }); + it('course mode event should call when user choose a new mode', function () { spyOn(this.view, 'courseModeChanged'); this.view.delegateEvents(); diff --git a/cms/static/js/certificates/views/certificate_preview.js b/cms/static/js/certificates/views/certificate_preview.js index a86ef200ef..a895e16192 100644 --- a/cms/static/js/certificates/views/certificate_preview.js +++ b/cms/static/js/certificates/views/certificate_preview.js @@ -27,6 +27,8 @@ function(_, gettext, BaseView, ViewUtils, NotificationView) { }, render: function () { + // removing the course mode 'audit' from the preview list. + this.course_modes = _.without(this.course_modes, 'audit'); this.$el.html(this.template({ course_modes: this.course_modes, certificate_web_view_url: this.certificate_web_view_url,