Made disabled show results show a minimalistic end page [HFJ-1935]

pull/5/head
Paal Joergensen 2016-05-20 09:33:45 +02:00
parent 636857931a
commit 9380a9ea98
8 changed files with 51 additions and 13 deletions

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,6 +92,7 @@ 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.',
@ -324,15 +327,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
@ -367,12 +365,14 @@ H5P.QuestionSet = function (options, contentId) {
} }
}); });
if (scoreBar === undefined) { if (params.endGame.showResultPage) {
scoreBar = H5P.JoubelUI.createScoreBar(totals); 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);
self.trigger('resize'); self.trigger('resize');
}; };

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:",

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

@ -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",