MDL-54852 assignment: Suppress "leave page" warning after save
If the user navigates away from the grading page immediately after saving the grading form, the browser warning can be safely omitted, as there are no unsaved changes. This is achieved by calling `reset_form_dirty_state()` of the core_formchangechecker YUI module, which is responsible for the warning.
This commit is contained in:
+1
-1
File diff suppressed because one or more lines are too long
@@ -28,10 +28,6 @@ define(['jquery', 'core/yui', 'core/notification', 'core/templates', 'core/fragm
|
||||
'mod_assign/grading_events'],
|
||||
function($, Y, notification, templates, fragment, ajax, str, checker, GradingEvents) {
|
||||
|
||||
Y.use('moodle-core-formchangechecker', function(){
|
||||
// moodle-core-formchangechecker is now available via M.core_formchangechecker
|
||||
});
|
||||
|
||||
/**
|
||||
* GradingPanel class.
|
||||
*
|
||||
@@ -148,8 +144,10 @@ define(['jquery', 'core/yui', 'core/notification', 'core/templates', 'core/fragm
|
||||
{ key: 'gradechangessaveddetail', component: 'mod_assign' },
|
||||
]).done(function(strs) {
|
||||
notification.alert(strs[0], strs[1]);
|
||||
M.core_formchangechecker.reset_form_dirty_state();
|
||||
}).fail(notification.exception);
|
||||
Y.use('moodle-core-formchangechecker', function() {
|
||||
M.core_formchangechecker.reset_form_dirty_state();
|
||||
});
|
||||
if (nextUserId == this._lastUserId) {
|
||||
$(document).trigger('reset', nextUserId);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user