diff --git a/grade/grading/form/guide/js/guideeditor.js b/grade/grading/form/guide/js/guideeditor.js index a0d6170ae76..188f1e493d8 100644 --- a/grade/grading/form/guide/js/guideeditor.js +++ b/grade/grading/form/guide/js/guideeditor.js @@ -178,11 +178,7 @@ M.gradingform_guideeditor.buttonclick = function(e, confirmed) { if (action == 'addcriterion' || action == 'addcomment') { newid = M.gradingform_guideeditor.calculatenewid(elements_str); } - var dialog_options = { - 'scope' : this, - 'callbackargs' : [e, true], - 'callback' : M.gradingform_guideeditor.buttonclick - }; + if (chunks.length == 3 && (action == 'addcriterion' || action == 'addcomment')) { // ADD NEW CRITERION OR COMMENT var parentel = Y.one('#'+name+'-'+section) @@ -228,8 +224,18 @@ M.gradingform_guideeditor.buttonclick = function(e, confirmed) { Y.one('#'+name+'-'+section+'-'+chunks[2]).remove() M.gradingform_guideeditor.assignclasses(elements_str) } else { - dialog_options['message'] = M.util.get_string('confirmdeletecriterion', 'gradingform_guide') - M.util.show_confirm_dialog(e, dialog_options); + require(['core/notification', 'core/str'], function(Notification, Str) { + Notification.saveCancelPromise( + Str.get_string('confirmation', 'admin'), + Str.get_string('confirmdeletecriterion', 'gradingform_guide'), + Str.get_string('yes', 'moodle') + ).then(function() { + M.gradingform_guideeditor.buttonclick.apply(this, [e, true]); + return; + }.bind(this)).catch(function() { + // User cancelled. + }); + }.bind(this)); } } else { // unknown action diff --git a/grade/grading/form/rubric/js/rubriceditor.js b/grade/grading/form/rubric/js/rubriceditor.js index 1b13b2a335b..7e92b3f176f 100644 --- a/grade/grading/form/rubric/js/rubriceditor.js +++ b/grade/grading/form/rubric/js/rubriceditor.js @@ -149,11 +149,6 @@ M.gradingform_rubriceditor.buttonclick = function(e, confirmed) { newid = M.gradingform_rubriceditor.calculatenewid('#rubric-'+name+' .criterion'); newlevid = M.gradingform_rubriceditor.calculatenewid('#rubric-'+name+' .level'); } - var dialog_options = { - 'scope' : this, - 'callbackargs' : [e, true], - 'callback' : M.gradingform_rubriceditor.buttonclick - }; if (chunks.length == 3 && action == 'addcriterion') { // ADD NEW CRITERION var levelsscores = [0], levidx = 1 @@ -215,8 +210,18 @@ M.gradingform_rubriceditor.buttonclick = function(e, confirmed) { Y.one('#'+name+'-criteria-'+chunks[2]).remove() M.gradingform_rubriceditor.assignclasses(elements_str) } else { - dialog_options['message'] = M.util.get_string('confirmdeletecriterion', 'gradingform_rubric') - M.util.show_confirm_dialog(e, dialog_options); + require(['core/notification', 'core/str'], function(Notification, Str) { + Notification.saveCancelPromise( + Str.get_string('confirmation', 'admin'), + Str.get_string('confirmdeletecriterion', 'gradingform_rubric'), + Str.get_string('yes', 'moodle') + ).then(function() { + M.gradingform_rubriceditor.buttonclick.apply(this, [e, true]); + return; + }.bind(this)).catch(function() { + // User cancelled. + }); + }.bind(this)); } } else if (chunks.length == 4 && action == 'duplicate') { // Duplicate criterion. @@ -259,8 +264,18 @@ M.gradingform_rubriceditor.buttonclick = function(e, confirmed) { Y.one('#'+name+'-criteria-'+chunks[2]+'-'+chunks[3]+'-'+chunks[4]).remove() M.gradingform_rubriceditor.assignclasses(elements_str) } else { - dialog_options['message'] = M.util.get_string('confirmdeletelevel', 'gradingform_rubric') - M.util.show_confirm_dialog(e, dialog_options); + require(['core/notification', 'core/str'], function(Notification, Str) { + Notification.saveCancelPromise( + Str.get_string('confirmation', 'admin'), + Str.get_string('confirmdeletelevel', 'gradingform_rubric'), + Str.get_string('yes', 'moodle') + ).then(function() { + M.gradingform_rubriceditor.buttonclick.apply(this, [e, true]); + return; + }.bind(this)).catch(function() { + // User cancelled. + }); + }.bind(this)); } } else { // unknown action