Commit 5acd203d by Matjaz Gregoric

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.
parent d26d03da
...@@ -128,6 +128,7 @@ ...@@ -128,6 +128,7 @@
$(".action-unenroll").click(function(event) { $(".action-unenroll").click(function(event) {
$("#unenroll_course_id").val( $(event.target).data("course-id") ); $("#unenroll_course_id").val( $(event.target).data("course-id") );
$("#unenroll_course_number").text( $(event.target).data("course-number") ); $("#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) { $('#unenroll_form').on('ajax:complete', function(event, xhr) {
...@@ -190,6 +191,7 @@ ...@@ -190,6 +191,7 @@
$("#unregister_block_course").click( function(event) { $("#unregister_block_course").click( function(event) {
$("#unenroll_course_id").val($(event.target).data("course-id")); $("#unenroll_course_id").val($(event.target).data("course-id"));
$("#unenroll_course_number").text($(event.target).data("course-number")); $("#unenroll_course_number").text($(event.target).data("course-number"));
$("#unenroll_course_name").text($(event.target).data("course-name"));
}); });
}; };
......
...@@ -165,7 +165,7 @@ from student.helpers import ( ...@@ -165,7 +165,7 @@ from student.helpers import (
% endif % endif
% endif % endif
<div class="wrapper-action-more"> <div class="wrapper-action-more">
<a href="#actions-dropdown-${dashboard_index}" class="action action-more" id="actions-dropdown-link-${dashboard_index}" aria-haspopup="true" aria-expanded="false" data-course-number="${course_overview.number | h}" data-dashboard-index="${dashboard_index}"> <a href="#actions-dropdown-${dashboard_index}" class="action action-more" id="actions-dropdown-link-${dashboard_index}" aria-haspopup="true" aria-expanded="false" data-course-number="${course_overview.number | h}" data-course-name="${course_overview.display_name_with_default | h}" data-dashboard-index="${dashboard_index}">
<span class="sr">${_('Course options dropdown')}</span> <span class="sr">${_('Course options dropdown')}</span>
<i class="fa fa-cog" aria-hidden="true"></i> <i class="fa fa-cog" aria-hidden="true"></i>
</a> </a>
...@@ -176,56 +176,56 @@ from student.helpers import ( ...@@ -176,56 +176,56 @@ from student.helpers import (
## Translators: The course name will be added to the end of this sentence. ## Translators: The course name will be added to the end of this sentence.
% if not is_course_blocked: % if not is_course_blocked:
<a href="#unenroll-modal" class="action action-unenroll" rel="leanModal" data-course-id="${course_overview.id | h}" data-course_overview-number="${course_overview.number | h}" data-dashboard-index="${dashboard_index}" <a href="#unenroll-modal" class="action action-unenroll" rel="leanModal" data-course-id="${course_overview.id | h}" data-course_overview-number="${course_overview.number | h}" data-dashboard-index="${dashboard_index}"
onclick="set_unenroll_message('${_("Are you sure you want to unenroll from the purchased course %(course_number)s?")}', '${_("You will be refunded the amount you paid.")}')"> 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')} ${_('Unenroll')}
</a> </a>
% else: % else:
<a class="action action-unenroll is-disabled" data-course-id="${course_overview.id | h}" data-course-number="${course_overview.number | h}" data-dashboard-index="${dashboard_index}" <a class="action action-unenroll is-disabled" data-course-id="${course_overview.id | h}" data-course-number="${course_overview.number | h}" data-course-name="${course_overview.display_name_with_default | h}" data-dashboard-index="${dashboard_index}"
onclick="set_unenroll_message('${_("Are you sure you want to unenroll from the purchased course %(course_number)s?")}', '${_("You will be refunded the amount you paid.")}')"> 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')} ${_('Unenroll')}
</a> </a>
% endif % endif
% elif is_paid_course and not show_refund_option: % elif is_paid_course and not show_refund_option:
## Translators: The course's name will be added to the end of this sentence. ## Translators: The course's name will be added to the end of this sentence.
% if not is_course_blocked: % if not is_course_blocked:
<a href="#unenroll-modal" class="action action-unenroll" rel="leanModal" data-course-id="${course_overview.id | h}" data-course-number="${course_overview.number | h}" data-dashboard-index="${dashboard_index}" <a href="#unenroll-modal" class="action action-unenroll" rel="leanModal" data-course-id="${course_overview.id | h}" data-course-number="${course_overview.number | h}" data-course-name="${course_overview.display_name_with_default | h}" data-dashboard-index="${dashboard_index}"
onclick="set_unenroll_message('${_("Are you sure you want to unenroll from the purchased course %(course_number)s?")}', '${_("You will not be refunded the amount you paid.")}')"> onclick="set_unenroll_message('${_("Are you sure you want to unenroll from the purchased course %(course_name)s (%(course_number)s)?")}', '${_("You will not be refunded the amount you paid.")}')">
${_('Unenroll')} ${_('Unenroll')}
</a> </a>
% else: % else:
<a class="action action-unenroll is-disabled" data-course-id="${course_overview.id | h}" data-course-number="${course_overview.number | h}" data-dashboard-index="${dashboard_index}" <a class="action action-unenroll is-disabled" data-course-id="${course_overview.id | h}" data-course-number="${course_overview.number | h}" data-course-name="${course_overview.display_name_with_default | h}" data-dashboard-index="${dashboard_index}"
onclick="set_unenroll_message('${_("Are you sure you want to unenroll from the purchased course %(course_number)s?")}', '${_("You will not be refunded the amount you paid.")}')"> onclick="set_unenroll_message('${_("Are you sure you want to unenroll from the purchased course %(course_name)s (%(course_number)s)?")}', '${_("You will not be refunded the amount you paid.")}')">
${_('Unenroll')} ${_('Unenroll')}
</a> </a>
% endif % endif
% elif enrollment.mode != "verified": % elif enrollment.mode != "verified":
## Translators: The course's name will be added to the end of this sentence. ## Translators: The course's name will be added to the end of this sentence.
% if not is_course_blocked: % if not is_course_blocked:
<a href="#unenroll-modal" class="action action-unenroll" rel="leanModal" data-course-id="${course_overview.id | h}" data-course-number="${course_overview.number | h}" data-dashboard-index="${dashboard_index}" <a href="#unenroll-modal" class="action action-unenroll" rel="leanModal" data-course-id="${course_overview.id | h}" data-course-number="${course_overview.number | h}" data-course-name="${course_overview.display_name_with_default | h}" data-dashboard-index="${dashboard_index}"
onclick="set_unenroll_message('${_("Are you sure you want to unenroll from %(course_number)s?")}', '')"> onclick="set_unenroll_message('${_("Are you sure you want to unenroll from %(course_name)s (%(course_number)s)?")}', '')">
${_('Unenroll')} ${_('Unenroll')}
</a> </a>
% else: % else:
<a class="action action-unenroll is-disabled" data-course-id="${course_overview.id | h}" data-course-number="${course_overview.number | h}" data-dashboard-index="${dashboard_index}" <a class="action action-unenroll is-disabled" data-course-id="${course_overview.id | h}" data-course-number="${course_overview.number | h}" data-course-name="${course_overview.display_name_with_default | h}" data-dashboard-index="${dashboard_index}"
onclick="set_unenroll_message('${_("Are you sure you want to unenroll from %(course_number)s?")}', '')"> onclick="set_unenroll_message('${_("Are you sure you want to unenroll from %(course_name)s (%(course_number)s)?")}', '')">
${_('Unenroll')} ${_('Unenroll')}
</a> </a>
% endif % endif
% elif show_refund_option: % elif show_refund_option:
## Translators: The course's name will be added to the end of this sentence. ## Translators: The course's name will be added to the end of this sentence.
% if not is_course_blocked: % if not is_course_blocked:
<a href="#unenroll-modal" class="action action-unenroll" rel="leanModal" data-course-id="${course_overview.id | h}" data-course-number="${course_overview.number | h}" data-dashboard-index="${dashboard_index}" <a href="#unenroll-modal" class="action action-unenroll" rel="leanModal" data-course-id="${course_overview.id | h}" data-course-number="${course_overview.number | h}" data-course-name="${course_overview.display_name_with_default | h}" data-dashboard-index="${dashboard_index}"
onclick="set_unenroll_message( onclick="set_unenroll_message(
'${_("Are you sure you want to unenroll from the verified {cert_name_long} track of %(course_number)s?").format(cert_name_long=cert_name_long)}', '${_("Are you sure you want to unenroll from the verified {cert_name_long} track of %(course_name)s (%(course_number)s)?").format(cert_name_long=cert_name_long)}',
'${_("You will be refunded the amount you paid.")}' '${_("You will be refunded the amount you paid.")}'
)" )"
> >
${_('Unenroll')} ${_('Unenroll')}
</a> </a>
% else: % else:
<a class="action action-unenroll is-disabled" data-course-id="${course_overview.id | h}" data-course-number="${course_overview.number | h}" data-dashboard-index="${dashboard_index}" <a class="action action-unenroll is-disabled" data-course-id="${course_overview.id | h}" data-course-number="${course_overview.number | h}" data-course-name="${course_overview.display_name_with_default | h}" data-dashboard-index="${dashboard_index}"
onclick="set_unenroll_message( onclick="set_unenroll_message(
'${_("Are you sure you want to unenroll from the verified {cert_name_long} track of %(course_number)s?").format(cert_name_long=cert_name_long)}', '${_("Are you sure you want to unenroll from the verified {cert_name_long} track of %(course_name)s (%(course_number)s)?").format(cert_name_long=cert_name_long)}',
'${_("You will be refunded the amount you paid.")}' '${_("You will be refunded the amount you paid.")}'
)" )"
> >
...@@ -235,18 +235,18 @@ from student.helpers import ( ...@@ -235,18 +235,18 @@ from student.helpers import (
% else: % else:
## Translators: The course's name will be added to the end of this sentence. ## Translators: The course's name will be added to the end of this sentence.
% if not is_course_blocked: % if not is_course_blocked:
<a href="#unenroll-modal" class="action action-unenroll" rel="leanModal" data-course-id="${course_overview.id | h}" data-course-number="${course_overview.number | h}" data-dashboard-index="${dashboard_index}" <a href="#unenroll-modal" class="action action-unenroll" rel="leanModal" data-course-id="${course_overview.id | h}" data-course-number="${course_overview.number | h}" data-course-name="${course_overview.display_name_with_default | h}" data-dashboard-index="${dashboard_index}"
onclick="set_unenroll_message( onclick="set_unenroll_message(
'${_("Are you sure you want to unenroll from the verified {cert_name_long} track of %(course_number)s?").format(cert_name_long=cert_name_long)}', '${_("Are you sure you want to unenroll from the verified {cert_name_long} track of %(course_name)s (%(course_number)s)?").format(cert_name_long=cert_name_long)}',
'${_("The refund deadline for this course has passed, so you will not receive a refund.")}' '${_("The refund deadline for this course has passed, so you will not receive a refund.")}'
)" )"
> >
${_('Unenroll')} ${_('Unenroll')}
</a> </a>
% else: % else:
<a class="action action-unenroll is-disabled" data-course-id="${course_overview.id | h}" data-course-number="${course_overview.number | h}" data-dashboard-index="${dashboard_index}" <a class="action action-unenroll is-disabled" data-course-id="${course_overview.id | h}" data-course-number="${course_overview.number | h}" data-course-name="${course_overview.display_name_with_default | h}" data-dashboard-index="${dashboard_index}"
onclick="set_unenroll_message( onclick="set_unenroll_message(
'${_("Are you sure you want to unenroll from the verified {cert_name_long} track of %(course_number)s?").format(cert_name_long=cert_name_long)}', '${_("Are you sure you want to unenroll from the verified {cert_name_long} track of %(course_name)s (%(course_number)s)?").format(cert_name_long=cert_name_long)}',
'${_("The refund deadline for this course has passed, so you will not receive a refund.")}' '${_("The refund deadline for this course has passed, so you will not receive a refund.")}'
)" )"
> >
...@@ -354,10 +354,11 @@ from student.helpers import ( ...@@ -354,10 +354,11 @@ from student.helpers import (
contact_link_end='</a>', contact_link_end='</a>',
unenroll_link_start=( unenroll_link_start=(
'<a id="unregister_block_course" rel="leanModal" ' '<a id="unregister_block_course" rel="leanModal" '
'data-course-id="{course_id}" data-course-number="{course_number}" ' 'data-course-id="{course_id}" data-course-number="{course_number}" data-course-name="{course_name}" '
'href="#unenroll-modal">'.format( 'href="#unenroll-modal">'.format(
course_id=escape(course_overview.id), course_id=escape(course_overview.id),
course_number=escape(course_overview.number), course_number=escape(course_overview.number),
course_name=escape(course_overview.display_name_with_default),
) )
), ),
unenroll_link_end="</a>", unenroll_link_end="</a>",
...@@ -394,7 +395,7 @@ from student.helpers import ( ...@@ -394,7 +395,7 @@ from student.helpers import (
}); });
function set_unenroll_message(track_info, refund_info) { function set_unenroll_message(track_info, refund_info) {
document.getElementById('track-info').innerHTML = interpolate(track_info, {course_number: "<span id='unenroll_course_number'></span>"}, true); document.getElementById('track-info').innerHTML = interpolate(track_info, {course_number: "<span id='unenroll_course_number'></span>", course_name: "<span id='unenroll_course_name'></span>"}, true);
document.getElementById('refund-info').innerHTML = refund_info; document.getElementById('refund-info').innerHTML = refund_info;
} }
</script> </script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment