HFP-1451 Show solution button on end screen shown by default

pull/13/merge
Paal Joergensen 2017-08-30 09:04:01 +02:00
parent 8da729c667
commit 36269a8253
1 changed files with 48 additions and 46 deletions

View File

@ -20,6 +20,52 @@ H5P.QuestionSet = function (options, contentId, contentData) {
var self = this; var self = this;
this.contentId = contentId; this.contentId = contentId;
var defaults = {
initialQuestion: 0,
progressType: 'dots',
passPercentage: 50,
questions: [],
introPage: {
showIntroPage: false,
title: '',
introduction: '',
startButtonText: 'Start'
},
texts: {
prevButton: 'Previous question',
nextButton: 'Next question',
finishButton: 'Finish',
textualProgress: 'Question: @current of @total questions',
jumpToQuestion: 'Question %d of %total',
questionLabel: 'Question',
readSpeakerProgress: 'Question @current of @total',
unansweredText: 'Unanswered',
answeredText: 'Answered',
currentQuestionText: 'Current question'
},
endGame: {
showResultPage: true,
noResultMessage: 'Finished',
message: 'Your result:',
oldFeedback: {
successGreeting: '',
successComment: '',
failGreeting: '',
failComment: ''
},
overallFeedback: [],
finishButtonText: 'Finish',
solutionButtonText: 'Show solution',
retryButtonText: 'Retry',
showAnimations: false,
skipButtonText: 'Skip video',
showSolutionButton: true
},
override: {},
disableBackwardsNavigation: false
};
var params = $.extend(true, {}, defaults, options);
var texttemplate = var texttemplate =
'<% if (introPage.showIntroPage) { %>' + '<% if (introPage.showIntroPage) { %>' +
'<div class="intro-page">' + '<div class="intro-page">' +
@ -61,7 +107,7 @@ H5P.QuestionSet = function (options, contentId, contentData) {
' </div>' + ' </div>' +
'</div>'; '</div>';
var solutionButtonTemplate = options.endGame.showSolutionButton ? var solutionButtonTemplate = params.endGame.showSolutionButton ?
' <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>':
''; '';
@ -85,53 +131,9 @@ H5P.QuestionSet = function (options, contentId, contentData) {
' </div>' + ' </div>' +
'</div>'; '</div>';
var defaults = {
initialQuestion: 0,
progressType: 'dots',
passPercentage: 50,
questions: [],
introPage: {
showIntroPage: false,
title: '',
introduction: '',
startButtonText: 'Start'
},
texts: {
prevButton: 'Previous question',
nextButton: 'Next question',
finishButton: 'Finish',
textualProgress: 'Question: @current of @total questions',
jumpToQuestion: 'Question %d of %total',
questionLabel: 'Question',
readSpeakerProgress: 'Question @current of @total',
unansweredText: 'Unanswered',
answeredText: 'Answered',
currentQuestionText: 'Current question'
},
endGame: {
showResultPage: true,
noResultMessage: 'Finished',
message: 'Your result:',
oldFeedback: {
successGreeting: '',
successComment: '',
failGreeting: '',
failComment: ''
},
overallFeedback: [],
finishButtonText: 'Finish',
solutionButtonText: 'Show solution',
retryButtonText: 'Retry',
showAnimations: false,
skipButtonText: 'Skip video'
},
override: {},
disableBackwardsNavigation: false
};
var template = new EJS({text: texttemplate}); var template = new EJS({text: texttemplate});
var endTemplate = new EJS({text: resulttemplate}); var endTemplate = new EJS({text: resulttemplate});
var params = $.extend(true, {}, defaults, options);
var initialParams = $.extend(true, {}, defaults, options); var initialParams = $.extend(true, {}, defaults, options);
var poolOrder; // Order of questions in a pool var poolOrder; // Order of questions in a pool