Merge branch 'master' into unused-semantics

Conflicts:
	js/questionset.js
	language/ar.json
	language/de.json
	language/fr.json
	language/it.json
	language/nb.json
	language/nn.json
	semantics.json
	upgrades.js
pull/4/head
Frode Petterson 2016-04-18 12:48:13 +02:00
commit e323c4ee3b
11 changed files with 322 additions and 141 deletions

View File

@ -55,6 +55,11 @@
.progress-dot.current { .progress-dot.current {
background: #285585; background: #285585;
} }
.progress-dot:focus {
outline-color: rgb(40, 130, 211);
outline-width: thin;
outline-style: solid;
}
.intro-page .title { .intro-page .title {
font-size: 2em; font-size: 2em;
@ -104,7 +109,7 @@
float: none; float: none;
} }
.questionset-results a.h5p-button.qs-retrybutton:before { .questionset-results button.h5p-button.qs-retrybutton:before {
font-family: 'H5PFontAwesome4'; font-family: 'H5PFontAwesome4';
padding-right: 0.5em; padding-right: 0.5em;
content: "\f01e"; content: "\f01e";
@ -128,8 +133,7 @@
.h5p-question .h5p-question-prev, .h5p-question .h5p-question-prev,
.h5p-question .h5p-question-next { .h5p-question .h5p-question-next {
padding: 0; padding: 0.5em 0;
height: 2.1875em;
width: 2.1875em; width: 2.1875em;
} }
@ -164,7 +168,7 @@
content: "\f00c"; content: "\f00c";
} }
.questionset-results a.h5p-button.qs-solutionbutton:before { .questionset-results button.h5p-button.qs-solutionbutton:before {
font-family: 'H5PFontAwesome4'; font-family: 'H5PFontAwesome4';
content: "\f06e "; /* TODO: Use margin not whitespace, spacing is not content! */ content: "\f06e "; /* TODO: Use margin not whitespace, spacing is not content! */
} }

View File

