From 6c555191ac4c65f527a077c6189e8eb36333d69f Mon Sep 17 00:00:00 2001 From: Frank Ronny Larsen Date: Tue, 15 Jan 2013 08:17:59 +0100 Subject: [PATCH] Progress indicator fixes Clicking a dot in the progress view jumps to relevant question Already answered questinos will be marked as such. --- js/questionset.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/js/questionset.js b/js/questionset.js index 5702100..bf94c0f 100644 --- a/js/questionset.js +++ b/js/questionset.js @@ -195,9 +195,16 @@ H5P.QuestionSet = function (options) { $('#qdot-' + currentQuestion, $myDom).removeClass('unanswered').addClass('answered'); _updateFinishButton(); }); + if (quest.getAnswerGiven()) { + $('#qdot-'+i, $myDom).removeClass('unanswered').addClass('answered'); + } } // Set event listeners. + $('.progress-dot', $myDom).click(function (ev) { + var idx = parseInt($(this).attr('id').split('-')[1]); + _showQuestion(idx); + }); $('.next.button', $myDom).click(function (ev) { _showQuestion(currentQuestion + 1); }); @@ -259,8 +266,6 @@ H5P.QuestionSet = function (options) { // Get total score possible for questionset. var totalScore = function () { - return questionInstances.length; - // FIXME: questions need to get totalScore function. var score = 0; for (var i = questionInstances.length - 1; i >= 0; i--) { score += questionInstances[i].totalScore();