Merge branch 'master' of github.com:h5p/h5p-question-set

d3summaryChart
Svein-Tore Griff With 2014-11-01 16:45:51 +01:00
commit 0ee099df25
7 changed files with 124 additions and 142 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
*~ *~
/nbproject/private/

View File

@ -53,10 +53,10 @@
box-shadow: 0 0 0.5em #c7c7c7; box-shadow: 0 0 0.5em #c7c7c7;
} }
.progress-dot.answered { .progress-dot.answered {
background: #bccade; background: #73a2d5;
} }
.progress-dot.current { .progress-dot.current {
background: #267ec9; background: #285585;
} }
.intro-page .title { .intro-page .title {
@ -96,14 +96,14 @@
} }
.qs-footer .button, .qs-startbutton, .qs-finishbutton, .questionset-results .button, .video-container > .button { .qs-footer .button, .qs-startbutton, .qs-finishbutton, .questionset-results .button, .video-container > .button {
display: inline-block; display: inline-block;
padding: 0.2em 1em; padding: 0 0.7em;
border: 0.2em solid #fff; border: 0.2em solid #fff;
border-radius: 0.4em; border-radius: 0.4em;
margin: 0 0.5em 1em; margin: 0 0.5em 1em;
cursor: pointer; cursor: pointer;
color: #ffffff; color: #ffffff;
box-shadow: 0 0 0.5em #999; box-shadow: 0 0 0.5em #999;
line-height: 1.9em;
background: rgb(100,152,254); /* Old browsers */ background: rgb(100,152,254); /* Old browsers */
background: -moz-linear-gradient(top, rgba(100,152,254,1) 0%, rgba(4,104,206,1) 100%); /* FF3.6+ */ background: -moz-linear-gradient(top, rgba(100,152,254,1) 0%, rgba(4,104,206,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(100,152,254,1)), color-stop(100%,rgba(4,104,206,1))); /* Chrome,Safari4+ */ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(100,152,254,1)), color-stop(100%,rgba(4,104,206,1))); /* Chrome,Safari4+ */
@ -116,7 +116,7 @@
text-decoration: none; text-decoration: none;
box-shadow: 0 0 0.5em #999; box-shadow: 0 0 0.5em #999;
color: #ffffff; color: #ffffff;
border-color: #fff;
background: rgb(4,104,206); /* Old browsers */ background: rgb(4,104,206); /* Old browsers */
background: -moz-linear-gradient(top, rgba(4,104,206,1) 0%, rgba(100,152,254,1) 100%); /* FF3.6+ */ background: -moz-linear-gradient(top, rgba(4,104,206,1) 0%, rgba(100,152,254,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(4,104,206,1)), color-stop(100%,rgba(100,152,254,1))); /* Chrome,Safari4+ */ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(4,104,206,1)), color-stop(100%,rgba(100,152,254,1))); /* Chrome,Safari4+ */
@ -139,12 +139,12 @@
.qs-footer a.next.button:after { .qs-footer a.next.button:after {
font-family: 'H5PFontAwesome4'; font-family: 'H5PFontAwesome4';
content: " \f054"; /* TODO: Use margin not whitespace, spacing is not content! */ content: "\f054"; /* TODO: Use margin not whitespace, spacing is not content! */
} }
.qs-footer a.prev.button:before { .qs-footer a.prev.button:before {
font-family: 'H5PFontAwesome4'; font-family: 'H5PFontAwesome4';
content: "\f053 "; content: "\f053";
} }
.questionset-results .qs-finishbutton { .questionset-results .qs-finishbutton {
@ -247,7 +247,7 @@
content: ""; content: "";
font-size: 5em; font-size: 5em;
position: absolute; position: absolute;
left: -15px; left: -14px;
top: 36px; top: 36px;
height: 0; height: 0;
width: 0; width: 0;

View File

@ -1,24 +1,5 @@
var H5P = H5P || {}; var H5P = H5P || {};
if (H5P.getPath === undefined) {
/**
* Find the path to the content files based on the id of the content
*
* Also identifies and returns absolute paths
*
* @param {String} path Absolute path to a file, or relative path to a file in the content folder
* @param {Number} contentId Identifier of the content requesting the path
* @returns {String} The path to use.
*/
H5P.getPath = function (path, contentId) {
if (path.substr(0, 7) === 'http://' || path.substr(0, 8) === 'https://') {
return path;
}
return H5PIntegration.getContentPath(contentId) + path;
};
}
/** /**
* Will render a Question with multiple choices for answers. * Will render a Question with multiple choices for answers.
* *
@ -127,13 +108,11 @@ H5P.QuestionSet = function (options, contentId) {
var question = params.questions[i]; var question = params.questions[i];
// TODO: Render on init, inject in template. // TODO: Render on init, inject in template.
var libraryObject = H5P.libraryFromString(question.library);
$.extend(question.params, { $.extend(question.params, {
displaySolutionsButton: false, displaySolutionsButton: false,
postUserStatistics: false postUserStatistics: false
}); });
var tmp = new (H5P.classFromName(libraryObject.machineName))(question.params, contentId); questionInstances.push(H5P.newRunnable(question, contentId));
questionInstances.push(tmp);
} }
// Update button state. // Update button state.
@ -172,8 +151,9 @@ H5P.QuestionSet = function (options, contentId) {
$('.question-container', $myDom).hide().eq(questionNumber).show(); $('.question-container', $myDom).hide().eq(questionNumber).show();
// Trigger resize on question in case the size of the QS has changed. // Trigger resize on question in case the size of the QS has changed.
if (questionInstances[questionNumber].resize !== undefined) { var instance = questionInstances[questionNumber];
questionInstances[questionNumber].resize(); if (instance.$ !== undefined) {
instance.$.trigger('resize');
} }
// Update progress indicator // Update progress indicator
@ -362,6 +342,8 @@ H5P.QuestionSet = function (options, contentId) {
if (renderSolutions) { if (renderSolutions) {
showSolutions(); showSolutions();
} }
this.$.trigger('resize');
return this; return this;
}; };

View File

@ -1,5 +1,29 @@
{ {
"semantics": [ "semantics": [
{
"label": "Introduksjon",
"fields": [
{
"label": "Vis introduksjon"
},
{
"label": "Tittel",
"description": "Tittel for intoduksjonssiden."
},
{
"label": "Introduksjonstekst",
"description": "Denne teksten vises før spørsmålssettet starter."
},
{
"label": "Tekst til \"Start\" knappen",
"default": "Start"
},
{
"label": "Bakgrunnsbilde",
"description": "Bakgrunnsbilde for introduksjonssiden"
}
]
},
{ {
"label": "Bakgrunnsbilde", "label": "Bakgrunnsbilde",
"description": "Bakgrunnsbilde for spørsmålssettet(ikke obligatorisk)." "description": "Bakgrunnsbilde for spørsmålssettet(ikke obligatorisk)."
@ -33,30 +57,6 @@
] ]
} }
}, },
{
"label": "Introduksjon",
"fields": [
{
"label": "Vis introduksjon"
},
{
"label": "Tittel",
"description": "Tittel for intoduksjonssiden."
},
{
"label": "Introduksjonstekst",
"description": "Denne teksten vises før spørsmålssettet starter."
},
{
"label": "Tekst til \"Start\" knappen",
"default": "Start"
},
{
"label": "Bakgrunnsbilde",
"description": "Bakgrunnsbilde for introduksjonssiden"
}
]
},
{ {
"label": "Ledetekster", "label": "Ledetekster",
"fields": [ "fields": [
@ -75,7 +75,7 @@
{ {
"label": "Fremdriftstekst", "label": "Fremdriftstekst",
"description": "Tekst brukt hvis tekstlig angivelse av fremdrift er valgt. Variabler: @current og @total", "description": "Tekst brukt hvis tekstlig angivelse av fremdrift er valgt. Variabler: @current og @total",
"default": "Deloppgåve @current av @total" "default": "Deloppgave @current av @total"
} }
] ]
}, },

View File

@ -1,5 +1,29 @@
{ {
"semantics": [ "semantics": [
{
"label": "Introduksjon",
"fields": [
{
"label": "Vis introduksjon"
},
{
"label": "Tittel",
"description": "Tittel for intoduksjonssiden."
},
{
"label": "Introduksjonstekst",
"description": "Denne teksten vises før spørsmålssettet starter."
},
{
"label": "Tekst til \"Start\" knappen",
"default": "Start"
},
{
"label": "Bakgrunnsbilde",
"description": "Bakgrunnsbilde for introduksjonssiden"
}
]
},
{ {
"label": "Bakgrunnsbilde", "label": "Bakgrunnsbilde",
"description": "Bakgrunnsbilde for spørsmålssettet(ikke obligatorisk)." "description": "Bakgrunnsbilde for spørsmålssettet(ikke obligatorisk)."
@ -33,30 +57,6 @@
] ]
} }
}, },
{
"label": "Introduksjon",
"fields": [
{
"label": "Vis introduksjon"
},
{
"label": "Tittel",
"description": "Tittel for intoduksjonssiden."
},
{
"label": "Introduksjonstekst",
"description": "Denne teksten vises før spørsmålssettet starter."
},
{
"label": "Tekst til \"Start\" knappen",
"default": "Start"
},
{
"label": "Bakgrunnsbilde",
"description": "Bakgrunnsbilde for introduksjonssiden"
}
]
},
{ {
"label": "Ledetekster", "label": "Ledetekster",
"fields": [ "fields": [

View File

@ -3,11 +3,15 @@
"contentType": "question", "contentType": "question",
"majorVersion": 1, "majorVersion": 1,
"minorVersion": 0, "minorVersion": 0,
"patchVersion": 52, "patchVersion": 55,
"runnable": 1, "runnable": 1,
"fullscreen": 0, "fullscreen": 0,
"machineName": "H5P.QuestionSet", "machineName": "H5P.QuestionSet",
"author": "Amendor AS", "author": "Amendor AS",
"coreApi": {
"majorVersion": 1,
"minorVersion": 1
},
"license": "cc-by-sa", "license": "cc-by-sa",
"preloadedJs": [ "preloadedJs": [
{ {
@ -20,11 +24,6 @@
} }
], ],
"preloadedDependencies": [ "preloadedDependencies": [
{
"machineName": "H5P.API",
"majorVersion": 1,
"minorVersion": 0
},
{ {
"machineName": "EmbeddedJS", "machineName": "EmbeddedJS",
"majorVersion": 1, "majorVersion": 1,

View File

@ -1,57 +1,4 @@
[ [
{
"name": "backgroundImage",
"type": "image",
"label": "Background image",
"optional": true,
"description": "An optional background image for the Question set."
},
{
"name": "progressType",
"type": "select",
"label": "Progress indicator",
"description": "Question set progress indicator style.",
"options": [
{
"value": "textual",
"label": "Textual"
},
{
"value": "dots",
"label": "Dots"
}
],
"default": "dots"
},
{
"name": "passPercentage",
"type": "number",
"label": "Pass percentage",
"description": "Percentage of Total score required for passing the quiz.",
"min": 0,
"max": 100,
"step": 1,
"default": 50
},
{
"name": "questions",
"label": "Questions",
"type": "list",
"widget": "verticalTabs",
"min": 1,
"entity": "question",
"field": {
"name": "question",
"type": "library",
"label": "Question type",
"description": "Library for this question.",
"options": [
"H5P.MultiChoice 1.0",
"H5P.DragQuestion 1.0",
"H5P.Blanks 1.0"
]
}
},
{ {
"name": "introPage", "name": "introPage",
"type": "group", "type": "group",
@ -107,6 +54,59 @@
} }
] ]
}, },
{
"name": "backgroundImage",
"type": "image",
"label": "Background image",
"optional": true,
"description": "An optional background image for the Question set."
},
{
"name": "progressType",
"type": "select",
"label": "Progress indicator",
"description": "Question set progress indicator style.",
"options": [
{
"value": "textual",
"label": "Textual"
},
{
"value": "dots",
"label": "Dots"
}
],
"default": "dots"
},
{
"name": "passPercentage",
"type": "number",
"label": "Pass percentage",
"description": "Percentage of Total score required for passing the quiz.",
"min": 0,
"max": 100,
"step": 1,
"default": 50
},
{
"name": "questions",
"label": "Questions",
"type": "list",
"widget": "verticalTabs",
"min": 1,
"entity": "question",
"field": {
"name": "question",
"type": "library",
"label": "Question type",
"description": "Library for this question.",
"options": [
"H5P.MultiChoice 1.0",
"H5P.DragQuestion 1.0",
"H5P.Blanks 1.0"
]
}
},
{ {
"name": "texts", "name": "texts",
"type": "group", "type": "group",