diff --git a/lms/static/js/dashboard/legacy.js b/lms/static/js/dashboard/legacy.js index 3d7d8d2fa6..998944029f 100644 --- a/lms/static/js/dashboard/legacy.js +++ b/lms/static/js/dashboard/legacy.js @@ -128,6 +128,7 @@ $(".action-unenroll").click(function(event) { $("#unenroll_course_id").val( $(event.target).data("course-id") ); $("#unenroll_course_number").text( $(event.target).data("course-number") ); + $("#unenroll_course_name").text( $(event.target).data("course-name") ); }); $('#unenroll_form').on('ajax:complete', function(event, xhr) { @@ -190,6 +191,7 @@ $("#unregister_block_course").click( function(event) { $("#unenroll_course_id").val($(event.target).data("course-id")); $("#unenroll_course_number").text($(event.target).data("course-number")); + $("#unenroll_course_name").text($(event.target).data("course-name")); }); }; diff --git a/lms/templates/dashboard/_dashboard_course_listing.html b/lms/templates/dashboard/_dashboard_course_listing.html index 84331a8f93..0798c9d920 100644 --- a/lms/templates/dashboard/_dashboard_course_listing.html +++ b/lms/templates/dashboard/_dashboard_course_listing.html @@ -165,7 +165,7 @@ from student.helpers import ( % endif % endif
- @@ -176,56 +176,56 @@ from student.helpers import ( ## Translators: The course name will be added to the end of this sentence. % if not is_course_blocked: + onclick="set_unenroll_message('${_("Are you sure you want to unenroll from the purchased course %(course_name)s ($(course_number)s)?")}', '${_("You will be refunded the amount you paid.")}')"> ${_('Unenroll')} % else: - + ${_('Unenroll')} % endif % elif is_paid_course and not show_refund_option: ## Translators: The course's name will be added to the end of this sentence. % if not is_course_blocked: - + ${_('Unenroll')} % else: - + ${_('Unenroll')} % endif % elif enrollment.mode != "verified": ## Translators: The course's name will be added to the end of this sentence. % if not is_course_blocked: - + ${_('Unenroll')} % else: - + ${_('Unenroll')} % endif % elif show_refund_option: ## Translators: The course's name will be added to the end of this sentence. % if not is_course_blocked: - ${_('Unenroll')} % else: - @@ -235,18 +235,18 @@ from student.helpers import ( % else: ## Translators: The course's name will be added to the end of this sentence. % if not is_course_blocked: - ${_('Unenroll')} % else: - @@ -354,10 +354,11 @@ from student.helpers import ( contact_link_end='', unenroll_link_start=( ''.format( course_id=escape(course_overview.id), course_number=escape(course_overview.number), + course_name=escape(course_overview.display_name_with_default), ) ), unenroll_link_end="", @@ -394,7 +395,11 @@ from student.helpers import ( }); function set_unenroll_message(track_info, refund_info) { - document.getElementById('track-info').innerHTML = interpolate(track_info, {course_number: ""}, true); + document.getElementById('track-info').innerHTML = interpolate(track_info, { + course_number: "", + course_name: "", + cert_name_long: "${cert_name_long | h}" + }, true); document.getElementById('refund-info').innerHTML = refund_info; }