MDL-44085 course: Replace JS confirm() by YUI confirm

This commit is contained in:
David Monllao
2014-02-18 09:44:05 +13:00
committed by Sam Hemelryk
parent c10affa57b
commit 0807908f17
4 changed files with 68 additions and 47 deletions
@@ -478,22 +478,29 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, {
confirmstring = M.util.get_string('deletechecktype', 'moodle', plugindata);
}
// Confirm element removal
if (!confirm(confirmstring)) {
return this;
}
// Create the confirmation dialogue.
var confirm = new M.core.confirm({
question: confirmstring,
modal: true
});
// If it is confirmed.
confirm.on('complete-yes', function() {
// Actually remove the element.
element.remove();
var data = {
'class': 'resource',
'action': 'DELETE',
'id': Y.Moodle.core_course.util.cm.getId(element)
};
this.send_request(data);
if (M.core.actionmenu && M.core.actionmenu.instance) {
M.core.actionmenu.instance.hideMenu();
}
}, this);
// Actually remove the element
element.remove();
var data = {
'class': 'resource',
'action': 'DELETE',
'id': Y.Moodle.core_course.util.cm.getId(element)
};
this.send_request(data);
if (M.core.actionmenu && M.core.actionmenu.instance) {
M.core.actionmenu.instance.hideMenu();
}
return this;
},
File diff suppressed because one or more lines are too long
@@ -478,22 +478,29 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, {
confirmstring = M.util.get_string('deletechecktype', 'moodle', plugindata);
}
// Confirm element removal
if (!confirm(confirmstring)) {
return this;
}
// Create the confirmation dialogue.
var confirm = new M.core.confirm({
question: confirmstring,
modal: true
});
// If it is confirmed.
confirm.on('complete-yes', function() {
// Actually remove the element.
element.remove();
var data = {
'class': 'resource',
'action': 'DELETE',
'id': Y.Moodle.core_course.util.cm.getId(element)
};
this.send_request(data);
if (M.core.actionmenu && M.core.actionmenu.instance) {
M.core.actionmenu.instance.hideMenu();
}
}, this);
// Actually remove the element
element.remove();
var data = {
'class': 'resource',
'action': 'DELETE',
'id': Y.Moodle.core_course.util.cm.getId(element)
};
this.send_request(data);
if (M.core.actionmenu && M.core.actionmenu.instance) {
M.core.actionmenu.instance.hideMenu();
}
return this;
},
+22 -15
View File
@@ -274,22 +274,29 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, {
confirmstring = M.util.get_string('deletechecktype', 'moodle', plugindata);
}
// Confirm element removal
if (!confirm(confirmstring)) {
return this;
}
// Create the confirmation dialogue.
var confirm = new M.core.confirm({
question: confirmstring,
modal: true
});
// If it is confirmed.
confirm.on('complete-yes', function() {
// Actually remove the element.
element.remove();
var data = {
'class': 'resource',
'action': 'DELETE',
'id': Y.Moodle.core_course.util.cm.getId(element)
};
this.send_request(data);
if (M.core.actionmenu && M.core.actionmenu.instance) {
M.core.actionmenu.instance.hideMenu();
}
}, this);
// Actually remove the element
element.remove();
var data = {
'class': 'resource',
'action': 'DELETE',
'id': Y.Moodle.core_course.util.cm.getId(element)
};
this.send_request(data);
if (M.core.actionmenu && M.core.actionmenu.instance) {
M.core.actionmenu.instance.hideMenu();
}
return this;
},