Skip to content

Commit

Permalink
MDL-77174 enrol: Update role manager to drop YUI confirm module
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed Jul 31, 2023
1 parent 95d8205 commit 650fb3b
Showing 1 changed file with 13 additions and 17 deletions.
30 changes: 13 additions & 17 deletions enrol/yui/rolemanager/rolemanager.js
Expand Up @@ -108,26 +108,22 @@ YUI.add('moodle-enrol-rolemanager', function(Y) {
}
});
},
removeRole : function(e, user, roleid) {
removeRole: function(e, user, roleid) {
e.halt();
var event = this.on('assignablerolesloaded', function(){
event.detach();
var confirmation = {
modal: true,
visible : false,
centered : true,
title : M.util.get_string('confirmunassigntitle', 'role'),
question : M.util.get_string('confirmunassign', 'role'),
yesLabel : M.util.get_string('confirmunassignyes', 'role'),
noLabel : M.util.get_string('confirmunassignno', 'role')
};
new M.core.confirm(confirmation)
.show()
.on('complete-yes', this.removeRoleCallback, this, user.get(USERID), roleid);
}, this);
require(['core/notification'], function(Notification) {
Notification.saveCancelPromise(
M.util.get_string('confirmation', 'admin'),
M.util.get_string('confirmunassign', 'role'),
M.util.get_string('confirmunassignyes', 'role')
).then(function() {
return this.removeRoleCallback(user.get(USERID), roleid);
}.bind(this)).catch(function() {
// User cancelled.
});
}.bind(this));
this._loadAssignableRoles();
},
removeRoleCallback : function(e, userid, roleid) {
removeRoleCallback: function(userid, roleid) {
Y.io(M.cfg.wwwroot+'/enrol/ajax.php', {
method:'POST',
data:'id='+this.get(COURSEID)+'&action=unassign&sesskey='+M.cfg.sesskey+'&role='+roleid+'&user='+userid,
Expand Down

0 comments on commit 650fb3b

Please sign in to comment.