Make sure forms are not considered dirty before loading a new page.
This commit is contained in:
parent
626e2c9aac
commit
32a09a7c44
2
amd/build/page-edit-plan.min.js
vendored
2
amd/build/page-edit-plan.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -9,6 +9,8 @@
|
||||||
import {get_string,get_strings} from 'core/str';
|
import {get_string,get_strings} from 'core/str';
|
||||||
import {call} from 'core/ajax';
|
import {call} from 'core/ajax';
|
||||||
import notification from 'core/notification';
|
import notification from 'core/notification';
|
||||||
|
import {resetAllFormDirtyStates} from 'core_form/changechecker';
|
||||||
|
|
||||||
|
|
||||||
import Vue from './vue/vue';
|
import Vue from './vue/vue';
|
||||||
|
|
||||||
|
@ -220,10 +222,9 @@ export function init(contextid,categoryid,options) {
|
||||||
const params = new URLSearchParams(location.search);
|
const params = new URLSearchParams(location.search);
|
||||||
params.delete('categoryid');
|
params.delete('categoryid');
|
||||||
params.set("contextid", newstudyplan.context_id);
|
params.set("contextid", newstudyplan.context_id);
|
||||||
setTimeout(() => {
|
// Make sure the form is no longer dirty before reloading the page - avoid beforeunload handler triggering.
|
||||||
// Reload page in a timeout to give other form javasccript the change to remove the beforeunload handler.
|
resetAllFormDirtyStates();
|
||||||
window.location = window.location.pathname + "?" + params.toString() + "#" + newstudyplan.id;
|
window.location = window.location.pathname + "?" + params.toString() + "#" + newstudyplan.id;
|
||||||
},50);
|
|
||||||
} else {
|
} else {
|
||||||
app.studyplans.push(newstudyplan);
|
app.studyplans.push(newstudyplan);
|
||||||
app.selectStudyplan(newstudyplan.id);
|
app.selectStudyplan(newstudyplan.id);
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
defined('MOODLE_INTERNAL') || die();
|
defined('MOODLE_INTERNAL') || die();
|
||||||
|
|
||||||
$plugin->component = 'local_treestudyplan'; // Recommended since 2.0.2 (MDL-26035). Required since 3.0 (MDL-48494).
|
$plugin->component = 'local_treestudyplan'; // Recommended since 2.0.2 (MDL-26035). Required since 3.0 (MDL-48494).
|
||||||
$plugin->version = 2024020700; // YYYYMMDDHH (year, month, day, iteration).
|
$plugin->version = 2024020702; // YYYYMMDDHH (year, month, day, iteration).
|
||||||
$plugin->requires = 2021051700; // YYYYMMDDHH (This is the release version for Moodle 3.11).
|
$plugin->requires = 2021051700; // YYYYMMDDHH (This is the release version for Moodle 3.11).
|
||||||
|
|
||||||
$plugin->release = "1.1.0";
|
$plugin->release = "1.1.0";
|
||||||
|
|
Loading…
Reference in New Issue
Block a user