Commit 21318d14 by David Baumgold

Add confirmation prompt when deleting a user from a course team

parent 2617b478
......@@ -162,6 +162,14 @@
<%block name="jsextra">
<script type="text/javascript">
window.section = new CMS.Models.Section({
id: "${context_course.id}",
name: "${context_course.display_name_with_default | h}",
url_name: "${context_course.location.name | h}",
org: "${context_course.location.org | h}",
num: "${context_course.location.course | h}",
revision: "${context_course.location.revision | h}"
});
var staffEmails = ${json.dumps([user.email for user in staff])};
var tplUserURL = "${reverse('course_team_user', kwargs=dict(
org=context_course.location.org,
......@@ -270,7 +278,16 @@
});
$('.remove-user').click(function() {
var url = tplUserURL.replace("@@EMAIL@@", $(this).data('id'))
var email = $(this).data('id');
var msg = new CMS.Views.Prompt.Warning({
title: gettext("Are you sure?"),
message: _.template(gettext("Are you sure you want to delete {email} from the course team for {course}?"), {email: email, course: section.get('name')}, {interpolate: /\{(.+?)\}/g}),
actions: {
primary: {
text: gettext("Delete"),
click: function(view) {
view.hide();
var url = tplUserURL.replace("@@EMAIL@@", email)
$.ajax({
url: url,
type: 'DELETE',
......@@ -302,6 +319,17 @@
prompt.show();
}
});
}
},
secondary: {
text: gettext("Cancel"),
click: function(view) {
view.hide();
}
}
}
});
msg.show();
});
$(".toggle-admin-role").click(function(e) {
......
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