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
a7ac4d84
Commit
a7ac4d84
authored
Jul 04, 2012
by
ichuang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add hidden attribute to textline and textbox inputtypes, for javascript problems
parent
4bac87cf
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
4 deletions
+28
-4
common/lib/capa/inputtypes.py
+6
-2
common/lib/capa/templates/textbox.html
+8
-1
common/lib/capa/templates/textinput.html
+6
-0
common/lib/capa/templates/textinput_dynamath.html
+8
-1
No files found.
common/lib/capa/inputtypes.py
View file @
a7ac4d84
...
...
@@ -182,7 +182,8 @@ def textline(element, value, status, render_template, msg=""):
raise
Exception
(
msg
)
count
=
int
(
eid
.
split
(
'_'
)[
-
2
])
-
1
# HACK
size
=
element
.
get
(
'size'
)
context
=
{
'id'
:
eid
,
'value'
:
value
,
'state'
:
status
,
'count'
:
count
,
'size'
:
size
,
'msg'
:
msg
}
hidden
=
element
.
get
(
'hidden'
,
''
)
# if specified, then textline is hidden and id is stored in div of name given by hidden
context
=
{
'id'
:
eid
,
'value'
:
value
,
'state'
:
status
,
'count'
:
count
,
'size'
:
size
,
'msg'
:
msg
,
'hidden'
:
hidden
}
html
=
render_template
(
"textinput.html"
,
context
)
return
etree
.
XML
(
html
)
...
...
@@ -203,8 +204,9 @@ def textline_dynamath(element, value, status, render_template, msg=''):
eid
=
element
.
get
(
'id'
)
count
=
int
(
eid
.
split
(
'_'
)[
-
2
])
-
1
# HACK
size
=
element
.
get
(
'size'
)
hidden
=
element
.
get
(
'hidden'
,
''
)
# if specified, then textline is hidden and id is stored in div of name given by hidden
context
=
{
'id'
:
eid
,
'value'
:
value
,
'state'
:
status
,
'count'
:
count
,
'size'
:
size
,
'msg'
:
msg
,
'msg'
:
msg
,
'hidden'
:
hidden
,
}
html
=
render_template
(
"textinput_dynamath.html"
,
context
)
return
etree
.
XML
(
html
)
...
...
@@ -224,11 +226,13 @@ def textbox(element, value, status, render_template, msg=''):
rows
=
element
.
get
(
'rows'
)
or
'30'
cols
=
element
.
get
(
'cols'
)
or
'80'
mode
=
element
.
get
(
'mode'
)
or
'python'
# mode for CodeMirror, eg "python" or "xml"
hidden
=
element
.
get
(
'hidden'
,
''
)
# if specified, then textline is hidden and id is stored in div of name given by hidden
linenumbers
=
element
.
get
(
'linenumbers'
)
# for CodeMirror
if
not
value
:
value
=
element
.
text
# if no student input yet, then use the default input given by the problem
context
=
{
'id'
:
eid
,
'value'
:
value
,
'state'
:
status
,
'count'
:
count
,
'size'
:
size
,
'msg'
:
msg
,
'mode'
:
mode
,
'linenumbers'
:
linenumbers
,
'rows'
:
rows
,
'cols'
:
cols
,
'hidden'
:
hidden
,
}
html
=
render_template
(
"textbox.html"
,
context
)
try
:
...
...
common/lib/capa/templates/textbox.html
View file @
a7ac4d84
<section
id=
"textbox_${id}"
class=
"textbox"
>
<textarea
rows=
"${rows}"
cols=
"${cols}"
name=
"input_${id}"
id=
"input_${id}"
>
${value|h}
</textarea>
<textarea
rows=
"${rows}"
cols=
"${cols}"
name=
"input_${id}"
id=
"input_${id}"
%
if
hidden:
style=
"display:none;"
%
endif
>
${value|h}
</textarea>
<span
id=
"answer_${id}"
></span>
...
...
@@ -12,6 +16,9 @@
% elif state == 'incomplete':
<span
class=
"incorrect"
id=
"status_${id}"
></span>
% endif
% if hidden:
<div
style=
"display:none;"
name=
"${hidden}"
inputid=
"input_${id}"
/>
% endif
<br/>
<span
class=
"debug"
>
(${state})
</span>
<br/>
...
...
common/lib/capa/templates/textinput.html
View file @
a7ac4d84
...
...
@@ -8,11 +8,17 @@
% elif state == 'incomplete':
<div
class=
"incorrect"
id=
"status_${id}"
>
% endif
% if hidden:
<div
style=
"display:none;"
name=
"${hidden}"
inputid=
"input_${id}"
/>
% endif
<input
type=
"text"
name=
"input_${id}"
id=
"input_${id}"
value=
"${value}"
%
if
size:
size=
"${size}"
%
endif
%
if
hidden:
style=
"display:none;"
%
endif
/>
<p
class=
"status"
>
...
...
common/lib/capa/templates/textinput_dynamath.html
View file @
a7ac4d84
...
...
@@ -11,8 +11,15 @@
% elif state == 'incomplete':
<div
class=
"incorrect"
id=
"status_${id}"
>
% endif
% if hidden:
<div
style=
"display:none;"
name=
"${hidden}"
inputid=
"input_${id}"
/>
% 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:
style=
"display:none;"
%
endif
/>
<p
class=
"status"
>
% if state == 'unsubmitted':
...
...
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