Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.

Commit 1a49e2d

Browse files
committed
Merge branch 'ram8647-master'
2 parents 7eca4ae + befc704 commit 1a49e2d

26 files changed

Lines changed: 5884 additions & 3242 deletions

package-lock.json

Lines changed: 1170 additions & 3240 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"main": "dist/runestone.js",
66
"scripts": {
77
"test": "echo \"Error: no test specified\" && exit 1",
8+
"check-env": "node -e 'console.log(process.env)' | grep npm",
89
"build": "webpack --mode=development",
910
"buildj": "webpack --mode=development --profile --json > stats.json",
1011
"watch": "webpack --mode=development --watch",
@@ -39,4 +40,4 @@
3940
"sql.js": "1.5.0",
4041
"vega-embed": "3.14.0"
4142
}
42-
}
43+
}

runestone/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
from .animation import Animation
88
from .mchoice import MChoice, QuestionNumber
99
from .blockly import Blockly
10+
from .quizly import Quizly
11+
from .khanex import Khanex
1012
from .codelens import Codelens
1113
from .clickableArea import ClickableArea
1214
from .datafile import DataFile
@@ -217,6 +219,7 @@ def build(options):
217219
"dragndrop": DragNDrop,
218220
"parsonsprob": ParsonsProblem,
219221
"poll": Poll,
222+
"quizly": Quizly,
220223
"reveal": RevealDirective,
221224
"selectquestion": SelectQuestion,
222225
"shortanswer": JournalDirective,

runestone/khanex/README.txt

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
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+

runestone/khanex/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from .khanex import *

runestone/khanex/js/.htaccess

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Header set Access-Control-Allow-Origin "*"

0 commit comments

Comments
 (0)