Added Blanks to questionsset and fixed bugs.
parent
355d847bb1
commit
afe6404e0a
|
@ -4,7 +4,7 @@
|
||||||
.questionset.hidden {
|
.questionset.hidden {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
.questionset .h5p-multichoice > .h5p-show-solution {
|
.questionset .h5p-multichoice > .h5p-show-solution, .h5p-blanks .h5p-button {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
.dots-container {
|
.dots-container {
|
||||||
|
|
|
@ -28,7 +28,7 @@ H5P.QuestionSet = function (options, contentId) {
|
||||||
'<% } %>' +
|
'<% } %>' +
|
||||||
'<div class="questionset<% if (introPage.showIntroPage) { %> hidden<% } %>">' +
|
'<div class="questionset<% if (introPage.showIntroPage) { %> hidden<% } %>">' +
|
||||||
' <% for (var i=0; i<questions.length; i++) { %>' +
|
' <% for (var i=0; i<questions.length; i++) { %>' +
|
||||||
' <div class="question-container" id="q-<%= i %>">' +
|
' <div class="question-container">' +
|
||||||
' <div><%= questions[i].library %></div>' +
|
' <div><%= questions[i].library %></div>' +
|
||||||
' </div>' +
|
' </div>' +
|
||||||
' <% } %>' +
|
' <% } %>' +
|
||||||
|
@ -37,7 +37,7 @@ H5P.QuestionSet = function (options, contentId) {
|
||||||
' <% if (progressType == "dots") { %>' +
|
' <% if (progressType == "dots") { %>' +
|
||||||
' <div class="dots-container">' +
|
' <div class="dots-container">' +
|
||||||
' <% for (var i=0; i<questions.length; i++) { %>' +
|
' <% for (var i=0; i<questions.length; i++) { %>' +
|
||||||
' <span class="progress-dot unanswered" id="qdot-<%= i %>"></span>' +
|
' <span class="progress-dot unanswered"></span>' +
|
||||||
' <%} %>' +
|
' <%} %>' +
|
||||||
' </div>' +
|
' </div>' +
|
||||||
' <% } else if (progressType == "textual") { %>' +
|
' <% } else if (progressType == "textual") { %>' +
|
||||||
|
@ -148,10 +148,7 @@ H5P.QuestionSet = function (options, contentId) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hide all questions
|
// Hide all questions
|
||||||
$('.question-container', $myDom).hide();
|
$('.question-container', $myDom).hide().eq(questionNumber).show();
|
||||||
|
|
||||||
// Reshow the requested question
|
|
||||||
$('#q-' + questionNumber, $myDom).show();
|
|
||||||
|
|
||||||
// Update progress indicator
|
// Update progress indicator
|
||||||
// Test if current has been answered.
|
// Test if current has been answered.
|
||||||
|
@ -161,7 +158,7 @@ H5P.QuestionSet = function (options, contentId) {
|
||||||
else {
|
else {
|
||||||
// Set currentNess
|
// Set currentNess
|
||||||
$('.progress-dot.current', $myDom).removeClass('current');
|
$('.progress-dot.current', $myDom).removeClass('current');
|
||||||
$('#qdot-' + questionNumber, $myDom).addClass('current');
|
$('.progress-dot:eq(' + questionNumber +')', $myDom).addClass('current');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remember where we are
|
// Remember where we are
|
||||||
|
@ -279,14 +276,15 @@ H5P.QuestionSet = function (options, contentId) {
|
||||||
// Attach questions
|
// Attach questions
|
||||||
for (var i = 0; i < questionInstances.length; i++) {
|
for (var i = 0; i < questionInstances.length; i++) {
|
||||||
var question = questionInstances[i];
|
var question = questionInstances[i];
|
||||||
// TODO: Render on init, inject in template.
|
|
||||||
question.attach('q-' + i);
|
question.attach($('.question-container:eq(' + i + ')', $myDom));
|
||||||
$(question).on('h5pQuestionAnswered', function () {
|
$(question).on('h5pQuestionAnswered', function () {
|
||||||
$('#qdot-' + currentQuestion, $myDom).removeClass('unanswered').addClass('answered');
|
$('.progress-dot:eq(' + currentQuestion +')', $myDom).removeClass('unanswered').addClass('answered');
|
||||||
_updateButtons();
|
_updateButtons();
|
||||||
});
|
});
|
||||||
if (question.getAnswerGiven()) {
|
if (question.getAnswerGiven()) {
|
||||||
$('#qdot-'+i, $myDom).removeClass('unanswered').addClass('answered');
|
$('.progress-dot:eq(' + i +')'
|
||||||
|
, $myDom).removeClass('unanswered').addClass('answered');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -300,8 +298,7 @@ H5P.QuestionSet = function (options, contentId) {
|
||||||
|
|
||||||
// Set event listeners.
|
// Set event listeners.
|
||||||
$('.progress-dot', $myDom).click(function () {
|
$('.progress-dot', $myDom).click(function () {
|
||||||
var idx = parseInt($(this).attr('id').split('-')[1], 10);
|
_showQuestion($(this).index());
|
||||||
_showQuestion(idx);
|
|
||||||
});
|
});
|
||||||
$('.next.button', $myDom).click(function () {
|
$('.next.button', $myDom).click(function () {
|
||||||
_showQuestion(currentQuestion + 1);
|
_showQuestion(currentQuestion + 1);
|
||||||
|
|
|
@ -50,7 +50,8 @@
|
||||||
"description": "Library for this question.",
|
"description": "Library for this question.",
|
||||||
"options": [
|
"options": [
|
||||||
"H5P.MultiChoice 1.0",
|
"H5P.MultiChoice 1.0",
|
||||||
"H5P.DragQuestion 1.0"
|
"H5P.DragQuestion 1.0",
|
||||||
|
"H5P.Blanks 1.0"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in New Issue