@ -40,7 +40,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"></span>' + ' <a href="#" class="progress-dot unanswered" aria-label="<%= questions[i].jumpAriaLabel %>"></a>' +
' <%} %>' + ' <%} %>' +
' </div>' + ' </div>' +
' <% } else if (progressType == "textual") { %>' + ' <% } else if (progressType == "textual") { %>' +
@ -62,13 +62,9 @@ H5P.QuestionSet = function (options, contentId) {
' <% } %>' + ' <% } %>' +
' <div class="result-text"><%= resulttext %></div>' + ' <div class="result-text"><%= resulttext %></div>' +
' <div class="buttons">' + ' <div class="buttons">' +
' <a class="h5p-joubelui-button h5p-button qs-finishbutton">' + ' <button type="button" class="h5p-joubelui-button h5p-button qs-finishbutton"><%= finishButtonText %></button>' +
' <%= finishButtonText %>' + ' <button type="button" class="h5p-joubelui-button h5p-button qs-solutionbutton"><%= solutionButtonText %></button>' +
' </a>' + ' <button type="button" class="h5p-joubelui-button h5p-button qs-retrybutton"><%= retryButtonText %></button>' +
' <a class="h5p-joubelui-button h5p-button qs-solutionbutton">' +
' <%= solutionButtonText %>' +
' </a>' +
' <a class="h5p-joubelui-button h5p-button qs-retrybutton"></a>' +
' </div>' + ' </div>' +
'</div>'; '</div>';
@ -85,10 +81,11 @@ H5P.QuestionSet = function (options, contentId) {
startButtonText: 'Start' startButtonText: 'Start'
}, },
texts: { texts: {
prevButton: 'Previous', prevButton: 'Previous question',
nextButton: 'Next', nextButton: 'Next question',
finishButton: 'Finish', finishButton: 'Finish',
textualProgress: 'Question: @current of @total questions', textualProgress: 'Question: @current of @total questions',
jumpToQuestion: 'Jump to question %d',
questionLabel: 'Question' questionLabel: 'Question'
}, },
endGame: { endGame: {
@ -104,11 +101,6 @@ H5P.QuestionSet = function (options, contentId) {
retryButtonText: 'Retry', retryButtonText: 'Retry',
showAnimations: false, showAnimations: false,
skipButtonText: 'Skip video' skipButtonText: 'Skip video'
},
override: {
overrideButtons: false,
overrideShowSolutionButton: false,
overrideRetry: false
} }
}; };
@ -123,18 +115,31 @@ H5P.QuestionSet = function (options, contentId) {
var up; var up;
renderSolutions = false; renderSolutions = false;
// Set overrides for questions
var override;
if (params.override.showSolutionButton || params.override.retryButton) {
override = {};
if (params.override.showSolutionButton) {
// Force "Show solution" button to be on or off for all interactions
override.enableSolutionsButton =
(params.override.showSolutionButton === 'on' ? true : false);
}
if (params.override.retryButton) {
// Force "Retry" button to be on or off for all interactions
override.enableRetry =
(params.override.retryButton === 'on' ? true : false);
}
}
// Instantiate question instances // Instantiate question instances
for (var i = 0; i < params.questions.length; i++) { for (var i = 0; i < params.questions.length; i++) {
var question = params.questions[i]; var question = params.questions[i];
// TODO: Render on init, inject in template.
// override content parameters. question.jumpAriaLabel = params.texts.jumpToQuestion.replace('%d', i + 1);
if (params.override.overrideButtons) { if (override) {
// Extend subcontent with the overrided settings. // Extend subcontent with the overrided settings.
$.extend(question.params.behaviour, { $.extend(question.params.behaviour, override);
enableRetry: params.override.overrideRetry,
enableSolutionsButton: params.override.overrideShowSolutionButton
});
} }
var questionInstance = H5P.newRunnable(question, contentId, undefined, undefined, {parent: self}); var questionInstance = H5P.newRunnable(question, contentId, undefined, undefined, {parent: self});
questionInstance.on('resize', function () { questionInstance.on('resize', function () {
@ -292,6 +297,23 @@ H5P.QuestionSet = function (options, contentId) {
score: scoreString, score: scoreString,
passed: success passed: success
}; };
/**
* Makes our buttons behave like other buttons.
*
* @private
* @param {string} classSelector
* @param {function} handler
*/
var hookUpButton = function (classSelector, handler) {
$(classSelector, $myDom).click(handler).keypress(function (e) {
if (e.which === 32) {
handler();
e.preventDefault();
}
});
};
var displayResults = function () { var displayResults = function () {
self.triggerXAPICompleted(self.getScore(), self.totalScore(), success); self.triggerXAPICompleted(self.getScore(), self.totalScore(), success);
@ -305,26 +327,38 @@ H5P.QuestionSet = function (options, contentId) {
comment: (success ? params.endGame.successGreeting : params.endGame.failGreeting), comment: (success ? params.endGame.successGreeting : params.endGame.failGreeting),
resulttext: (success ? params.endGame.successComment : params.endGame.failComment), resulttext: (success ? params.endGame.successComment : params.endGame.failComment),
finishButtonText: params.endGame.finishButtonText, finishButtonText: params.endGame.finishButtonText,
solutionButtonText: params.endGame.solutionButtonText solutionButtonText: params.endGame.solutionButtonText,
retryButtonText: params.endGame.retryButtonText
}; };
// Show result page. // Show result page.
$myDom.children().hide(); $myDom.children().hide();
$myDom.append(endTemplate.render(eparams)); $myDom.append(endTemplate.render(eparams));
$('.qs-finishbutton', $myDom).click(function () {
// Add event handlers to summary buttons
hookUpButton('.qs-finishbutton', function () {
self.trigger('h5pQuestionSetFinished', eventData); self.trigger('h5pQuestionSetFinished', eventData);
}); });
$('.qs-solutionbutton', $myDom).click(function () { hookUpButton('.qs-solutionbutton', function () {
showSolutions(); showSolutions();
$myDom.children().hide().filter('.questionset').show(); $myDom.children().hide().filter('.questionset').show();
_showQuestion(params.initialQuestion); _showQuestion(params.initialQuestion);
}); });
$('.qs-retrybutton', $myDom) hookUpButton('.qs-retrybutton', function () {
.html(params.endGame.retryButtonText) resetTask();
.click(function () { $myDom.children().hide();
resetTask();
$myDom.children().hide().filter('.questionset').show(); var $intro = $('.intro-page', $myDom);
_showQuestion(params.initialQuestion);}); if ($intro.length) {
// Show intro
$('.intro-page', $myDom).show();
}
else {
// Show first question
$('.questionset', $myDom).show();
_showQuestion(params.initialQuestion);
}
});
if (scoreBar === undefined) { if (scoreBar === undefined) {
scoreBar = H5P.JoubelUI.createScoreBar(totals); scoreBar = H5P.JoubelUI.createScoreBar(totals);
@ -400,13 +434,15 @@ H5P.QuestionSet = function (options, contentId) {
if (params.introPage.backgroundImage !== undefined) { if (params.introPage.backgroundImage !== undefined) {
var $intro = $myDom.find('.intro-page'); var $intro = $myDom.find('.intro-page');
if ($intro.length) { if ($intro.length) {
var bgImg = params.introPage.backgroundImage;
var bgImgRatio = (bgImg.height / bgImg.width);
$intro.css({ $intro.css({
background: '#fff url("' + H5P.getPath(params.introPage.backgroundImage.path, contentId) + '") no-repeat 50% 50%', background: '#fff url("' + H5P.getPath(bgImg.path, contentId) + '") no-repeat 50% 50%',
backgroundSize: '100% auto' backgroundSize: 'auto 100%',
minHeight: bgImgRatio * +window.getComputedStyle($intro[0]).width.replace('px','')
}); });
} }
} }
var registerImageLoadedListener = function (question) { var registerImageLoadedListener = function (question) {
H5P.on(question, 'imageLoaded', function () { H5P.on(question, 'imageLoaded', function () {
self.trigger('resize'); self.trigger('resize');
@ -422,9 +458,6 @@ H5P.QuestionSet = function (options, contentId) {
// Listen for image resize // Listen for image resize
registerImageLoadedListener(question); registerImageLoadedListener(question);
// Disable feedback for question
question.setBehaviour({disableFeedback: true});
// Add next/finish button // Add next/finish button
if (questionInstances[questionInstances.length -1] === question) { if (questionInstances[questionInstances.length -1] === question) {
@ -435,16 +468,18 @@ H5P.QuestionSet = function (options, contentId) {
} else { } else {
// Add next question button // Add next question button
question.addButton('next', '', moveQuestion.bind(this, 1), true, question.addButton('next', '', moveQuestion.bind(this, 1), true, {
{title: params.texts.nextButton}); href: '#', // Use href since this is a navigation button
'aria-label': params.texts.nextButton
});
} }
// Add previous question button // Add previous question button
if (questionInstances[0] !== question) { if (questionInstances[0] !== question)
question.addButton('prev', '', moveQuestion.bind(this, -1), true, {
question.addButton('prev', '', moveQuestion.bind(this, -1), true, href: '#', // Use href since this is a navigation button
{title: params.texts.prevButton} 'aria-label': params.texts.prevButton
); });
} }
question.on('xAPI', function (event) { question.on('xAPI', function (event) {
@ -474,14 +509,15 @@ H5P.QuestionSet = function (options, contentId) {
$('.qs-startbutton', $myDom).click(function () { $('.qs-startbutton', $myDom).click(function () {
$(this).parents('.intro-page').hide(); $(this).parents('.intro-page').hide();
$('.questionset', $myDom).removeClass('hidden'); $('.questionset', $myDom).show();
_showQuestion(currentQuestion); _showQuestion(params.initialQuestion);
}); });
// Set event listeners. // Set event listeners.
$('.progress-dot', $myDom).click(function () { $('.progress-dot', $myDom).click(function () {
_stopQuestion(currentQuestion); _stopQuestion(currentQuestion);
_showQuestion($(this).index()); _showQuestion($(this).index());
return false;
}); });
// Hide all but initial Question. // Hide all but initial Question.

View File

@ -76,7 +76,12 @@
"description": "النص المستخدم إذا تم تحديد التقدم نصيا" "description": "النص المستخدم إذا تم تحديد التقدم نصيا"
}, },
{ {
"label": "Question label text", "label": "Label for jumping to a certain question",
"description": "You must use the placeholder '%d' instead of the question number.",
"default": "Jump to question %d"
},
{
"label": "Copyright dialog question label",
"default": "Question" "default": "Question"
} }
] ]
@ -143,19 +148,30 @@
}, },
{ {
"label": "إعدادات زر \"مشاهدة حل \" وزر \"إعادة المحاولة\" ", "label": "إعدادات زر \"مشاهدة حل \" وزر \"إعادة المحاولة\" ",
"description": "وهذه الخيارات تمكنك من تجاوز وقت العرض بزر \"مشاهدة حل \" وزر \"إعادة المحاولة \" في محتويات متكامل h5p.",
"fields": [ "fields": [
{ {
"label": "تفعيل زر تجاوز \"مشاهدة حل \" و إعدادات \"إعادة \"المحاولة", "label": "Override \"Show Solution\" button",
"description": "وإذا تم تفعيل هذه الأسئلة سيتم تجاهل الإعدادات الخاصة وسيتم استخدام الضبط أدناه بدلا من ذلك" "description": "This option determines if the \"Show Solution\" button will be shown for all questions, disabled for all or configured for each question individually.",
"options": [
{
"label": "Enabled"
},
{
"label": "Disabled"
}
]
}, },
{ {
"label": "تفعيل زر \"إظهار الحل\"", "label": "Override \"Retry\" button",
"description": "تفعيل هذا الخيار يجعل الأسئلة تظهر زر \"مشاهدة الحل\"" "description": "This option determines if the \"Retry\" button will be shown for all questions, disabled for all or configured for each question individually.",
}, "options": [
{ {
"label": "تفعيل زر \"إعادة المحاولة\"", "label": "Enabled"
"description": "تفعيل هذا الخيار يجعل المستخدم قادرا على \"إعادة المحاولة\"" },
{
"label": "Disabled"
}
]
} }
] ]
} }

View File

@ -81,7 +81,12 @@
"default": "Aktuelle Frage: @current von @total Fragen" "default": "Aktuelle Frage: @current von @total Fragen"
}, },
{ {
"label": "Question label text", "label": "Label for jumping to a certain question",
"description": "You must use the placeholder '%d' instead of the question number.",
"default": "Jump to question %d"
},
{
"label": "Copyright dialog question label",
"default": "Question" "default": "Question"
} }
] ]
@ -158,19 +163,30 @@
}, },
{ {
"label": "Einstellungen für \"Zeige die Lösung\" Button und \"Nochmal\".", "label": "Einstellungen für \"Zeige die Lösung\" Button und \"Nochmal\".",
"description": "Diese Möglichkeiten überschreiben die Anzeige von \"Zeige die Lösung\" Button und \"Nochmal\" bei integrierten h5p Inhalten.",
"fields": [ "fields": [
{ {
"label": "Aktiviert das Überschreiben für \"Zeige die Lösung\" Button und \"Wiederholen\" Einstellungen.", "label": "Override \"Show Solution\" button",
"description": "Wenn dies ausgewählt wurde, werden die Einstellungen der Frage ignoriert und stattdessen werden die nachfolgenden Einstellungen verwendet." "description": "This option determines if the \"Show Solution\" button will be shown for all questions, disabled for all or configured for each question individually.",
"options": [
{
"label": "Enabled"
},
{
"label": "Disabled"
}
]
}, },
{ {
"label": "Aktiviert \"Zeige die Lösung\" Buttons.", "label": "Override \"Retry\" button",
"description": "Wenn dies ausgewählt wurde, werden die Fragen den \"Zeige die Lösung\" Button haben." "description": "This option determines if the \"Retry\" button will be shown for all questions, disabled for all or configured for each question individually.",
}, "options": [
{ {
"label": "Aktiviert \"Wiederholen\".", "label": "Enabled"
"description": "Wenn diese Option gewählt wurde, ermöglicht es den Benutzern zu \"Wiederholen\" ." },
{
"label": "Disabled"
}
]
} }
] ]
} }

View File

@ -76,7 +76,12 @@
"description": "Texte utilisé si la progression textuelle est utilisée." "description": "Texte utilisé si la progression textuelle est utilisée."
}, },
{ {
"label": "Question label text", "label": "Label for jumping to a certain question",
"description": "You must use the placeholder '%d' instead of the question number.",
"default": "Jump to question %d"
},
{
"label": "Copyright dialog question label",
"default": "Question" "default": "Question"
} }
] ]
@ -143,19 +148,30 @@
}, },
{ {
"label": "Options pour les boutons \"Montrer la solution\" et \"Réessayer\".", "label": "Options pour les boutons \"Montrer la solution\" et \"Réessayer\".",
"description": "Ces options vous permettent de choisir quand afficher les boutons \"Solutions\" et \"Réessayer\" dans votre acivité h5p..",
"fields": [ "fields": [
{ {
"label": "Activer les réglages par défaut pour les boutons \"Solution\" et \"Réessayer\".", "label": "Override \"Show Solution\" button",
"description": "Si cette option est choisie, les réglages seront valables pour toutes les questions, les réglages individuels ne seront pas pris en compte." "description": "This option determines if the \"Show Solution\" button will be shown for all questions, disabled for all or configured for each question individually.",
"options": [
{
"label": "Enabled"
},
{
"label": "Disabled"
}
]
}, },
{ {
"label": "Afficher le bouton \"Solution\".", "label": "Override \"Retry\" button",
"description": "Affiche le bouton \"Solution\"." "description": "This option determines if the \"Retry\" button will be shown for all questions, disabled for all or configured for each question individually.",
}, "options": [
{ {
"label": "Afficher le bouton \"Réessayer\".", "label": "Enabled"
"description": "Affiche le bouton \"Réessayer\"." },
{
"label": "Disabled"
}
]
} }
] ]
} }

View File

@ -76,7 +76,12 @@
"description": "esto utilizzato se il testo Avanzamento è selezionato." "description": "esto utilizzato se il testo Avanzamento è selezionato."
}, },
{ {
"label": "Question label text", "label": "Label for jumping to a certain question",
"description": "You must use the placeholder '%d' instead of the question number.",
"default": "Jump to question %d"
},
{
"label": "Copyright dialog question label",
"default": "Question" "default": "Question"
} }
] ]
@ -143,19 +148,30 @@
}, },
{ {
"label": "Impostazioni per i pulsanti \"Mostra soluzione\" e \"Riprova\".", "label": "Impostazioni per i pulsanti \"Mostra soluzione\" e \"Riprova\".",
"description": "Queste opzioni consentono di ignorare quando visualizzare i pulsanti \"Mostra soluzione\" e \"Riprova\" nel contenuto H5P integrato.",
"fields": [ "fields": [
{ {
"label": "Abilita ignora impostazioni per \"Mostra soluzione\" e \"Riprova\".", "label": "Override \"Show Solution\" button",
"description": "Se questa opzione è abilitata le proprie impostazioni per le domande saranno ignorate e verranno utilizzate le impostazioni seguenti." "description": "This option determines if the \"Show Solution\" button will be shown for all questions, disabled for all or configured for each question individually.",
"options": [
{
"label": "Enabled"
},
{
"label": "Disabled"
}
]
}, },
{ {
"label": "Abilita pulsanti \"Mostra soluzione\".", "label": "Override \"Retry\" button",
"description": "L'attivazione di questa opzione farà in modo che le domande mostrino il tasto \"Mostra soluzione\"." "description": "This option determines if the \"Retry\" button will be shown for all questions, disabled for all or configured for each question individually.",
}, "options": [
{ {
"label": "Abilita \"Riprova\".", "label": "Enabled"
"description": "L'attivazione di questa opzione farà in modo che per l'utente sia abilitata l'opzione \"Riprova\"." },
{
"label": "Disabled"
}
]
} }
] ]
} }

View File

@ -62,11 +62,11 @@
"fields": [ "fields": [
{ {
"label": "Forrige-knappen", "label": "Forrige-knappen",
"default": "Forrige" "default": "Forrige spørsmål"
}, },
{ {
"label": "Neste-knappen", "label": "Neste-knappen",
"default": "Neste" "default": "Neste spørsmål"
}, },
{ {
"label": "Avslutt-knappen", "label": "Avslutt-knappen",
@ -78,7 +78,12 @@
"default": "Deloppgave @current av @total" "default": "Deloppgave @current av @total"
}, },
{ {
"label": "Spørsmåls-etikett", "label": "Merkelapp ved hopping til spørsmål",
"description": "Du må bruke plassholderen '%d' istedenfor spørsmålsnummeret.",
"default": "Hopp til spørsmål %d"
},
{
"label": "Opphavsrett spørsmål-etikett",
"default": "Spørsmål" "default": "Spørsmål"
} }
] ]
@ -154,20 +159,31 @@
] ]
}, },
{ {
"label": "Innstillinger for \"Vis svar\" knapp og \"Prøv igjen\".", "label": "Innstillinger for «Vis svar»- og «Prøv igjen»-knapp",
"description": "Disse instillingene lar deg overstyre når \"Vis svar\" knapp og \"Prøv igjen\" er slått på i integrert h5p innhold.",
"fields": [ "fields": [
{ {
"label": "Slå på overstyring for \"Vis svar\" og \"Prøv igjen\".", "label": "Overstyr «Vis svar»-knapp",
"description": "Aktivering vil overstyre de følgende innstillingene for integrert innhold." "description": "Dette valget avgjør om «Vis svar»-knappen vil vises for alle spørsmål, skjules for alle eller konfigureres individuelt for hvert spørsmål.",
"options": [
{
"label": "Aktivert"
},
{
"label": "Deaktivert"
}
]
}, },
{ {
"label": "Slå på \"Vis svar\" knapp.", "label": "Overstyr «Prøv igjen»-knapp",
"description": "Aktivering vil slå på \"Vis svar\" knappen." "description": "Dette valget avgjør om «Prøv igjen»-knappen vil vises for alle spørsmål, skjules for alle eller konfigureres individuelt for hvert spørsmål.",
}, "options": [
{ {
"label": "Slå på \"Prøv igjen\".", "label": "Aktivert"
"description": "Aktivering vil slå på \"Prøv igjen\" ." },
{
"label": "Deaktivert"
}
]
} }
] ]
} }

