Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
04f221e3
Commit
04f221e3
authored
Sep 10, 2012
by
kimth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Another step towards Javascriptinput-style script loading
parent
37acade6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
24 deletions
+36
-24
common/lib/capa/capa/templates/textinput_dynamath.html
+22
-19
common/lib/xmodule/xmodule/js/src/capa/display.coffee
+14
-5
No files found.
common/lib/capa/capa/templates/textinput_dynamath.html
View file @
04f221e3
...
@@ -2,6 +2,10 @@
...
@@ -2,6 +2,10 @@
### version of textline.html which does dynamic math
### version of textline.html which does dynamic math
###
###
<section
class=
"text-input-dynamath textinputdynamath capa_inputtype"
id=
"inputtype_${id}"
>
<section
class=
"text-input-dynamath textinputdynamath capa_inputtype"
id=
"inputtype_${id}"
>
<div
class=
"textinputdynamath_data"
data-preprocessor=
"MathjaxPreprocessorFor6002x"
/>
<div
class=
"script_placeholder"
data-src=
"/static/js/mathjax_preprocessor_for_6002x.js"
/>
% if state == 'unsubmitted':
% if state == 'unsubmitted':
<div
class=
"unanswered"
id=
"status_${id}"
>
<div
class=
"unanswered"
id=
"status_${id}"
>
% elif state == 'correct':
% elif state == 'correct':
...
@@ -15,27 +19,26 @@
...
@@ -15,27 +19,26 @@
<div
style=
"display:none;"
name=
"${hidden}"
inputid=
"input_${id}"
/>
<div
style=
"display:none;"
name=
"${hidden}"
inputid=
"input_${id}"
/>
% endif
% endif
<input
type=
"text"
name=
"input_${id}"
id=
"input_${id}"
value=
"${value}"
class=
"math"
size=
"${size if size else ''}"
<input
type=
"text"
name=
"input_${id}"
id=
"input_${id}"
value=
"${value}"
class=
"math"
size=
"${size if size else ''}"
%
if
hidden:
%
if
hidden:
style=
"display:none;"
style=
"display:none;"
%
endif
%
endif
/>
/>
<div
class=
"script_placeholder"
data-src=
"/static/js/mathjax_preprocessor_for_6002x.js"
/>
<p
class=
"status"
>
<p
class=
"status"
>
% if state == 'unsubmitted':
% if state == 'unsubmitted':
unanswered
unanswered
% elif state == 'correct':
% elif state == 'correct':
correct
correct
% elif state == 'incorrect':
% elif state == 'incorrect':
incorrect
incorrect
% elif state == 'incomplete':
% elif state == 'incomplete':
incomplete
incomplete
% endif
% endif
</p>
</p>
<p
id=
"answer_${id}"
class=
"answer"
></p>
<p
id=
"answer_${id}"
class=
"answer"
></p>
<div
id=
"display_${id}"
class=
"equation"
>
`{::}`
</div>
<div
id=
"display_${id}"
class=
"equation"
>
`{::}`
</div>
</div>
</div>
<textarea
style=
"display:none"
id=
"input_${id}_dynamath"
name=
"input_${id}_dynamath"
>
</textarea>
<textarea
style=
"display:none"
id=
"input_${id}_dynamath"
name=
"input_${id}_dynamath"
>
</textarea>
...
...
common/lib/xmodule/xmodule/js/src/capa/display.coffee
View file @
04f221e3
...
@@ -297,12 +297,17 @@ class @Problem
...
@@ -297,12 +297,17 @@ class @Problem
refreshMath
:
(
event
,
element
)
=>
refreshMath
:
(
event
,
element
)
=>
element
=
event
.
target
unless
element
element
=
event
.
target
unless
element
target
=
"display_
#{
element
.
id
.
replace
(
/^input_/
,
''
)
}
"
elid
=
element
.
id
.
replace
(
/^input_/
,
''
)
target
=
"display_"
+
elid
preprocessor_tag
=
"inputtype_"
+
elid
mathjax_preprocessor
=
@
inputtypeDisplays
[
preprocessor_tag
]
if
jax
=
MathJax
.
Hub
.
getAllJax
(
target
)[
0
]
if
jax
=
MathJax
.
Hub
.
getAllJax
(
target
)[
0
]
eqn
=
$
(
element
).
val
()
eqn
=
$
(
element
).
val
()
if
@
mathjax_preprocessor
if
mathjax_preprocessor
eqn
=
@
mathjax_preprocessor
(
eqn
)
eqn
=
mathjax_preprocessor
(
eqn
)
MathJax
.
Hub
.
Queue
[
'Text'
,
jax
,
eqn
],
MathJax
.
Hub
.
Queue
[
'Text'
,
jax
,
eqn
],
[
@
updateMathML
,
jax
,
element
]
[
@
updateMathML
,
jax
,
element
]
...
@@ -324,9 +329,13 @@ class @Problem
...
@@ -324,9 +329,13 @@ class @Problem
inputtypeSetupMethods
:
inputtypeSetupMethods
:
textinputdynamath
:
(
element
)
=>
textinputdynamath
:
(
element
)
=>
preprocessorClass
=
window
[
'MathjaxPreprocessorFor6002x'
]
data
=
$
(
element
).
find
(
'.textinputdynamath_data'
)
preprocessorClassName
=
data
.
data
(
'preprocessor'
)
preprocessorClass
=
window
[
preprocessorClassName
]
preprocessor
=
new
preprocessorClass
()
preprocessor
=
new
preprocessorClass
()
alert
preprocessor
.
fn
return
preprocessor
.
fn
javascriptinput
:
(
element
)
=>
javascriptinput
:
(
element
)
=>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment