Fixed issues with location hash not updatieng on going back

This commit is contained in:
PMKuipers 2023-09-03 17:12:44 +02:00
parent 641356be31
commit ef29eb6209
9 changed files with 16 additions and 12 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -189,7 +189,7 @@ export function init(contextid,categoryid) {
methods: {
closeStudyplan() {
app.activestudyplan = null;
location.hash = '';
window.location.hash = '';
},
movedStudyplan(plan,from,to) {
// reload the page in the new context (needed, since a number of links are not reactive in the page)
@ -220,7 +220,7 @@ export function init(contextid,categoryid) {
app.activestudyplan = ProcessStudyplan(response,true);
debug.info('studyplan processed');
app.loadingstudyplan = false;
location.hash = app.activestudyplan.id;
window.location.hash = app.activestudyplan.id;
}).fail(function(error){
notification.exception(error);
app.loadingstudyplan = false;

View File

@ -17,6 +17,7 @@ import {ProcessStudyplan} from './studyplan-processor';
import RVComponents from './report-viewer-components';
Vue.use(RVComponents);
import TSComponents from './treestudyplan-components';
import ModalComponents from './modedit-modal';
Vue.use(ModalComponents);
@ -85,7 +86,7 @@ export function init(contextid,categoryid) {
});
app.studyplans = response;
// load studyplan from hash if applicable
const hash = location.hash.replace('#','');
const hash = window.location.hash.replace('#','');
const parts = hash.split("-");
if(!!parts && parts.length > 0){
@ -135,6 +136,7 @@ export function init(contextid,categoryid) {
app.associatedstudents = [];
app.studentstudyplan = [];
app.displayedstudyplan = null;
window.location.hash = '';
},
selectStudyplan(studyplan,studentid){
@ -151,7 +153,7 @@ export function init(contextid,categoryid) {
app.activestudyplan = ProcessStudyplan(response,true);
app.displayedstudyplan = app.activestudyplan;
app.loadingstudyplan = false;
location.hash = app.activestudyplan.id;
window.location.hash = app.activestudyplan.id;
call([{
methodname: 'local_treestudyplan_all_associated',
args: { studyplan_id: studyplan.id}
@ -183,7 +185,7 @@ export function init(contextid,categoryid) {
app.studentstudyplan = ProcessStudyplan(response,false);
app.displayedstudyplan = app.studentstudyplan;
app.loadingstudyplan = false;
location.hash = app.activestudyplan.id + "-" + student.id;
window.location.hash = app.activestudyplan.id + "-" + student.id;
}).fail(function(error){
notification.exception(error);
app.loadingstudyplan = false;
@ -195,6 +197,7 @@ export function init(contextid,categoryid) {
app.selectedstudent = null;
app.studentstudyplan = null;
app.displayedstudyplan = app.activestudyplan;
window.location.hash = app.activestudyplan.id;
}
},

View File

@ -8,7 +8,8 @@
import {SimpleLine} from './simpleline/simpleline';
import {get_strings} from 'core/str';
import {load_strings, format_date} from './util/string-helper';
import {load_strings} from './util/string-helper';
import {format_date} from './util/date-helper';
import {call} from 'core/ajax';
import notification from 'core/notification';
import {svgarcpath} from './util/svgarc';