summaryrefslogtreecommitdiffstats
path: root/theme/javascript/core/quiz.js
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2014-04-14 15:37:13 +0200
committerSamy Pessé <samypesse@gmail.com>2014-04-14 15:37:13 +0200
commitc3ba975d6c25c599f197698234f94c8e99e40ff1 (patch)
treeb504e57bfa9a48a24f4f6ef5e6adf684fe69ac4b /theme/javascript/core/quiz.js
parent8c02e949fcbeb7b0200a4ffc67a809b66c39038e (diff)
downloadgitbook-c3ba975d6c25c599f197698234f94c8e99e40ff1.zip
gitbook-c3ba975d6c25c599f197698234f94c8e99e40ff1.tar.gz
gitbook-c3ba975d6c25c599f197698234f94c8e99e40ff1.tar.bz2
Improve quiz sections design
Diffstat (limited to 'theme/javascript/core/quiz.js')
-rw-r--r--theme/javascript/core/quiz.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/theme/javascript/core/quiz.js b/theme/javascript/core/quiz.js
index 909b168..bc1a16d 100644
--- a/theme/javascript/core/quiz.js
+++ b/theme/javascript/core/quiz.js
@@ -14,13 +14,13 @@ define([
// Submit: test code
$quiz.find(".action-submit").click(function(e) {
e.preventDefault();
- analytic.track("exercise.submit");
+ analytic.track("exercise.submit", {type: "quiz"});
$quiz.find("tr.alert-danger,li.alert-danger").removeClass("alert-danger");
$quiz.find(".alert-success,.alert-danger").addClass("hidden");
- $quiz.find(".quiz").each(function(q) {
+ $quiz.find(".question").each(function(q) {
var result = true;
- var $answers = $quiz.find(".quiz-answers").slice(q).find("input[type=radio], input[type=checkbox]");
+ var $answers = $quiz.find(".question-answers").slice(q).find("input[type=radio], input[type=checkbox]");
$(this).find("input[type=radio],input[type=checkbox]").each(function(i) {
var correct = $(this).is(":checked") === $answers.slice(i).first().is(":checked");
result = result && correct;
@@ -34,7 +34,8 @@ define([
});
$quiz.find(".action-solution").click(function(e) {
- $quiz.find(".quiz, .quiz-answers").toggleClass("hidden");
+ e.preventDefault();
+ $quiz.find(".question-content, .question-answers").toggleClass("hidden");
});
};