Skip to content
This repository has been archived by the owner on May 11, 2021. It is now read-only.

Commit

Permalink
Multiple answer type now reads in manually written examples for each …
Browse files Browse the repository at this point in the history
…exercise from example-class elements in the solution area. Fixes #973.
  • Loading branch information
osnr committed Aug 26, 2011
1 parent 4181afd commit 33bbca5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion khan-exercise.js
Expand Up @@ -720,7 +720,7 @@ function makeProblem( id, seed ) {
// Add the problem into the page
jQuery( "#workarea" ).toggle( workAreaWasVisible ).fadeIn();
jQuery( "#answercontent input" ).removeAttr("disabled");
if ( validator.examples ) {
if ( validator.examples && validator.examples.length > 0 ) {
jQuery( "#examples-show" ).show();
jQuery( "#examples" ).empty();

Expand Down
4 changes: 4 additions & 0 deletions utils/answer-types.js
Expand Up @@ -484,6 +484,10 @@ jQuery.extend( Khan.answerTypes, {
return valid;
};

ret.examples = solutionarea.find( ".example" ).remove()
.map(function(i, el) {
return jQuery( el ).html();
});
ret.solution = solutionArray;

return ret;
Expand Down

0 comments on commit 33bbca5

Please sign in to comment.