feat: add function to navigate to course by ID
Introduce goToCourse function that updates the window location to navigate to a course view page using a given ID. This function is now accessible via window.top as goToCourse, improving navigation throughout the application and promoting code reuse.
This commit is contained in:
parent
17e8bc0c18
commit
110ac67686
1 changed files with 5 additions and 0 deletions
|
@ -178,12 +178,17 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function goToCourse(id) {
|
||||||
|
window.top.location.href = "/course/view.php?id=" + id;
|
||||||
|
}
|
||||||
|
|
||||||
// Attach global functions to window.top
|
// Attach global functions to window.top
|
||||||
window.top.nextContent = nextContent;
|
window.top.nextContent = nextContent;
|
||||||
window.top.openQuizModal = openQuizModal;
|
window.top.openQuizModal = openQuizModal;
|
||||||
window.top.openModal = openQuizModal;
|
window.top.openModal = openQuizModal;
|
||||||
window.top.closeQuizModal = closeQuizModal;
|
window.top.closeQuizModal = closeQuizModal;
|
||||||
window.top.goToQuiz = window.top.nextContent;
|
window.top.goToQuiz = window.top.nextContent;
|
||||||
|
window.top.goToCourse = goToCourse;
|
||||||
|
|
||||||
var contentName = $(currentScript).attr("data-activity-name");
|
var contentName = $(currentScript).attr("data-activity-name");
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue