diff --git a/common/test/acceptance/tests/lms/test_lms_instructor_dashboard.py b/common/test/acceptance/tests/lms/test_lms_instructor_dashboard.py index 1b2e3e9a21..4b75fc6506 100644 --- a/common/test/acceptance/tests/lms/test_lms_instructor_dashboard.py +++ b/common/test/acceptance/tests/lms/test_lms_instructor_dashboard.py @@ -737,7 +737,7 @@ class CertificatesTest(BaseInstructorDashboardTest): self.certificates_section.add_certificate_exception(self.user_name, '') self.assertIn( - 'User (username/email={user}) already in exception list.'.format(user=self.user_name), + '{user} already in exception list.'.format(user=self.user_name), self.certificates_section.message.text ) @@ -784,8 +784,7 @@ class CertificatesTest(BaseInstructorDashboardTest): self.certificates_section.wait_for_ajax() self.assertIn( - "We can't find the user (username/email={user}) you've entered. " - "Make sure the username or email address is correct, then try again.".format(user=invalid_user), + "{user} does not exist in the LMS. Please check your spelling and retry.".format(user=invalid_user), self.certificates_section.message.text ) @@ -818,8 +817,7 @@ class CertificatesTest(BaseInstructorDashboardTest): self.certificates_section.wait_for_ajax() self.assertIn( - "The user (username/email={user}) you have entered is not enrolled in this course. " - "Make sure the username or email address is correct, then try again.".format(user=new_user), + "{user} is not enrolled in this course. Please check your spelling and retry.".format(user=new_user), self.certificates_section.message.text ) @@ -840,6 +838,7 @@ class CertificatesTest(BaseInstructorDashboardTest): self.certificates_section.wait_for_ajax() self.assertIn( - 'Certificate generation started for white listed students.', + self.user_name + ' has been successfully added to the exception list. Click Generate Exception Certificate' + ' below to send the certificate.', self.certificates_section.message.text ) diff --git a/lms/djangoapps/instructor/tests/test_certificates.py b/lms/djangoapps/instructor/tests/test_certificates.py index 2eb17e1e42..7f74b2b144 100644 --- a/lms/djangoapps/instructor/tests/test_certificates.py +++ b/lms/djangoapps/instructor/tests/test_certificates.py @@ -474,8 +474,7 @@ class CertificateExceptionViewInstructorApiTest(SharedModuleStoreTestCase): # Assert Error Message self.assertEqual( res_json['message'], - u"We can't find the user (username/email={user}) you've entered. " - u"Make sure the username or email address is correct, then try again.".format(user=invalid_user) + u"{user} does not exist in the LMS. Please check your spelling and retry.".format(user=invalid_user) ) def test_certificate_exception_missing_username_and_email_error(self): @@ -501,7 +500,7 @@ class CertificateExceptionViewInstructorApiTest(SharedModuleStoreTestCase): self.assertEqual( res_json['message'], u'Student username/email field is required and can not be empty. ' - u'Kindly fill in username/email and then press "Add Exception" button.' + u'Kindly fill in username/email and then press "Add to Exception List" button.' ) def test_certificate_exception_duplicate_user_error(self): @@ -591,8 +590,7 @@ class CertificateExceptionViewInstructorApiTest(SharedModuleStoreTestCase): # Assert Error Message self.assertEqual( res_json['message'], - "The user (username/email={user}) you have entered is not enrolled in this course. " - "Make sure the username or email address is correct, then try again.".format( + "{user} is not enrolled in this course. Please check your spelling and retry.".format( user=self.certificate_exception['user_name'] ) ) @@ -646,7 +644,7 @@ class CertificateExceptionViewInstructorApiTest(SharedModuleStoreTestCase): # Assert Error Message self.assertEqual( res_json['message'], - u"Invalid Json data, Please refresh the page and then try again." + u"The record is not in the correct format. Please add a valid username or email address." ) def test_remove_certificate_exception_non_existing_error(self): diff --git a/lms/djangoapps/instructor/views/api.py b/lms/djangoapps/instructor/views/api.py index f688923477..53035e8e69 100644 --- a/lms/djangoapps/instructor/views/api.py +++ b/lms/djangoapps/instructor/views/api.py @@ -2839,22 +2839,21 @@ def parse_request_data_and_get_user(request, course_key): try: certificate_exception = json.loads(request.body or '{}') except ValueError: - raise ValueError(_('Invalid Json data, Please refresh the page and then try again.')) + raise ValueError(_('The record is not in the correct format. Please add a valid username or email address.')) user = certificate_exception.get('user_name', '') or certificate_exception.get('user_email', '') if not user: raise ValueError(_('Student username/email field is required and can not be empty. ' - 'Kindly fill in username/email and then press "Add Exception" button.')) + 'Kindly fill in username/email and then press "Add to Exception List" button.')) try: db_user = get_user_by_username_or_email(user) except ObjectDoesNotExist: - raise ValueError(_("We can't find the user (username/email={user}) you've entered. " - "Make sure the username or email address is correct, then try again.").format(user=user)) + raise ValueError(_("{user} does not exist in the LMS. Please check your spelling and retry.").format(user=user)) # Make Sure the given student is enrolled in the course if not CourseEnrollment.is_enrolled(db_user, course_key): - raise ValueError(_("The user (username/email={user}) you have entered is not enrolled in this course. " - "Make sure the username or email address is correct, then try again.").format(user=user)) + raise ValueError(_("{user} is not enrolled in this course. Please check your spelling and retry.") + .format(user=user)) return certificate_exception, db_user diff --git a/lms/static/js/certificates/views/certificate_bulk_whitelist.js b/lms/static/js/certificates/views/certificate_bulk_whitelist.js index 4d340f36f4..73e6bc6585 100644 --- a/lms/static/js/certificates/views/certificate_bulk_whitelist.js +++ b/lms/static/js/certificates/views/certificate_bulk_whitelist.js @@ -32,7 +32,8 @@ el: DOM_SELECTORS.bulk_exception, events: { 'change #browseBtn': 'chooseFile', - 'click .upload-csv-button': 'uploadCSV' + 'click .upload-csv-button': 'uploadCSV', + 'click a.arrow': 'toggleMessageDetails' }, initialize: function(options){ @@ -72,19 +73,22 @@ }, display_response: function(data_from_server) { - $(".results").empty(); + $(".bulk-exception-results").removeClass('hidden').empty(); // Display general error messages if (data_from_server.general_errors.length) { var errors = data_from_server.general_errors; - generate_div('msg-error', MESSAGE_GROUP.general_errors, gettext('Errors!'), errors); + generate_div( + MESSAGE_GROUP.general_errors, + gettext('Uploaded file issues. Click on "+" to view.'), + errors + ); } // Display success message if (data_from_server.success.length) { var success_data = data_from_server.success; generate_div( - 'msg-success', MESSAGE_GROUP.successfully_added, get_text(success_data.length, MESSAGE_GROUP.successfully_added), success_data @@ -98,7 +102,6 @@ if (row_errors.data_format_error.length) { var format_errors = row_errors.data_format_error; generate_div( - 'msg-error', MESSAGE_GROUP.data_format_error, get_text(format_errors.length, MESSAGE_GROUP.data_format_error), format_errors @@ -107,7 +110,6 @@ if (row_errors.user_not_exist.length) { var user_not_exist = row_errors.user_not_exist; generate_div( - 'msg-error', MESSAGE_GROUP.user_not_exist, get_text(user_not_exist.length, MESSAGE_GROUP.user_not_exist), user_not_exist @@ -116,7 +118,6 @@ if (row_errors.user_already_white_listed.length) { var user_already_white_listed = row_errors.user_already_white_listed; generate_div( - 'msg-error', MESSAGE_GROUP.user_already_white_listed, get_text(user_already_white_listed.length, MESSAGE_GROUP.user_already_white_listed), user_already_white_listed @@ -125,7 +126,6 @@ if (row_errors.user_not_enrolled.length) { var user_not_enrolled = row_errors.user_not_enrolled; generate_div( - 'msg-error', MESSAGE_GROUP.user_not_enrolled, get_text(user_not_enrolled.length, MESSAGE_GROUP.user_not_enrolled), user_not_enrolled @@ -133,17 +133,22 @@ } } - function generate_div(div_class, group, heading, display_data) { + function generate_div(group, heading, display_data) { // inner function generate div and display response messages. $('
', { - class: 'message ' + div_class + ' ' + group - }).appendTo('.results').prepend( "" + heading + "" ); + class: 'message ' + group + }).appendTo('.bulk-exception-results').prepend( + " + " + heading + ).append($('