Commit 81702c53 by Xavier Antoviaque

Merge pull request #18 from aboudreault/fa4-compatibility

Added font awesome 4 compatibility
parents 5da686d1 38439b7e
......@@ -14,12 +14,14 @@ function AnswerBlock(runtime, element) {
var checkmark = $('.answer-checkmark', element);
$(element).find('.message').text((result || {}).error || '');
checkmark.removeClass('checkmark-incorrect icon-exclamation checkmark-correct icon-ok');
checkmark.removeClass(
'checkmark-incorrect icon-exclamation fa-exclamation checkmark-correct icon-ok fa-check'
);
if (result.completed) {
checkmark.addClass('checkmark-correct icon-ok');
checkmark.addClass('checkmark-correct icon-ok fa-check');
}
else {
checkmark.addClass('checkmark-incorrect icon-exclamation');
checkmark.addClass('checkmark-incorrect icon-exclamation fa-exclamation');
}
},
......
......@@ -49,12 +49,14 @@ function MCQBlock(runtime, element) {
choiceTipsDOM = $('.choice-tips', choiceDOM),
choiceTipsCloseDOM;
choiceResultDOM.removeClass('checkmark-incorrect icon-exclamation checkmark-correct icon-ok');
choiceResultDOM.removeClass(
'checkmark-incorrect icon-exclamation fa-exclamation checkmark-correct icon-ok fa-check'
);
if (result.completed && choiceInputDOM.val() === result.submission) {
choiceResultDOM.addClass('checkmark-correct icon-ok');
choiceResultDOM.addClass('checkmark-correct icon-ok fa-check');
}
else if (choiceInputDOM.val() === result.submission || _.isNull(result.submission)) {
choiceResultDOM.addClass('checkmark-incorrect icon-exclamation');
choiceResultDOM.addClass('checkmark-incorrect icon-exclamation fa-exclamation');
}
var tips = _.find(result.tips, function(obj) {
......@@ -102,7 +104,9 @@ function MRQBlock(runtime, element) {
// hide answers
var choiceInputDOM = $('.choice input', element),
choiceResultDOM = $('.choice-answer', choiceInputDOM.closest('.choice'));
choiceResultDOM.removeClass('checkmark-incorrect icon-exclamation checkmark-correct icon-ok');
choiceResultDOM.removeClass(
'checkmark-incorrect icon-exclamation fa-exclamation checkmark-correct icon-ok fa-check'
);
var checkedCheckboxes = $('input[type=checkbox]:checked', element),
checkedValues = [];
......@@ -136,13 +140,15 @@ function MRQBlock(runtime, element) {
answer: choice.completed ? choiceInputDOM.attr('checked') : !choiceInputDOM.attr('checked')
});
choiceResultDOM.removeClass('checkmark-incorrect icon-exclamation checkmark-correct icon-ok');
choiceResultDOM.removeClass(
'checkmark-incorrect icon-exclamation fa-exclamation checkmark-correct icon-ok fa-check'
);
/* show hint if checked or max_attempts is disabled */
if (result.completed || choiceInputDOM.prop('checked') || options.max_attempts <= 0) {
if (choice.completed) {
choiceResultDOM.addClass('checkmark-correct icon-ok');
choiceResultDOM.addClass('checkmark-correct icon-ok fa-check');
} else if (!choice.completed) {
choiceResultDOM.addClass('checkmark-incorrect icon-exclamation');
choiceResultDOM.addClass('checkmark-incorrect icon-exclamation fa-exclamation');
}
}
......@@ -181,10 +187,10 @@ function MRQBlock(runtime, element) {
_.each(this.answers, function(answer) {
var choiceResultDOM = $('.choice-answer', answer.input.closest('.choice'));
choiceResultDOM.removeClass('checkmark-correct icon-ok');
choiceResultDOM.removeClass('checkmark-correct icon-ok fa-check');
if (answers_displayed) {
if (answer.answer)
choiceResultDOM.addClass('checkmark-correct icon-ok');
choiceResultDOM.addClass('checkmark-correct icon-ok fa-check');
showAnswerButton.text('Hide Answer(s)');
}
else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment