diff --git a/lms/static/js/dashboard/legacy.js b/lms/static/js/dashboard/legacy.js
index 998944029f..81bb1dacfb 100644
--- a/lms/static/js/dashboard/legacy.js
+++ b/lms/static/js/dashboard/legacy.js
@@ -7,7 +7,7 @@
*/
var edx = edx || {};
-(function($, gettext, Logger, accessibleModal) {
+(function($, gettext, Logger, accessibleModal, interpolate) {
'use strict';
edx.dashboard = edx.dashboard || {};
@@ -126,9 +126,18 @@
});
$(".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") );
+ var element = $(event.target);
+ var track_info = element.data("track-info");
+ var course_number = element.data("course-number");
+ var course_name = element.data("course-name");
+ var cert_name_long = element.data("cert-name-long");
+ $('#track-info').html(interpolate(track_info, {
+ course_number: "" + course_number + "",
+ course_name: "" + course_name + "",
+ cert_name_long: "" + cert_name_long + ""
+ }, true));
+ $('#refund-info').html( element.data("refund-info") );
+ $("#unenroll_course_id").val( element.data("course-id") );
});
$('#unenroll_form').on('ajax:complete', function(event, xhr) {
@@ -195,4 +204,4 @@
});
};
-})(jQuery, gettext, Logger, accessible_modal);
+})(jQuery, gettext, Logger, accessible_modal, interpolate); // jshint undef:false
diff --git a/lms/templates/dashboard/_dashboard_course_listing.html b/lms/templates/dashboard/_dashboard_course_listing.html
index 59db2b4213..50d45e7ae2 100644
--- a/lms/templates/dashboard/_dashboard_course_listing.html
+++ b/lms/templates/dashboard/_dashboard_course_listing.html
@@ -181,83 +181,70 @@ from student.helpers import (
% if cert_status.get('status') not in DISABLE_UNENROLL_CERT_STATES:
% if is_paid_course and show_refund_option:
- ## Translators: The course name will be added to the end of this sentence.
% if not is_course_blocked:
-
+
${_('Unenroll')}
% else:
+ data-track-info="${_("Are you sure you want to unenroll from the purchased course %(course_name)s (%(course_number)s)?") | h}"
+ data-refund-info="${_("You will be refunded the amount you paid.") | h}">
${_('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:
+ data-track-info="${_("Are you sure you want to unenroll from the purchased course %(course_name)s (%(course_number)s)?") | h}"
+ data-refund-info="${_("You will not be refunded the amount you paid.") | h}">
${_('Unenroll')}
% else:
+ data-track-info="${_("Are you sure you want to unenroll from the purchased course %(course_name)s (%(course_number)s)?") | h}"
+ data-refund-info="${_("You will not be refunded the amount you paid.") | h}">
${_('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:
+ data-track-info="${_("Are you sure you want to unenroll from %(course_name)s (%(course_number)s)?") | h}">
${_('Unenroll')}
% else:
+ data-track-info="${_("Are you sure you want to unenroll from %(course_name)s (%(course_number)s)?") | h}">
${_('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:
-
+
${_('Unenroll')}
% endif
% else:
- ## Translators: The course's name will be added to the end of this sentence.
% if not is_course_blocked:
-
+
${_('Unenroll')}
% else:
-
+
${_('Unenroll')}
% endif
@@ -403,13 +390,4 @@ from student.helpers import (
});
}
});
-
- function set_unenroll_message(track_info, refund_info) {
- 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;
- }