diff --git a/cms/djangoapps/contentstore/views/certificates.py b/cms/djangoapps/contentstore/views/certificates.py
index 3c43ab1065ad..0c3a6e6a5320 100644
--- a/cms/djangoapps/contentstore/views/certificates.py
+++ b/cms/djangoapps/contentstore/views/certificates.py
@@ -231,6 +231,8 @@ def serialize_certificate(certificate):
# Some keys are not required, such as the title override...
if certificate_data.get('course_title'):
certificate_response["course_title"] = certificate_data['course_title']
+ if certificate_data.get('course_description'):
+ certificate_response['course_description'] = certificate_data['course_description']
return certificate_response
diff --git a/cms/static/js/certificates/models/certificate.js b/cms/static/js/certificates/models/certificate.js
index 8ca59d7b095c..70f716c05d35 100644
--- a/cms/static/js/certificates/models/certificate.js
+++ b/cms/static/js/certificates/models/certificate.js
@@ -19,6 +19,7 @@ function(_, Backbone, BackboneRelational, BackboneAssociations, gettext, CoffeeS
defaults: {
// Metadata fields currently displayed in web forms
course_title: '',
+ course_description: '',
// Metadata fields not currently displayed in web forms
name: 'Name of the certificate',
diff --git a/cms/static/js/certificates/views/certificate_editor.js b/cms/static/js/certificates/views/certificate_editor.js
index e81da1b2b4ad..06b61ca58f7e 100644
--- a/cms/static/js/certificates/views/certificate_editor.js
+++ b/cms/static/js/certificates/views/certificate_editor.js
@@ -24,6 +24,7 @@ function($, _, Backbone, gettext,
'change .collection-name-input': 'setName',
'change .certificate-description-input': 'setDescription',
'change .certificate-course-title-input': 'setCourseTitle',
+ 'change .certificate-course-description-input': 'setCourseDescription',
'focus .input-text': 'onFocus',
'blur .input-text': 'onBlur',
submit: 'setAndClose',
@@ -103,6 +104,7 @@ function($, _, Backbone, gettext,
name: this.model.get('name'),
description: this.model.get('description'),
course_title: this.model.get('course_title'),
+ course_description: this.model.get('course_description'),
org_logo_path: this.model.get('org_logo_path'),
is_active: this.model.get('is_active'),
isNew: this.model.isNew()
@@ -143,11 +145,22 @@ function($, _, Backbone, gettext,
);
},
+ setCourseDescription: function(event) {
+ // Updates the indicated model field (still requires persistence on server)
+ if (event && event.preventDefault) { event.preventDefault(); }
+ this.model.set(
+ 'course_description',
+ this.$('.certificate-course-description-input').val(),
+ {silent: true}
+ );
+ },
+
setValues: function() {
// Update the specified values in the local model instance
this.setName();
this.setDescription();
this.setCourseTitle();
+ this.setCourseDescription();
return this;
}
});
diff --git a/cms/templates/js/certificate-details.underscore b/cms/templates/js/certificate-details.underscore
index a09a3baf897c..3401fd175a39 100644
--- a/cms/templates/js/certificate-details.underscore
+++ b/cms/templates/js/certificate-details.underscore
@@ -29,6 +29,12 @@
<%- course_title %>
<% } %>
+ <% if (course_description) { %>
+
+ <%- gettext('Course Description') %>:
+ <%- course_description %>
+
+ <% } %>
diff --git a/cms/templates/js/certificate-editor.underscore b/cms/templates/js/certificate-editor.underscore
index 513113b80500..3b1d90969b5a 100644
--- a/cms/templates/js/certificate-editor.underscore
+++ b/cms/templates/js/certificate-editor.underscore
@@ -31,6 +31,11 @@
" value="<%- course_title %>" aria-describedby="certificate-course-title-<%-uniqueId %>-tip" />
<%- gettext("Specify an alternative to the official course title to display on certificates. Leave blank to use the official course title.") %>
+
+ <%- gettext("Course Description") %>
+ " value="<%- course_description %>" aria-describedby="certificate-course-description-<%-uniqueId %>-tip" />
+ <%- gettext("Specify an alternative to the official course description to display on certificates. Leave blank to use default text.") %>
+
<%- gettext("Certificate Signatories") %>
diff --git a/lms/djangoapps/certificates/tests/test_webview_views.py b/lms/djangoapps/certificates/tests/test_webview_views.py
index 4d0cc82626af..be213ee3aef6 100644
--- a/lms/djangoapps/certificates/tests/test_webview_views.py
+++ b/lms/djangoapps/certificates/tests/test_webview_views.py
@@ -140,6 +140,7 @@ def _add_course_certificates(self, count=1, signatory_count=0, is_active=True):
'name': 'Name ' + str(i),
'description': 'Description ' + str(i),
'course_title': 'course_title_' + str(i),
+ 'course_description': 'course_description_' + str(i),
'org_logo_path': f'/t4x/orgX/testX/asset/org-logo-{i}.png',
'signatories': signatories,
'version': 1,
@@ -460,11 +461,6 @@ def test_rendering_course_organization_data(self):
uuid=self.cert.verify_uuid
)
response = self.client.get(test_url)
- self.assertContains(
- response,
- 'a course of study offered by test_organization, an online learning initiative of test organization',
- )
- self.assertNotContains(response, 'a course of study offered by testorg')
self.assertContains(response, f'test_organization {self.course.number} Certificate |')
self.assertContains(response, 'logo_test1.png')
@@ -549,21 +545,13 @@ def test_rendering_maximum_data(self):
self.assertContains(response, '')
# Test an item from course info
self.assertContains(response, 'course_title_0')
+ # Test an item from course description
+ self.assertContains(response, 'course_description_0')
# Test an item from user info
self.assertContains(response, f"{self.user.profile.name}, you earned a certificate!")
# Test an item from social info
self.assertContains(response, "Post on Facebook")
self.assertContains(response, "Share on Twitter")
- # Test an item from certificate/org info
- self.assertContains(
- response,
- "a course of study offered by {partner_short_name}, "
- "an online learning initiative of "
- "{partner_long_name}.".format(
- partner_short_name=short_org_name,
- partner_long_name=long_org_name,
- ),
- )
# Test item from badge info
self.assertContains(response, "Add to Mozilla Backpack")
# Test item from site configuration
diff --git a/lms/djangoapps/certificates/views/webview.py b/lms/djangoapps/certificates/views/webview.py
index 4d99b7d7722d..01c89a69ee66 100644
--- a/lms/djangoapps/certificates/views/webview.py
+++ b/lms/djangoapps/certificates/views/webview.py
@@ -254,7 +254,10 @@ def _update_course_context(request, context, course, platform_name):
course_number = course.display_coursenumber if course.display_coursenumber else course.number
context['course_number'] = course_number
context['idv_enabled_for_certificates'] = settings.FEATURES.get('ENABLE_CERTIFICATES_IDV_REQUIREMENT')
- if context['organization_long_name']:
+ course_description_override = context['certificate_data'].get('course_description', '')
+ if course_description_override:
+ context['accomplishment_copy_course_description'] = course_description_override
+ elif context['organization_long_name']:
# Translators: This text represents the description of course
context['accomplishment_copy_course_description'] = _('a course of study offered by {partner_short_name}, '
'an online learning initiative of '