From 3036f888af43c6d94fd34b7e232bed01a73a6528 Mon Sep 17 00:00:00 2001 From: Thomas Marstrander Date: Thu, 17 Mar 2016 14:09:13 +0100 Subject: [PATCH] Fix unused semantics. HFJ-1710 --- js/questionset.js | 42 +++++++++++++++++++++++++----------------- language/ar.json | 8 ++++---- language/de.json | 4 ++++ language/fr.json | 8 ++++---- language/it.json | 8 ++++---- language/nb.json | 8 ++++---- language/nn.json | 8 ++++---- library.json | 2 +- semantics.json | 12 ++++++------ upgrades.js | 10 ++++++++++ 10 files changed, 66 insertions(+), 44 deletions(-) diff --git a/js/questionset.js b/js/questionset.js index c34a4a8..50151c4 100644 --- a/js/questionset.js +++ b/js/questionset.js @@ -79,7 +79,8 @@ H5P.QuestionSet = function (options, contentId) { prevButton: 'Previous', nextButton: 'Next', finishButton: 'Finish', - textualProgress: 'Question: @current of @total questions' + textualProgress: 'Question: @current of @total questions', + questionLabel: 'Question' }, endGame: { showResultPage: true, @@ -92,14 +93,14 @@ H5P.QuestionSet = function (options, contentId) { finishButtonText: 'Finish', solutionButtonText: 'Show solution', retryButtonText: 'Retry', - showAnimations: false + showAnimations: false, + skipButtonText: 'Skip video' }, override: { overrideButtons: false, overrideShowSolutionButton: false, overrideRetry: false - }, - questionLabel: 'Question' + } }; var template = new EJS({text: texttemplate}); @@ -252,6 +253,17 @@ H5P.QuestionSet = function (options, contentId) { rendered = false; }; + var moveQuestion = function (direction) { + _stopQuestion(currentQuestion); + if (currentQuestion + direction >= questionInstances.length) { + _displayEndGame(); + + } + else { + _showQuestion(currentQuestion + direction); + } + }; + var _displayEndGame = function () { if (rendered) { $myDom.children().hide().filter('.questionset-results').show(); @@ -406,26 +418,22 @@ H5P.QuestionSet = function (options, contentId) { if (questionInstances[questionInstances.length -1] === question) { // Add finish question set button - question.addButton('finish', params.texts.finishButton, function () { - _stopQuestion(currentQuestion); - _displayEndGame(); - }, false); + question.addButton('finish', params.texts.finishButton, + moveQuestion.bind(this, 1), false); } else { // Add next question button - question.addButton('next', '', function () { - _stopQuestion(currentQuestion); - _showQuestion(currentQuestion + 1); - }); + question.addButton('next', '', moveQuestion.bind(this, 1), true, + {title: params.texts.nextButton}); } // Add previous question button if (questionInstances[0] !== question) { - question.addButton('prev', '', function () { - _stopQuestion(currentQuestion); - _showQuestion(currentQuestion - 1); - }); + + question.addButton('prev', '', moveQuestion.bind(this, -1), true, + {title: params.texts.prevButton} + ); } question.on('xAPI', function (event) { @@ -529,7 +537,7 @@ H5P.QuestionSet = function (options, contentId) { } // Determine label - var label = (params.questionLabel + ' ' + (i + 1)); + var label = (params.texts.questionLabel + ' ' + (i + 1)); if (qParams.contentName !== undefined) { label += ': ' + qParams.contentName; } diff --git a/language/ar.json b/language/ar.json index 55032b7..e2c6036 100644 --- a/language/ar.json +++ b/language/ar.json @@ -74,6 +74,10 @@ { "label": "نص التقدم", "description": "النص المستخدم إذا تم تحديد التقدم نصيا" + }, + { + "label": "Question label text", + "default": "Question" } ] }, @@ -154,10 +158,6 @@ "description": "تفعيل هذا الخيار يجعل المستخدم قادرا على \"إعادة المحاولة\"" } ] - }, - { - "label": "Question label text", - "default": "Question" } ] } diff --git a/language/de.json b/language/de.json index 428a353..bbb1aae 100644 --- a/language/de.json +++ b/language/de.json @@ -79,6 +79,10 @@ "label": "Fortschrittstext", "description": "Verwendeter Text wenn Text Fortschrittsanzeige gewählt wurde.", "default": "Aktuelle Frage: @current von @total Fragen" + }, + { + "label": "Question label text", + "default": "Question" } ] }, diff --git a/language/fr.json b/language/fr.json index 27eb841..9120558 100644 --- a/language/fr.json +++ b/language/fr.json @@ -74,6 +74,10 @@ { "label": "Texte de progression", "description": "Texte utilisé si la progression textuelle est utilisée." + }, + { + "label": "Question label text", + "default": "Question" } ] }, @@ -154,10 +158,6 @@ "description": "Affiche le bouton \"Réessayer\"." } ] - }, - { - "label": "Texte de la question", - "default": "Question" } ] } diff --git a/language/it.json b/language/it.json index 6f52c6f..9617f83 100644 --- a/language/it.json +++ b/language/it.json @@ -74,6 +74,10 @@ { "label": "Testo Avanzamento", "description": "esto utilizzato se il testo Avanzamento è selezionato." + }, + { + "label": "Question label text", + "default": "Question" } ] }, @@ -154,10 +158,6 @@ "description": "L'attivazione di questa opzione farà in modo che per l'utente sia abilitata l'opzione \"Riprova\"." } ] - }, - { - "label": "Question label text", - "default": "Question" } ] } diff --git a/language/nb.json b/language/nb.json index 023a101..cbc3739 100644 --- a/language/nb.json +++ b/language/nb.json @@ -76,6 +76,10 @@ "label": "Fremdriftstekst", "description": "Tekst brukt hvis tekstlig angivelse av fremdrift er valgt. Variabler: @current og @total", "default": "Deloppgave @current av @total" + }, + { + "label": "Spørsmåls-etikett", + "default": "Spørsmål" } ] }, @@ -166,10 +170,6 @@ "description": "Aktivering vil slå på \"Prøv igjen\" ." } ] - }, - { - "label": "Spørsmål-etikett", - "default": "Spørsmål" } ] } diff --git a/language/nn.json b/language/nn.json index 106be80..223eb8a 100644 --- a/language/nn.json +++ b/language/nn.json @@ -76,6 +76,10 @@ "label": "Fremdriftstekst", "description": "Tekst brukt hvis tekstlig angivelse av fremdrift er valgt. Variabler: @current og @total", "default": "Deloppgave @current av @total" + }, + { + "label": "Spørsmål-etikett", + "default": "Spørsmål" } ] }, @@ -166,10 +170,6 @@ "description": "Aktivering vil slå på \"Prøv igjen\" ." } ] - }, - { - "label": "Spørsmål-etikett", - "default": "Spørsmål" } ] } diff --git a/library.json b/library.json index b110dda..62bb6ac 100644 --- a/library.json +++ b/library.json @@ -3,7 +3,7 @@ "description": "Put together a set of different questions that has to be solved. (Quiz)", "contentType": "question", "majorVersion": 1, - "minorVersion": 7, + "minorVersion": 8, "patchVersion": 0, "embedTypes": [ "iframe" diff --git a/semantics.json b/semantics.json index de90e20..de7fd8f 100644 --- a/semantics.json +++ b/semantics.json @@ -152,6 +152,12 @@ "strong", "em" ] + }, + { + "name": "questionLabel", + "type": "text", + "label": "Copyright dialog question label", + "default": "Question" } ] }, @@ -326,11 +332,5 @@ "default": false } ] - }, - { - "name": "questionLabel", - "type": "text", - "label": "Question label text", - "default": "Question" } ] diff --git a/upgrades.js b/upgrades.js index 77c5add..598c89a 100644 --- a/upgrades.js +++ b/upgrades.js @@ -14,6 +14,16 @@ H5PUpgrades['H5P.QuestionSet'] = (function ($) { }); } } + finished(null, parameters); + }, + 8: function (parameters, finished) { + parameters.texts = parameters.texts || {}; + + if (parameters.questionLabel) { + parameters.texts.questionLabel = parameters.questionLabel; + delete parameters.questionLabel; + } + finished(null, parameters); } }