From 5acd203d63450b0b9e02fc0f7e6a08db227e9544 Mon Sep 17 00:00:00 2001 From: Matjaz Gregoric Date: Fri, 2 Oct 2015 09:42:04 +0200 Subject: [PATCH 1/2] Display course name in unenroll popup. Only the course number was displayed in the course unenrollment confirmation popup dialog. Include full course display name to make it more user friendly. --- lms/static/js/dashboard/legacy.js | 2 + .../dashboard/_dashboard_course_listing.html | 45 ++++++++++--------- 2 files changed, 25 insertions(+), 22 deletions(-) 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..94321f0bcf 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,7 @@ 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: ""}, true); document.getElementById('refund-info').innerHTML = refund_info; } From 9027474659afe4320505d74494ae7c3c62a662e9 Mon Sep 17 00:00:00 2001 From: Matjaz Gregoric Date: Mon, 19 Oct 2015 09:16:48 +0200 Subject: [PATCH 2/2] Use %()s style variable placeholder for cert name. Some strings were using both python-style {} placeholders as well as javascript-style %()s placeholders. That can be confusing for translators. Replace the python-style placeholder with a %()s one and interpolate the value using javascript. --- .../dashboard/_dashboard_course_listing.html | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lms/templates/dashboard/_dashboard_course_listing.html b/lms/templates/dashboard/_dashboard_course_listing.html index 94321f0bcf..0798c9d920 100644 --- a/lms/templates/dashboard/_dashboard_course_listing.html +++ b/lms/templates/dashboard/_dashboard_course_listing.html @@ -216,7 +216,7 @@ from student.helpers import ( % if not is_course_blocked: @@ -225,7 +225,7 @@ from student.helpers import ( % else: @@ -237,7 +237,7 @@ from student.helpers import ( % if not is_course_blocked: @@ -246,7 +246,7 @@ from student.helpers import ( % else: @@ -395,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: "", course_name: ""}, 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; }