From 37a7d54fbf851cad4219fdab9c6d228bbf8bfc32 Mon Sep 17 00:00:00 2001 From: Frank Ronny Larsen Date: Tue, 8 Jan 2013 16:16:19 +0100 Subject: [PATCH] Multiple changes Don't use H* in templates. Stick to DIVs and SPANs. (so as not to get any styling) Translatable strings. (options.texts.*) --- js/questionset.js | 26 +++++++++++++++----------- schema.json | 1 + views/questionset.ejs | 15 ++++++--------- 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/js/questionset.js b/js/questionset.js index 93e7d0b..e354141 100644 --- a/js/questionset.js +++ b/js/questionset.js @@ -15,10 +15,10 @@ H5P.QuestionSet = function (options) { var texttemplate = '' + '
' + -'

<%= title %>

' + +'
<%= title %>
' + ' <% for (var i=0; i' + '
' + -'

<%= questions[i].machineName %>

' + +'
<%= questions[i].machineName %>
' + '
' + ' <% } %>' + ' ' + -' ' + -' ' + -' ' + +' ' + +' ' + +' ' + '
' + '' + ''; @@ -46,7 +43,13 @@ H5P.QuestionSet = function (options) { randomOrder: false, initialQuestion: 0, progressType: 'textual', - questions: [] + questions: [], + texts: { + prevButton: "Previous", + nextButton: "Next", + finishButton: "Finish", + textualProgress: "Question: @current of @total questions" + } }; var template = new EJS({text: texttemplate}); @@ -79,7 +82,8 @@ H5P.QuestionSet = function (options) { // Update progress indicator // Test if current has been answered. if (params.progressType == 'textual') { - $('.progress-current', myDom).text("" + (questionNumber+1)); + $('.progress-text', myDom).text(params.texts.textualProgress.replace("@current", questionNumber+1).replace("@total", params.questions.length)); + // $('.progress-current', myDom).text("" + (questionNumber+1)); } else { $('.progress-dot.current', myDom).removeClass('current'); // Set answered/unanswered for current. diff --git a/schema.json b/schema.json index 63026ba..d76e117 100644 --- a/schema.json +++ b/schema.json @@ -28,6 +28,7 @@ "name": "Questions", "description": "List of questions in this set.", "type": "h5p-library", + "validLibs": ["H5P.MultiChoice"], "array": true, "minEntries": 1, "maxEntries": -1 diff --git a/views/questionset.ejs b/views/questionset.ejs index a9c19b4..8a1dee1 100644 --- a/views/questionset.ejs +++ b/views/questionset.ejs @@ -1,8 +1,8 @@
-

<%= title %>

+
<%= title %>
<% for (var i=0; i
-

<%= questions[i].machineName %>

+
<%= questions[i].machineName %>
<% } %> - - - + + +