View File

@ -78,7 +78,12 @@
"default": "Deloppgave @current av @total" "default": "Deloppgave @current av @total"
}, },
{ {
"label": "Spørsmål-etikett", "label": "Merkelapp ved hopping til spørsmål",
"description": "Du må bruke plassholderen '%d' istedenfor spørsmålstalet.",
"default": "Hopp til spørsmål %d"
},
{
"label": "Opphavsrett spørsmål-etikett",
"default": "Spørsmål" "default": "Spørsmål"
} }
] ]
@ -154,20 +159,31 @@
] ]
}, },
{ {
"label": "Innstillinger for \"Vis svar\" knapp og \"Prøv igjen\".", "label": "Innstillinger for «Vis svar»- og «Prøv igjen»-knapp",
"description": "Disse instillingene lar deg overstyre når \"Vis svar\" knapp og \"Prøv igjen\" er slått på i integrert h5p innhald.",
"fields": [ "fields": [
{ {
"label": "Slå på overstyring for \"Vis svar\" og \"Prøv igjen\".", "label": "Overstyr «Vis svar»-knapp",
"description": "Aktivering vil overstyre dei følgjande innstillingene for integrert innhald." "description": "Dette valget avgjør om «Vis svar»-knappen vil vises for alle spørsmål, skjules for alle eller konfigureres individuelt for hvert spørsmål.",
"options": [
{
"label": "Aktivert"
},
{
"label": "Deaktivert"
}
]
}, },
{ {
"label": "Slå på \"Vis svar\" knapp.", "label": "Overstyr «Prøv igjen»-knapp",
"description": "Aktivering vil slå på \"Vis svar\" knappen." "description": "Dette valget avgjør om «Prøv igjen»-knappen vil vises for alle spørsmål, skjules for alle eller konfigureres individuelt for hvert spørsmål.",
}, "options": [
{ {
"label": "Slå på \"Prøv igjen\".", "label": "Aktivert"
"description": "Aktivering vil slå på \"Prøv igjen\" ." },
{
"label": "Deaktivert"
}
]
} }
] ]
} }

