Skip to content

Commit

Permalink
edu mental map required fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandr Karachev committed Nov 14, 2024
1 parent 53820b5 commit 5b98e65
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
12 changes: 7 additions & 5 deletions asset/slides/js/SlidesPlayer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

function SlidesPlayer(deck) {

return {
Expand Down Expand Up @@ -31,13 +30,9 @@ function SlidesPlayer(deck) {
else {

if (deck.hasPlugin('testing')) {

const elem = $(deck.getCurrentSlide()).find('div.new-questions');

if (elem.length) {

const test = elem[0]['_wikids_test'];

if (test !== undefined) {
const canNext = test.canNext();
if (!canNext) {
Expand All @@ -47,6 +42,13 @@ function SlidesPlayer(deck) {
}
}

if (deck.hasPlugin('mental_map')) {
const instance = mentalMapBuilder.getInstance($(deck.getCurrentSlide()).attr('data-id'))
if (instance && !instance.canNext()) {
return
}
}

deck.next();
}
},
Expand Down
2 changes: 0 additions & 2 deletions asset/slides/js/plugins/MentalMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ let currentStoryId = null;

let readySlides = [];

const mentalMapBuilder = new MentalMapManagerQuiz()

export default function MentalMap() {
return {

Expand Down
6 changes: 4 additions & 2 deletions asset/slides/js/slides.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import NextStory from "./plugins/NextStory";
import isMobile from "./is_mobile";
import MentalMap from "./plugins/MentalMap";

window.mentalMapBuilder = new MentalMapManagerQuiz()

function onSlideMouseDown(e, player) {

e = e || window.event;
Expand Down Expand Up @@ -60,7 +62,8 @@ window.initSlides = function() {
controlsLayout: 'bottom-right',
controlsBackArrows: 'faded',
controlsTutorial: false,
progress: true,
progress: false,
keyboard: false,
history: false,
mouseWheel: false,
showNotes: false,
Expand Down Expand Up @@ -97,7 +100,6 @@ window.initSlides = function() {
const slidesPlayer = new SlidesPlayer(deck);

deck.on('ready', function() {

if (!isMobile()) {
deck.on("mousedown", (e) => onSlideMouseDown(e, slidesPlayer));
deck.on("contextmenu", (e) => e.preventDefault());
Expand Down

0 comments on commit 5b98e65

Please sign in to comment.