|
| 1 | +README.txt |
| 2 | + |
| 3 | +The quizly directive, in this first pass looks like this: |
| 4 | +----------------------------------------------- |
| 5 | + |
| 6 | +.. quizly:: |
| 7 | + :quizname: unique-quiz-name from quizzes.js |
| 8 | + |
| 9 | +The quizly component uses and requires the following resources: |
| 10 | +---------------------------------------------- |
| 11 | + |
| 12 | +runestone/quizly/quizly.py -- creates QuizlyNode from directive |
| 13 | +runestone/quizly/__init__.py -- imports the quizly code |
| 14 | +runestone/quizly/toctree.rst |
| 15 | + |
| 16 | +runestone/quizly/js -- javascript resources |
| 17 | + -- all_appinv.js -- compressed files |
| 18 | + -- all_blockly.js |
| 19 | + -- all_quizly.js |
| 20 | + -- blockly.html -- blockly iframe |
| 21 | + -- index.html -- quizly UI and iframe container |
| 22 | + -- main.css -- gcb style defs |
| 23 | + -- media -- image and icon files |
| 24 | + -- quizly.js -- renders quizly exercise and handles interface with runestone |
| 25 | + -- quizme-helper.js -- main quizly code |
| 26 | + -- quizzes.js -- quizly quiz collection in JSON format |
| 27 | + |
| 28 | +runestone/quizly/test -- some test code |
| 29 | + -- _sources -- test files |
| 30 | + -- Quizly |
| 31 | + -- TestQuizly.rst -- contains 1 MC and 2 different quizly exercises |
| 32 | + -- toctree.rst |
| 33 | + -- conf.py -- sphinx config file for runestone |
| 34 | + -- pavement.py -- needed for runestone build |
| 35 | + |
| 36 | +The files that need to be coded by the developer |
| 37 | +----------------------------------------------- |
| 38 | + |
| 39 | +./runestone/quizly/quizly.py |
| 40 | +---------------------------- |
| 41 | +Th script that runs during runestone build. Runestone build parses the |
| 42 | +source document and translates the directive and its options into a QuizlyNode. |
| 43 | + |
| 44 | + - Copies resource files from quizly/js to the project/_static folder, from where |
| 45 | + they are copied to build/quizly/_static during build, where they are used by |
| 46 | + the _sources web pages. |
| 47 | + |
| 48 | + - QuizlyNode -- defines the node. The only option needed for this is the quizname, |
| 49 | + which is parsed from the directive. |
| 50 | + |
| 51 | + - visit_quizly_mode(self, node) -- appends the quizly template, instantiated, to the |
| 52 | + body of the html document that will represent the quizly exercise |
| 53 | + |
| 54 | + - Quizly(RunestoneDirective) -- its run() method instantiates and returns QuizlyNode, |
| 55 | + probably called by runestone build. |
| 56 | + |
| 57 | +./runestone/quizly/__init__.py -- called by runestone build, imports quizly.py |
| 58 | +------------------------------ |
| 59 | + |
| 60 | +./runestone/quizly/js/quizly.js |
| 61 | +------------------------------- |
| 62 | + |
| 63 | +This script runs when the html page containing the quizly iframe is loaded. It contains |
| 64 | +methods to render the quizly component and to handle the interface with runestone. |
| 65 | + |
| 66 | +This script will be invoked automatically when the page is loaded, provided a quizly entry |
| 67 | +is made in the module.exports list in webpack.config.js. |
| 68 | + |
| 69 | + "./runestone/quizly/js/quizly.js", |
| 70 | + |
| 71 | +quizly.js contains the following methods and functions: |
| 72 | + |
| 73 | + -- class Quizly extends RunestoneBase -- constructs a Quizly object that holds the |
| 74 | + data from the exercise. Calls renderQuiz() method. |
| 75 | + |
| 76 | + -- getIFrame() -- extracts the iframe from the fully instantiated html code produced |
| 77 | + by quizly.py and contained in QuizlyNode. |
| 78 | + |
| 79 | + -- renderQuizly() -- renders the quizly iframe inside a container <div>. |
| 80 | + |
| 81 | + -- submitQuizly() -- the method invoked from the callback function when the user |
| 82 | + clicks "Check Me" button in the quizly exercise. |
| 83 | + |
| 84 | +$(document).bind( ,,, function() {}) -- function that sets up the callback function |
| 85 | + and binds it to the html document. |
| 86 | + |
| 87 | +setupCallback(quizly) -- defines the callback function that is invoked when the "Check Me" |
| 88 | + button is clicked. It calls quizly.submitQuizly(result), where result is the |
| 89 | + quizly-graded response to the user's attempt. |
| 90 | + |
0 commit comments