|
| 1 | +README.txt |
| 2 | + |
| 3 | +The content files for the khanex component must be stored in the |
| 4 | + course's _static folder. Download the following file and unzip it in _static: |
| 5 | + https://github.com/ram8647/khanex/blob/16398fd496fad5b93fdf4d72c274064db8d1d1ac/khanex-runestone.zip |
| 6 | + |
| 7 | +The khanex directive, in this first pass looks like this: |
| 8 | +----------------------------------------------- |
| 9 | + |
| 10 | +.. khanex:: |
| 11 | + :exercise: unique-exercise-name /qs folder |
| 12 | + |
| 13 | +The quizly component uses and requires the following resources: |
| 14 | +---------------------------------------------- |
| 15 | + |
| 16 | +runestone/khanex/khanex.py -- creates KhanexNode from directive |
| 17 | +runestone/khanex/__init__.py -- imports the khanex code |
| 18 | + |
| 19 | +runestone/khanex/js -- javascript resources |
| 20 | + |
| 21 | + |
| 22 | +runestone/khanex/test -- some test code |
| 23 | + -- _sources -- test files |
| 24 | + -- conf.py -- sphinx config file for runestone |
| 25 | + -- pavement.py -- needed for runestone build |
| 26 | + |
| 27 | +The files that need to be coded by the developer |
| 28 | +----------------------------------------------- |
| 29 | + |
| 30 | +./runestone/khanex/khanex.py |
| 31 | +---------------------------- |
| 32 | +Th script that runs during runestone build. Runestone build parses the |
| 33 | +source document and translates the directive and its options into a QuizlyNode. |
| 34 | + |
| 35 | + - QuizlyNode -- defines the node. The only option needed for this is the quizname, |
| 36 | + which is parsed from the directive. |
| 37 | + |
| 38 | + - visit_quizly_mode(self, node) -- appends the quizly template, instantiated, to the |
| 39 | + body of the html document that will represent the quizly exercise |
| 40 | + |
| 41 | + - Quizly(RunestoneDirective) -- its run() method instantiates and returns QuizlyNode, |
| 42 | + probably called by runestone build. |
| 43 | + |
| 44 | +./runestone/khanex/__init__.py -- called by runestone build, imports khanex.py |
| 45 | +------------------------------ |
| 46 | + |
| 47 | +./runestone/khanex/js/khanex.js |
| 48 | +------------------------------- |
| 49 | + |
| 50 | +This script runs when the html page containing the khanex iframe is loaded. It contains |
| 51 | +methods to render the khanex component and to handle the interface with runestone. |
| 52 | + |
| 53 | +This script will be invoked automatically when the page is loaded, provided a khanex entry |
| 54 | +is made in the module.exports list in webpack.config.js. |
| 55 | + |
| 56 | + "./runestone/khanex/js/khanex.js", |
| 57 | + |
| 58 | +khanex.js contains the following methods and functions: |
| 59 | + |
| 60 | + -- class Khanex extends RunestoneBase -- constructs a Khanex object that holds the |
| 61 | + data from the exercise. Calls renderQuiz() method. |
| 62 | + |
| 63 | + -- getIFrame() -- extracts the iframe from the fully instantiated html code produced |
| 64 | + by khanex.py and contained in KhanexNode. |
| 65 | + |
| 66 | + -- renderKhanex() -- renders the khanex iframe inside a container <div>. |
| 67 | + |
| 68 | + -- submitKhanex() -- the method invoked from the callback function when the user |
| 69 | + clicks "Check Me" button in the khanex exercise. |
| 70 | + |
| 71 | +$(document).bind( ,,, function() {}) -- function that sets up the callback function |
| 72 | + and binds it to the html document. |
| 73 | + |
| 74 | +setupCallback(khanex) -- defines the callback function that is invoked when the "Check Me" |
| 75 | + button is clicked. It calls khanex.submitKhanex(result), where result is the |
| 76 | + khanex-graded response to the user's attempt. |
| 77 | + |
0 commit comments