Merge branch 'stable'

pull/5/head
Frode Petterson 2016-06-21 16:35:04 +02:00
commit 42b842cc20
10 changed files with 101 additions and 55 deletions

View File

@ -178,6 +178,7 @@
} }
.video-container > video { .video-container > video {
background-color: #000; background-color: #000;
width: 100%;
} }
.video-container > .h5p-button { .video-container > .h5p-button {
position: absolute; position: absolute;

View File

@ -60,7 +60,9 @@ H5P.QuestionSet = function (options, contentId) {
' <% if (comment) { %>' + ' <% if (comment) { %>' +
' <div class="result-header"><%= comment %></div>' + ' <div class="result-header"><%= comment %></div>' +
' <% } %>' + ' <% } %>' +
' <% if (resulttext) { %>' +
' <div class="result-text"><%= resulttext %></div>' + ' <div class="result-text"><%= resulttext %></div>' +
' <% } %>' +
' <div class="buttons">' + ' <div class="buttons">' +
' <button type="button" class="h5p-joubelui-button h5p-button qs-finishbutton"><%= finishButtonText %></button>' + ' <button type="button" class="h5p-joubelui-button h5p-button qs-finishbutton"><%= finishButtonText %></button>' +
' <button type="button" class="h5p-joubelui-button h5p-button qs-solutionbutton"><%= solutionButtonText %></button>' + ' <button type="button" class="h5p-joubelui-button h5p-button qs-solutionbutton"><%= solutionButtonText %></button>' +
@ -90,14 +92,15 @@ H5P.QuestionSet = function (options, contentId) {
}, },
endGame: { endGame: {
showResultPage: true, showResultPage: true,
noResultMessage: 'Finished',
message: 'Your result:', message: 'Your result:',
successGreeting: 'Congratulations!', successGreeting: 'Congratulations!',
successComment: 'You have enough correct answers to pass the test.', successComment: 'You have enough correct answers to pass the test.',
failGreeting: 'Sorry!', failGreeting: 'Sorry!',
failComment: "You don't have enough correct answers to pass this test.", failComment: "You don't have enough correct answers to pass this test.",
scoreString: '@score of @total points', scoreString: 'You got @score of @total points',
finishButtonText: 'Finish', finishButtonText: 'Finish',
solutionButtonText: 'Solution', solutionButtonText: 'Show solution',
retryButtonText: 'Retry', retryButtonText: 'Retry',
showAnimations: false, showAnimations: false,
skipButtonText: 'Skip video' skipButtonText: 'Skip video'
@ -145,7 +148,7 @@ H5P.QuestionSet = function (options, contentId) {
question.params = question.params || {}; question.params = question.params || {};
question.params.overrideSettings = question.params.overrideSettings || {}; question.params.overrideSettings = question.params.overrideSettings || {};
question.params.overrideSettings.$confirmationDialogParent = $template; question.params.overrideSettings.$confirmationDialogParent = $template.last();
question.params.overrideSettings.instance = this; question.params.overrideSettings.instance = this;
var questionInstance = H5P.newRunnable(question, contentId, undefined, undefined, {parent: self}); var questionInstance = H5P.newRunnable(question, contentId, undefined, undefined, {parent: self});
@ -264,6 +267,9 @@ H5P.QuestionSet = function (options, contentId) {
// Hide finish button // Hide finish button
questionInstances[questionInstances.length - 1].hideButton('finish'); questionInstances[questionInstances.length - 1].hideButton('finish');
// Mark all tasks as unanswered:
$('.progress-dot').removeClass('answered').addClass('unanswered');
//Force the last page to be reRendered //Force the last page to be reRendered
rendered = false; rendered = false;
}; };
@ -324,15 +330,10 @@ H5P.QuestionSet = function (options, contentId) {
var displayResults = function () { var displayResults = function () {
self.triggerXAPICompleted(self.getScore(), self.totalScore(), success); self.triggerXAPICompleted(self.getScore(), self.totalScore(), success);
if (!params.endGame.showResultPage) {
self.trigger('h5pQuestionSetFinished', eventData);
return;
}
var eparams = { var eparams = {
message: params.endGame.message, message: params.endGame.showResultPage ? params.endGame.message : params.endGame.noResultMessage,
comment: (success ? params.endGame.successGreeting : params.endGame.failGreeting), comment: params.endGame.showResultPage ? (success ? params.endGame.successGreeting : params.endGame.failGreeting) : undefined,
resulttext: (success ? params.endGame.successComment : params.endGame.failComment), resulttext: params.endGame.showResultPage ? (success ? params.endGame.successComment : params.endGame.failComment) : undefined,
finishButtonText: params.endGame.finishButtonText, finishButtonText: params.endGame.finishButtonText,
solutionButtonText: params.endGame.solutionButtonText, solutionButtonText: params.endGame.solutionButtonText,
retryButtonText: params.endGame.retryButtonText retryButtonText: params.endGame.retryButtonText
@ -342,37 +343,45 @@ H5P.QuestionSet = function (options, contentId) {
$myDom.children().hide(); $myDom.children().hide();
$myDom.append(endTemplate.render(eparams)); $myDom.append(endTemplate.render(eparams));
// Add event handlers to summary buttons if (params.endGame.showResultPage) {
hookUpButton('.qs-finishbutton', function () { // Add event handlers to summary buttons
self.trigger('h5pQuestionSetFinished', eventData); hookUpButton('.qs-finishbutton', function () {
}); self.trigger('h5pQuestionSetFinished', eventData);
hookUpButton('.qs-solutionbutton', function () { });
showSolutions(); hookUpButton('.qs-solutionbutton', function () {
$myDom.children().hide().filter('.questionset').show(); showSolutions();
_showQuestion(params.initialQuestion); $myDom.children().hide().filter('.questionset').show();
});
hookUpButton('.qs-retrybutton', function () {
resetTask();
$myDom.children().hide();
var $intro = $('.intro-page', $myDom);
if ($intro.length) {
// Show intro
$('.intro-page', $myDom).show();
}
else {
// Show first question
$('.questionset', $myDom).show();
_showQuestion(params.initialQuestion); _showQuestion(params.initialQuestion);
} });
}); hookUpButton('.qs-retrybutton', function () {
resetTask();
$myDom.children().hide();
if (scoreBar === undefined) { var $intro = $('.intro-page', $myDom);
scoreBar = H5P.JoubelUI.createScoreBar(totals); if ($intro.length) {
// Show intro
$('.intro-page', $myDom).show();
}
else {
// Show first question
$('.questionset', $myDom).show();
_showQuestion(params.initialQuestion);
}
});
if (scoreBar === undefined) {
scoreBar = H5P.JoubelUI.createScoreBar(totals);
}
scoreBar.appendTo($('.feedback-scorebar', $myDom));
scoreBar.setScore(finals);
$('.feedback-text', $myDom).html(scoreString);
} }
scoreBar.appendTo($('.feedback-scorebar', $myDom)); else {
scoreBar.setScore(finals); // Remove buttons and feedback section
$('.feedback-text', $myDom).html(scoreString); $('.qs-finishbutton, .qs-solutionbutton, .qs-retrybutton, .feedback-section', $myDom).remove();
}
self.trigger('resize');
}; };
if (params.endGame.showAnimations) { if (params.endGame.showAnimations) {
@ -495,7 +504,9 @@ H5P.QuestionSet = function (options, contentId) {
if (shortVerb === 'interacted' || if (shortVerb === 'interacted' ||
shortVerb === 'answered' || shortVerb === 'answered' ||
shortVerb === 'attempted') { shortVerb === 'attempted') {
$('.progress-dot:eq(' + currentQuestion +')', $myDom).removeClass('unanswered').addClass('answered'); if (questionInstances[currentQuestion].getAnswerGiven()) {
$('.progress-dot:eq(' + currentQuestion +')', $myDom).removeClass('unanswered').addClass('answered');
}
_updateButtons(); _updateButtons();
} }
if (shortVerb === 'completed') { if (shortVerb === 'completed') {
@ -503,13 +514,10 @@ H5P.QuestionSet = function (options, contentId) {
event.setVerb('answered'); event.setVerb('answered');
} }
if (event.data.statement.context.extensions === undefined) { if (event.data.statement.context.extensions === undefined) {
event.data.statement.context.extensions = []; event.data.statement.context.extensions = {};
} }
event.data.statement.context.extensions['http://id.tincanapi.com/extension/ending-point'] = currentQuestion + 1; event.data.statement.context.extensions['http://id.tincanapi.com/extension/ending-point'] = currentQuestion + 1;
}); });
if (question.getAnswerGiven()) {
$('.progress-dot:eq(' + i +')', $myDom).removeClass('unanswered').addClass('answered');
}
} }
// Allow other libraries to add transitions after the questions have been inited // Allow other libraries to add transitions after the questions have been inited
@ -530,7 +538,6 @@ H5P.QuestionSet = function (options, contentId) {
// Hide all but initial Question. // Hide all but initial Question.
_showQuestion(params.initialQuestion); _showQuestion(params.initialQuestion);
_updateButtons();
if (renderSolutions) { if (renderSolutions) {
showSolutions(); showSolutions();

View File

@ -92,6 +92,11 @@
{ {
"label": "عرض النتائج" "label": "عرض النتائج"
}, },
{
"label": "No results message",
"description": "Text displayed on end page when \"Display results\" is disabled",
"default": "Finished"
},
{ {
"label": "نص راس الملاحظات", "label": "نص راس الملاحظات",
"description": "سيتم عرض هذا العنوان في نهاية هذه المسابقة حيثما أجاب المستخدم على جميع الأسئلة المستعملة" "description": "سيتم عرض هذا العنوان في نهاية هذه المسابقة حيثما أجاب المستخدم على جميع الأسئلة المستعملة"

View File

@ -97,6 +97,11 @@
{ {
"label": "Ergebnisanzeige" "label": "Ergebnisanzeige"
}, },
{
"label": "No results message",
"description": "Text displayed on end page when \"Display results\" is disabled",
"default": "Finished"
},
{ {
"label": "Kopfzeile Feedback", "label": "Kopfzeile Feedback",
"default": "Dein Ergebnis:", "default": "Dein Ergebnis:",

View File

@ -92,6 +92,11 @@
{ {
"label": "Montrer les résultats" "label": "Montrer les résultats"
}, },
{
"label": "No results message",
"description": "Text displayed on end page when \"Display results\" is disabled",
"default": "Finished"
},
{ {
"label": "Feedback de fin", "label": "Feedback de fin",
"description": "Ce texte sera affiché quand l'utilisateur aura totalement terminé le quiz." "description": "Ce texte sera affiché quand l'utilisateur aura totalement terminé le quiz."

View File

@ -92,6 +92,11 @@
{ {
"label": "Visualizza risultati" "label": "Visualizza risultati"
}, },
{
"label": "No results message",
"description": "Text displayed on end page when \"Display results\" is disabled",
"default": "Finished"
},
{ {
"label": "Intestazione Feedback", "label": "Intestazione Feedback",
"description": "Questa intestazione verrà visualizzata alla fine del quiz, dopo che l'utente avrà risposto a tutte le domande." "description": "Questa intestazione verrà visualizzata alla fine del quiz, dopo che l'utente avrà risposto a tutte le domande."

View File

@ -94,6 +94,11 @@
{ {
"label": "Vis resultater" "label": "Vis resultater"
}, },
{
"label": "Melding når resultater ikke vises",
"description": "Teksten vises på avslutnings-siden når resultater ikke vises",
"default": "Ferdig"
},
{ {
"label": "Overskrift over tilbakemeldinger", "label": "Overskrift over tilbakemeldinger",
"default": "Resultat:", "default": "Resultat:",
@ -126,7 +131,7 @@
}, },
{ {
"label": "Tekst til \"Fasit\" knapp", "label": "Tekst til \"Fasit\" knapp",
"default": "Gå gjennom fasit.", "default": "Gå gjennom fasit",
"description": "" "description": ""
}, },
{ {

View File

@ -94,6 +94,11 @@
{ {
"label": "Vis resultat" "label": "Vis resultat"
}, },
{
"label": "Melding når resultater ikke vises",
"description": "Teksten vises på avslutnings-siden når resultater ikke vises",
"default": "Ferdig"
},
{ {
"label": "Overskrift over tilbakemeldingar", "label": "Overskrift over tilbakemeldingar",
"default": "Resultat:", "default": "Resultat:",

View File

@ -4,7 +4,7 @@
"contentType": "question", "contentType": "question",
"majorVersion": 1, "majorVersion": 1,
"minorVersion": 8, "minorVersion": 8,
"patchVersion": 1, "patchVersion": 3,
"embedTypes": [ "embedTypes": [
"iframe" "iframe"
], ],
@ -61,4 +61,4 @@
"minorVersion": 1 "minorVersion": 1
} }
] ]
} }

View File

@ -110,11 +110,11 @@
"label": "Question type", "label": "Question type",
"description": "Library for this question.", "description": "Library for this question.",
"options": [ "options": [
"H5P.MultiChoice 1.6", "H5P.MultiChoice 1.7",
"H5P.DragQuestion 1.5", "H5P.DragQuestion 1.6",
"H5P.Blanks 1.5", "H5P.Blanks 1.6",
"H5P.MarkTheWords 1.5", "H5P.MarkTheWords 1.6",
"H5P.DragText 1.4" "H5P.DragText 1.5"
] ]
} }
}, },
@ -179,6 +179,14 @@
"label": "Display results", "label": "Display results",
"default": true "default": true
}, },
{
"name": "noResultMessage",
"type": "text",
"label": "No results message",
"description": "Text displayed on end page when \"Display results\" is disabled",
"default": "Finished",
"optional": true
},
{ {
"name": "message", "name": "message",
"type": "text", "type": "text",
@ -196,7 +204,7 @@
"type": "text", "type": "text",
"label": "Score display text", "label": "Score display text",
"description": "Text used to display Total user score. \"@score\" will be replaced by calculated score, \"@total\" will be replaced by maximum possible score. ", "description": "Text used to display Total user score. \"@score\" will be replaced by calculated score, \"@total\" will be replaced by maximum possible score. ",
"default": "@score of @total points", "default": "You got @score of @total points",
"optional": true "optional": true
}, },
{ {
@ -262,7 +270,7 @@
"name": "solutionButtonText", "name": "solutionButtonText",
"type": "text", "type": "text",
"label": "Solution button label", "label": "Solution button label",
"default": "Solution", "default": "Show solution",
"description": "Text for the solution button." "description": "Text for the solution button."
}, },
{ {