Merge pull request #10007 from open-craft/unenroll-course-name
Display course name in course unenroll confirmation popup.
This commit is contained in:
@@ -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"));
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -165,7 +165,7 @@ from student.helpers import (
|
||||
% endif
|
||||
% endif
|
||||
<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>
|
||||
<i class="fa fa-cog" aria-hidden="true"></i>
|
||||
</a>
|
||||
@@ -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:
|
||||
<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')}
|
||||
</a>
|
||||
% 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}"
|
||||
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.")}')">
|
||||
<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_name)s (%(course_number)s)?")}', '${_("You will be refunded the amount you paid.")}')">
|
||||
${_('Unenroll')}
|
||||
</a>
|
||||
% 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:
|
||||
<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}"
|
||||
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.")}')">
|
||||
<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_name)s (%(course_number)s)?")}', '${_("You will not be refunded the amount you paid.")}')">
|
||||
${_('Unenroll')}
|
||||
</a>
|
||||
% 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}"
|
||||
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.")}')">
|
||||
<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_name)s (%(course_number)s)?")}', '${_("You will not be refunded the amount you paid.")}')">
|
||||
${_('Unenroll')}
|
||||
</a>
|
||||
% endif
|
||||
% elif enrollment.mode != "verified":
|
||||
## Translators: The course's name will be added to the end of this sentence.
|
||||
% 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}"
|
||||
onclick="set_unenroll_message('${_("Are you sure you want to unenroll from %(course_number)s?")}', '')">
|
||||
<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_name)s (%(course_number)s)?")}', '')">
|
||||
${_('Unenroll')}
|
||||
</a>
|
||||
% 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}"
|
||||
onclick="set_unenroll_message('${_("Are you sure you want to unenroll from %(course_number)s?")}', '')">
|
||||
<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_name)s (%(course_number)s)?")}', '')">
|
||||
${_('Unenroll')}
|
||||
</a>
|
||||
% endif
|
||||
% elif show_refund_option:
|
||||
## Translators: The course's name will be added to the end of this sentence.
|
||||
% 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 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)s track of %(course_name)s (%(course_number)s)?")}',
|
||||
'${_("You will be refunded the amount you paid.")}'
|
||||
)"
|
||||
>
|
||||
${_('Unenroll')}
|
||||
</a>
|
||||
% 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 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)s track of %(course_name)s (%(course_number)s)?")}',
|
||||
'${_("You will be refunded the amount you paid.")}'
|
||||
)"
|
||||
>
|
||||
@@ -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:
|
||||
<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 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)s track of %(course_name)s (%(course_number)s)?")}',
|
||||
'${_("The refund deadline for this course has passed, so you will not receive a refund.")}'
|
||||
)"
|
||||
>
|
||||
${_('Unenroll')}
|
||||
</a>
|
||||
% 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 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)s track of %(course_name)s (%(course_number)s)?")}',
|
||||
'${_("The refund deadline for this course has passed, so you will not receive a refund.")}'
|
||||
)"
|
||||
>
|
||||
@@ -354,10 +354,11 @@ from student.helpers import (
|
||||
contact_link_end='</a>',
|
||||
unenroll_link_start=(
|
||||
'<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(
|
||||
course_id=escape(course_overview.id),
|
||||
course_number=escape(course_overview.number),
|
||||
course_name=escape(course_overview.display_name_with_default),
|
||||
)
|
||||
),
|
||||
unenroll_link_end="</a>",
|
||||
@@ -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: "<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>",
|
||||
cert_name_long: "${cert_name_long | h}"
|
||||
}, true);
|
||||
document.getElementById('refund-info').innerHTML = refund_info;
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user