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 {
background-color: #000;
width: 100%;
}
.video-container > .h5p-button {
position: absolute;

View File

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

View File

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

View File

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

View File

@ -92,6 +92,11 @@
{
"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",
"description": "Ce texte sera affiché quand l'utilisateur aura totalement terminé le quiz."

View File

@ -92,6 +92,11 @@
{
"label": "Visualizza risultati"
},
{
"label": "No results message",
"description": "Text displayed on end page when \"Display results\" is disabled",
"default": "Finished"
},
{
"label": "Intestazione Feedback",
"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": "Melding når resultater ikke vises",
"description": "Teksten vises på avslutnings-siden når resultater ikke vises",
"default": "Ferdig"
},
{
"label": "Overskrift over tilbakemeldinger",
"default": "Resultat:",
@ -126,7 +131,7 @@
},
{
"label": "Tekst til \"Fasit\" knapp",
"default": "Gå gjennom fasit.",
"default": "Gå gjennom fasit",
"description": ""
},
{

View File

@ -94,6 +94,11 @@
{
"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",
"default": "Resultat:",

View File

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

View File

@ -110,11 +110,11 @@
"label": "Question type",
"description": "Library for this question.",
"options": [
"H5P.MultiChoice 1.6",
"H5P.DragQuestion 1.5",
"H5P.Blanks 1.5",
"H5P.MarkTheWords 1.5",
"H5P.DragText 1.4"
"H5P.MultiChoice 1.7",
"H5P.DragQuestion 1.6",
"H5P.Blanks 1.6",
"H5P.MarkTheWords 1.6",
"H5P.DragText 1.5"
]
}
},
@ -179,6 +179,14 @@
"label": "Display results",
"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",
"type": "text",
@ -196,7 +204,7 @@
"type": "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. ",
"default": "@score of @total points",
"default": "You got @score of @total points",
"optional": true
},
{
@ -262,7 +270,7 @@
"name": "solutionButtonText",
"type": "text",
"label": "Solution button label",
"default": "Solution",
"default": "Show solution",
"description": "Text for the solution button."
},
{