Numerus bug fixes and improved editor for boardgame.
Fixed CKEditor readonly when created in invisible field.pull/1/head
parent
0118a7dfe9
commit
9b3130b463
|
@ -54,7 +54,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.questionset-results .greeting {
|
.questionset-results .greeting {
|
||||||
margin-top: 180px;
|
margin: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.questionset-results .score {
|
.questionset-results .score {
|
||||||
|
|
|
@ -71,14 +71,14 @@ H5P.QuestionSet = function (options, contentId) {
|
||||||
title: '',
|
title: '',
|
||||||
randomOrder: false,
|
randomOrder: false,
|
||||||
initialQuestion: 0,
|
initialQuestion: 0,
|
||||||
backgroundImage: '',
|
backgroundImage: undefined,
|
||||||
progressType: 'dots',
|
progressType: 'dots',
|
||||||
passPercentage: 50,
|
passPercentage: 50,
|
||||||
questions: [],
|
questions: [],
|
||||||
introPage: {
|
introPage: {
|
||||||
showIntroPage: true,
|
showIntroPage: true,
|
||||||
title: 'Welcome',
|
title: '',
|
||||||
introduction: 'Click start to start.',
|
introduction: '',
|
||||||
startButtonText: 'Start'
|
startButtonText: 'Start'
|
||||||
},
|
},
|
||||||
texts: {
|
texts: {
|
||||||
|
@ -89,20 +89,16 @@ H5P.QuestionSet = function (options, contentId) {
|
||||||
},
|
},
|
||||||
endGame: {
|
endGame: {
|
||||||
showResultPage: true,
|
showResultPage: true,
|
||||||
resultPage: {
|
|
||||||
successGreeting: 'Congratulations!',
|
successGreeting: 'Congratulations!',
|
||||||
successComment: 'You have enough correct answers to pass the test.',
|
successComment: 'You have enough correct answers to pass the test.',
|
||||||
failGreeting: 'Sorry!',
|
failGreeting: 'Sorry!',
|
||||||
failComment: "You don't have enough correct answers to pass this test.",
|
failComment: "You don't have enough correct answers to pass this test.",
|
||||||
scoreString: '@score/@total',
|
scoreString: '@score/@total',
|
||||||
finishButtonText: 'Finish'
|
finishButtonText: 'Finish',
|
||||||
},
|
|
||||||
animations: {
|
|
||||||
showAnimations: false,
|
showAnimations: false,
|
||||||
successVideo: undefined,
|
successVideo: undefined,
|
||||||
failVideo: undefined
|
failVideo: undefined
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var template = new EJS({text: texttemplate});
|
var template = new EJS({text: texttemplate});
|
||||||
|
@ -186,7 +182,7 @@ H5P.QuestionSet = function (options, contentId) {
|
||||||
// Get total score.
|
// Get total score.
|
||||||
var finals = getScore();
|
var finals = getScore();
|
||||||
var totals = totalScore();
|
var totals = totalScore();
|
||||||
var scoreString = params.endGame.resultPage.scoreString.replace("@score", finals).replace("@total", totals);
|
var scoreString = params.endGame.scoreString.replace("@score", finals).replace("@total", totals);
|
||||||
var success = ((100 * finals / totals) >= params.passPercentage);
|
var success = ((100 * finals / totals) >= params.passPercentage);
|
||||||
var eventData = {
|
var eventData = {
|
||||||
score: scoreString,
|
score: scoreString,
|
||||||
|
@ -199,11 +195,11 @@ H5P.QuestionSet = function (options, contentId) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var eparams = {
|
var eparams = {
|
||||||
greeting: (success ? params.endGame.resultPage.succesGreeting : params.endGame.resultPage.failGreeting),
|
greeting: (success ? params.endGame.successGreeting : params.endGame.failGreeting),
|
||||||
score: scoreString,
|
score: scoreString,
|
||||||
scoreclass: (success ? 'success' : 'fail'),
|
scoreclass: (success ? 'success' : 'fail'),
|
||||||
resulttext: (success ? params.endGame.resultPage.successComment : params.endGame.resultPage.failComment),
|
resulttext: (success ? params.endGame.successComment : params.endGame.failComment),
|
||||||
finishButtonText: params.endGame.resultPage.finishButtonText
|
finishButtonText: params.endGame.finishButtonText
|
||||||
};
|
};
|
||||||
|
|
||||||
// Show result page.
|
// Show result page.
|
||||||
|
@ -214,8 +210,8 @@ H5P.QuestionSet = function (options, contentId) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
if (params.endGame.animations.showAnimations) {
|
if (params.endGame.showAnimations) {
|
||||||
var videoData = success ? params.endGame.animations.successVideo : params.endGame.animations.failVideo;
|
var videoData = success ? params.endGame.successVideo : params.endGame.failVideo;
|
||||||
if (videoData) {
|
if (videoData) {
|
||||||
var $videoContainer = $('<div class="video-container"></div>').appendTo($myDom);
|
var $videoContainer = $('<div class="video-container"></div>').appendTo($myDom);
|
||||||
|
|
||||||
|
@ -231,8 +227,8 @@ H5P.QuestionSet = function (options, contentId) {
|
||||||
};
|
};
|
||||||
video.attach($videoContainer);
|
video.attach($videoContainer);
|
||||||
|
|
||||||
if (params.endGame.animations.skipButtonText) {
|
if (params.endGame.skipButtonText) {
|
||||||
$('<a class="button skip">' + params.endGame.animations.skipButtonText + '</a>').click(function () {
|
$('<a class="button skip">' + params.endGame.skipButtonText + '</a>').click(function () {
|
||||||
video.stop();
|
video.stop();
|
||||||
$videoContainer.hide();
|
$videoContainer.hide();
|
||||||
displayResults();
|
displayResults();
|
||||||
|
@ -256,9 +252,12 @@ H5P.QuestionSet = function (options, contentId) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render own DOM into target.
|
// Render own DOM into target.
|
||||||
$myDom.html(template.render(params)).css({
|
$myDom.html(template.render(params));
|
||||||
backgroundImage: 'url(' + cp + params.backgroundImage.path + ')'
|
if (params.backgroundImage !== undefined) {
|
||||||
|
$myDom.css({
|
||||||
|
background: 'url(' + cp + params.backgroundImage.path + ')'
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Attach questions
|
// Attach questions
|
||||||
for (var i = 0; i < questionInstances.length; i++) {
|
for (var i = 0; i < questionInstances.length; i++) {
|
||||||
|
|
|
@ -15,12 +15,14 @@
|
||||||
"name": "initialQuestion",
|
"name": "initialQuestion",
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"label": "Initial question",
|
"label": "Initial question",
|
||||||
"description": "Which question to start with. Count from 0."
|
"description": "Which question to start with. Count from 0.",
|
||||||
|
"default": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "backgroundImage",
|
"name": "backgroundImage",
|
||||||
"type": "image",
|
"type": "image",
|
||||||
"label": "Background image",
|
"label": "Background image",
|
||||||
|
"optional": true,
|
||||||
"description": "An optional background image for the Question set."
|
"description": "An optional background image for the Question set."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -52,6 +54,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "questions",
|
"name": "questions",
|
||||||
|
"label": "Questions",
|
||||||
"type": "list",
|
"type": "list",
|
||||||
"entity": "question",
|
"entity": "question",
|
||||||
"field": {
|
"field": {
|
||||||
|
@ -74,28 +77,35 @@
|
||||||
{
|
{
|
||||||
"name": "introPage",
|
"name": "introPage",
|
||||||
"type": "group",
|
"type": "group",
|
||||||
"label": "Intro page",
|
"label": "Quiz introduction",
|
||||||
"description": "Data for the intro page.",
|
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"name": "showIntroPage",
|
"name": "showIntroPage",
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"label": "Show intro page?"
|
"label": "Display introduction"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "title",
|
"name": "title",
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"label": "Title"
|
"label": "Title",
|
||||||
|
"optional": true,
|
||||||
|
"description": "This title will be displayed above the introduction text."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "introduction",
|
"name": "introduction",
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"label": "Introduction text"
|
"widget": "textarea",
|
||||||
|
"label": "Introduction text",
|
||||||
|
"optional": true,
|
||||||
|
"description": "This text will be displayed before the quiz starts."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "startButtonText",
|
"name": "startButtonText",
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"label": "Start button text"
|
"label": "Start button text",
|
||||||
|
"optional": true,
|
||||||
|
"placeholder": "Start Quiz",
|
||||||
|
"default": "Start Quiz"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -135,86 +145,84 @@
|
||||||
{
|
{
|
||||||
"name": "endGame",
|
"name": "endGame",
|
||||||
"type": "group",
|
"type": "group",
|
||||||
"label": "End game data",
|
"label": "Quiz finished",
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"name": "showResultPage",
|
"name": "showResultPage",
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"label": "Show result page",
|
"label": "Display results",
|
||||||
"default": true
|
"default": true
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "resultPage",
|
|
||||||
"type": "group",
|
|
||||||
"label": "Result page",
|
|
||||||
"description": "Data and texts for the result page.",
|
|
||||||
"fields": [
|
|
||||||
{
|
{
|
||||||
"name": "successGreeting",
|
"name": "successGreeting",
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"label": "Success greeting",
|
"label": "Quiz passed title",
|
||||||
"description": "Title in result page on success."
|
"placeholder": "Congratulations!",
|
||||||
|
"default": "Congratulations!",
|
||||||
|
"description": "This title will be displayed above results if the user has successfully passed the quiz."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "successComment",
|
"name": "successComment",
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"label": "Success comment",
|
"widget": "textarea",
|
||||||
"description": "Comment shown after the score."
|
"label": "Passed comment",
|
||||||
|
"default": "You did very well!",
|
||||||
|
"description": "This comment will be displayed after the score if the user has successfully passed the quiz."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "failGreeting",
|
"name": "failGreeting",
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"label": "Failed greeting",
|
"label": "Quiz failed title",
|
||||||
"description": "Title in result page on failed quiz."
|
"placeholder": "Oh, no!",
|
||||||
|
"default": "Oh, no!",
|
||||||
|
"description": "This title will be displayed above the results if the user has failed the quiz."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "failComment",
|
"name": "failComment",
|
||||||
"type": "text",
|
"type": "text",
|
||||||
|
"widget": "textarea",
|
||||||
"label": "Failed comment",
|
"label": "Failed comment",
|
||||||
"description": "Comment shown after the score on failed quiz."
|
"default": "This didn't go so well.",
|
||||||
|
"description": "This comment will be displayed after the score if the user has failed the quiz."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "finishButtonText",
|
"name": "finishButtonText",
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"label": "Finish button text",
|
"label": "Finish button text",
|
||||||
|
"default": "Finish",
|
||||||
"description": "Text for the finish button."
|
"description": "Text for the finish button."
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "animations",
|
|
||||||
"type": "group",
|
|
||||||
"label": "Animations",
|
|
||||||
"fields": [
|
|
||||||
{
|
{
|
||||||
"name": "showAnimations",
|
"name": "showAnimations",
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"label": "Show animations"
|
"label": "Display video before quiz results"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "skippable",
|
"name": "skippable",
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"label": "Skippable"
|
"label": "Enable skip video button"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "skipButtonText",
|
"name": "skipButtonText",
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"label": "Skip button text",
|
"label": "Skip video button label",
|
||||||
|
"default": "Skip video",
|
||||||
|
"description": "This is the label for the button which allows users to skip videos after a quiz.",
|
||||||
"common": true
|
"common": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "successVideo",
|
"name": "successVideo",
|
||||||
"type": "video",
|
"type": "video",
|
||||||
"label": "Success video",
|
"label": "Passed video",
|
||||||
"description": "Video displayed on successful quiz."
|
"optional": true,
|
||||||
|
"description": "This video will be played if the user successfully passed the quiz."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "failVideo",
|
"name": "failVideo",
|
||||||
"type": "video",
|
"type": "video",
|
||||||
"label": "Fail video",
|
"label": "Fail video",
|
||||||
"description": "Video displayed on failed quiz."
|
"optional": true,
|
||||||
}
|
"description": "This video will be played if the user failes the quiz."
|
||||||
]
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue