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:
Jan Dageförde
2016-11-07 10:29:47 +01:00
parent ce50f55c1f
commit 131ec75f8a
2 changed files with 4 additions and 6 deletions
File diff suppressed because one or more lines are too long
+3 -5
View File
@@ -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 {