Multiple changes
Don't use H* in templates. Stick to DIVs and SPANs. (so as not to get any styling) Translatable strings. (options.texts.*)d3summaryChart
parent
ae4040f27a
commit
37a7d54fbf
|
@ -15,10 +15,10 @@ H5P.QuestionSet = function (options) {
|
||||||
|
|
||||||
var texttemplate = '' +
|
var texttemplate = '' +
|
||||||
'<div class="questionset">' +
|
'<div class="questionset">' +
|
||||||
' <h2 class="title"><%= title %></h2>' +
|
' <div class="title"><%= title %></div>' +
|
||||||
' <% for (var i=0; i<questions.length; i++) { %>' +
|
' <% for (var i=0; i<questions.length; i++) { %>' +
|
||||||
' <div class="question" id="q-<%= i %>">' +
|
' <div class="question" id="q-<%= i %>">' +
|
||||||
' <h1><%= questions[i].machineName %></h1>' +
|
' <div><%= questions[i].machineName %></div>' +
|
||||||
' </div>' +
|
' </div>' +
|
||||||
' <% } %>' +
|
' <% } %>' +
|
||||||
' <div class="question-footer">' +
|
' <div class="question-footer">' +
|
||||||
|
@ -28,15 +28,12 @@ H5P.QuestionSet = function (options) {
|
||||||
' <span class="progress-dot unanswered" id="qdot-<%= i %>">o</span>' +
|
' <span class="progress-dot unanswered" id="qdot-<%= i %>">o</span>' +
|
||||||
' <%} %>' +
|
' <%} %>' +
|
||||||
' <% } else if (progressType == "textual") { %>' +
|
' <% } else if (progressType == "textual") { %>' +
|
||||||
' <span class="progress-current"></span>' +
|
' <span class="progress-text"></span>' +
|
||||||
' of' +
|
|
||||||
' <span class="progress-total"><%= questions.length %></span>' +
|
|
||||||
' questions' +
|
|
||||||
' <% } %>' +
|
' <% } %>' +
|
||||||
' </div>' +
|
' </div>' +
|
||||||
' <button class="prev button">Previous</button>' +
|
' <button class="prev button"><%= texts.prevButton %></button>' +
|
||||||
' <button class="next button">Next</button>' +
|
' <button class="next button"><%= texts.nextButton %></button>' +
|
||||||
' <button class="finish button">Finish</button>' +
|
' <button class="finish button"><%= texts.finishButton %></button>' +
|
||||||
' </div>' +
|
' </div>' +
|
||||||
'</div>' +
|
'</div>' +
|
||||||
'';
|
'';
|
||||||
|
@ -46,7 +43,13 @@ H5P.QuestionSet = function (options) {
|
||||||
randomOrder: false,
|
randomOrder: false,
|
||||||
initialQuestion: 0,
|
initialQuestion: 0,
|
||||||
progressType: 'textual',
|
progressType: 'textual',
|
||||||
questions: []
|
questions: [],
|
||||||
|
texts: {
|
||||||
|
prevButton: "Previous",
|
||||||
|
nextButton: "Next",
|
||||||
|
finishButton: "Finish",
|
||||||
|
textualProgress: "Question: @current of @total questions"
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var template = new EJS({text: texttemplate});
|
var template = new EJS({text: texttemplate});
|
||||||
|
@ -79,7 +82,8 @@ H5P.QuestionSet = function (options) {
|
||||||
// Update progress indicator
|
// Update progress indicator
|
||||||
// Test if current has been answered.
|
// Test if current has been answered.
|
||||||
if (params.progressType == 'textual') {
|
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 {
|
} else {
|
||||||
$('.progress-dot.current', myDom).removeClass('current');
|
$('.progress-dot.current', myDom).removeClass('current');
|
||||||
// Set answered/unanswered for current.
|
// Set answered/unanswered for current.
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
"name": "Questions",
|
"name": "Questions",
|
||||||
"description": "List of questions in this set.",
|
"description": "List of questions in this set.",
|
||||||
"type": "h5p-library",
|
"type": "h5p-library",
|
||||||
|
"validLibs": ["H5P.MultiChoice"],
|
||||||
"array": true,
|
"array": true,
|
||||||
"minEntries": 1,
|
"minEntries": 1,
|
||||||
"maxEntries": -1
|
"maxEntries": -1
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<div class="questionset">
|
<div class="questionset">
|
||||||
<h2 class="title"><%= title %></h2>
|
<div class="title"><%= title %></div>
|
||||||
<% for (var i=0; i<questions.length; i++) { %>
|
<% for (var i=0; i<questions.length; i++) { %>
|
||||||
<div class="question" id="q-<%= i %>">
|
<div class="question" id="q-<%= i %>">
|
||||||
<h1><%= questions[i].machineName %></h1>
|
<div><%= questions[i].machineName %></div>
|
||||||
</div>
|
</div>
|
||||||
<% } %>
|
<% } %>
|
||||||
<div class="question-footer">
|
<div class="question-footer">
|
||||||
|
@ -12,14 +12,11 @@
|
||||||
<span class="progress-dot unanswered" id="qdot-<%= i %>">o</span>
|
<span class="progress-dot unanswered" id="qdot-<%= i %>">o</span>
|
||||||
<%} %>
|
<%} %>
|
||||||
<% } else if (progressType == "textual") { %>
|
<% } else if (progressType == "textual") { %>
|
||||||
<span class="progress-current"></span>
|
<span class="progress-text"></span>
|
||||||
of
|
|
||||||
<span class="progress-total"><%= questions.length %></span>
|
|
||||||
questions
|
|
||||||
<% } %>
|
<% } %>
|
||||||
</div>
|
</div>
|
||||||
<button class="prev button">Previous</button>
|
<button class="prev button"><%= texts.prevButton %></button>
|
||||||
<button class="next button">Next</button>
|
<button class="next button"><%= texts.nextButton %></button>
|
||||||
<button class="finish button">Finish</button>
|
<button class="finish button"><%= texts.finishButton %></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue