MDL-77174 course: Update course move to drop YUI confirm usage

This commit is contained in:
Andrew Nicols 2023-02-08 11:53:59 +08:00
parent bee509fb81
commit 95d82058af
No known key found for this signature in database
GPG Key ID: 6D1E3157C8CFBF14
4 changed files with 44 additions and 50 deletions

View File

@ -1441,27 +1441,25 @@ Category.prototype = {
* @param {Course} course
*/
moveCourseTo: function(course) {
var self = this;
Y.use('moodle-core-notification-confirm', function() {
var confirm = new M.core.confirm({
title: M.util.get_string('confirm', 'moodle'),
question: M.util.get_string('confirmcoursemove', 'moodle', {
require(['core/notification'], function(Notification) {
Notification.saveCancelPromise(
M.util.get_string('confirmation', 'admin'),
M.util.get_string('confirmcoursemove', 'moodle',
{
course: course.getName(),
category: self.getName()
category: this.getName(),
}),
yesLabel: M.util.get_string('move', 'moodle'),
noLabel: M.util.get_string('cancel', 'moodle')
});
confirm.on('complete-yes', function() {
confirm.hide();
confirm.destroy();
M.util.get_string('move', 'moodle')
).then(function() {
this.get('console').performAjaxAction('movecourseintocategory', {
courseid: course.get('courseid'),
categoryid: this.get('categoryid'),
courseid: course.get('courseid')
}, this.completeMoveCourse, this);
}, self);
confirm.show();
return;
}.bind(this)).catch(function() {
// User cancelled.
});
}.bind(this));
},
/**

File diff suppressed because one or more lines are too long

View File

@ -1412,27 +1412,25 @@ Category.prototype = {
* @param {Course} course
*/
moveCourseTo: function(course) {
var self = this;
Y.use('moodle-core-notification-confirm', function() {
var confirm = new M.core.confirm({
title: M.util.get_string('confirm', 'moodle'),
question: M.util.get_string('confirmcoursemove', 'moodle', {
require(['core/notification'], function(Notification) {
Notification.saveCancelPromise(
M.util.get_string('confirmation', 'admin'),
M.util.get_string('confirmcoursemove', 'moodle',
{
course: course.getName(),
category: self.getName()
category: this.getName(),
}),
yesLabel: M.util.get_string('move', 'moodle'),
noLabel: M.util.get_string('cancel', 'moodle')
});
confirm.on('complete-yes', function() {
confirm.hide();
confirm.destroy();
M.util.get_string('move', 'moodle')
).then(function() {
this.get('console').performAjaxAction('movecourseintocategory', {
courseid: course.get('courseid'),
categoryid: this.get('categoryid'),
courseid: course.get('courseid')
}, this.completeMoveCourse, this);
}, self);
confirm.show();
return;
}.bind(this)).catch(function() {
// User cancelled.
});
}.bind(this));
},
/**

View File

@ -257,27 +257,25 @@ Category.prototype = {
* @param {Course} course
*/
moveCourseTo: function(course) {
var self = this;
Y.use('moodle-core-notification-confirm', function() {
var confirm = new M.core.confirm({
title: M.util.get_string('confirm', 'moodle'),
question: M.util.get_string('confirmcoursemove', 'moodle', {
require(['core/notification'], function(Notification) {
Notification.saveCancelPromise(
M.util.get_string('confirmation', 'admin'),
M.util.get_string('confirmcoursemove', 'moodle',
{
course: course.getName(),
category: self.getName()
category: this.getName(),
}),
yesLabel: M.util.get_string('move', 'moodle'),
noLabel: M.util.get_string('cancel', 'moodle')
});
confirm.on('complete-yes', function() {
confirm.hide();
confirm.destroy();
M.util.get_string('move', 'moodle')
).then(function() {
this.get('console').performAjaxAction('movecourseintocategory', {
courseid: course.get('courseid'),
categoryid: this.get('categoryid'),
courseid: course.get('courseid')
}, this.completeMoveCourse, this);
}, self);
confirm.show();
return;
}.bind(this)).catch(function() {
// User cancelled.
});
}.bind(this));
},
/**