View File

@ -58,7 +58,7 @@
{ {
"machineName": "H5PEditor.QuestionSetTextualEditor", "machineName": "H5PEditor.QuestionSetTextualEditor",
"majorVersion": 1, "majorVersion": 1,
"minorVersion": 0 "minorVersion": 1
} }
] ]
} }

View File

@ -128,13 +128,13 @@
"name": "prevButton", "name": "prevButton",
"type": "text", "type": "text",
"label": "Back button", "label": "Back button",
"default": "Previous" "default": "Previous question"
}, },
{ {
"name": "nextButton", "name": "nextButton",
"type": "text", "type": "text",
"label": "Next button", "label": "Next button",
"default": "Next" "default": "Next question"
}, },
{ {
"name": "finishButton", "name": "finishButton",
@ -153,6 +153,13 @@
"em" "em"
] ]
}, },
{
"name": "jumpToQuestion",
"type": "text",
"label": "Label for jumping to a certain question",
"description": "You must use the placeholder '%d' instead of the question number.",
"default": "Jump to question %d"
},
{ {
"name": "questionLabel", "name": "questionLabel",
"type": "text", "type": "text",
@ -306,30 +313,42 @@
{ {
"name": "override", "name": "override",
"type": "group", "type": "group",
"label": "Settings for \"Show solution\" button and \"Retry\".", "label": "Settings for \"Show solution\" and \"Retry\" buttons",
"description": "These options will let you override when to display \"Show solution\" button and \"Retry\" in integrated h5p content.",
"optional": true, "optional": true,
"fields": [ "fields": [
{ {
"name": "overrideButtons", "name": "showSolutionButton",
"type": "boolean", "type": "select",
"label": "Enable override for \"Show solution\" and \"Retry\" settings.", "label": "Override \"Show Solution\" button",
"description": "If this is enabled the questions own settings will be ignored and the below settings will be used instead.", "description": "This option determines if the \"Show Solution\" button will be shown for all questions, disabled for all or configured for each question individually.",
"default": false "optional": true,
"options": [
{
"value": "on",
"label": "Enabled"
},
{
"value": "off",
"label": "Disabled"
}
]
}, },
{ {
"name": "overrideShowSolutionButton", "name": "retryButton",
"type": "boolean", "type": "select",
"label": "Enable \"Show solution\" buttons.", "label": "Override \"Retry\" button",
"description": "Enabling this option will make questions show the \"Show solution\" button.", "description": "This option determines if the \"Retry\" button will be shown for all questions, disabled for all or configured for each question individually.",
"default": false "optional": true,
}, "options": [
{ {
"name": "overrideRetry", "value": "on",
"type": "boolean", "label": "Enabled"
"label": "Enable \"Retry\".", },
"description": "Enabling this option will make the user able to \"Retry\" .", {
"default": false "value": "off",
"label": "Disabled"
}
]
} }
] ]
} }

View File

@ -16,14 +16,40 @@ H5PUpgrades['H5P.QuestionSet'] = (function ($) {
} }
finished(null, parameters); finished(null, parameters);
}, },
8: function (parameters, finished) {
parameters.texts = parameters.texts || {};
if (parameters.questionLabel) { /**
parameters.texts.questionLabel = parameters.questionLabel; * Asynchronous content upgrade hook.
delete parameters.questionLabel; * Upgrades content parameters to support IV 1.7.
*
* Groups all UI text strings to make them eaiser to translate and handle.
*
* @params {Object} parameters
* @params {function} finished
*/
8: function (parameters, finished) {
if (parameters.override.overrideButtons) {
// Set new variables
parameters.override.showSolutionButton =
(parameters.override.overrideShowSolutionButton ? 'on' : 'off');
parameters.override.retryButton =
(parameters.override.overrideRetry ? 'on' : 'off');
} }
// Remove old field variables
delete parameters.override.overrideButtons;
delete parameters.override.overrideShowSolutionButton;
delete parameters.override.overrideRetry;
// Move copyright dialog question label
if (parameters.questionLabel) {
parameters.texts = parameters.texts || {};
parameters.texts.questionLabel = parameters.questionLabel;
}
// Remove old copyright dialog question label
delete parameters.questionLabel;
finished(null, parameters); finished(null, parameters);
} }
} }