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
516b720f
Commit
516b720f
authored
Oct 29, 2012
by
Victor Shnayder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename: use 'status' in templates as well as in the code.
parent
ab03f3dd
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
75 additions
and
80 deletions
+75
-80
common/lib/capa/capa/inputtypes.py
+9
-13
common/lib/capa/capa/templates/choicegroup.html
+4
-4
common/lib/capa/capa/templates/codeinput.html
+5
-5
common/lib/capa/capa/templates/crystallography.html
+9
-9
common/lib/capa/capa/templates/filesubmission.html
+5
-5
common/lib/capa/capa/templates/imageinput.html
+4
-4
common/lib/capa/capa/templates/jstextline.html
+4
-4
common/lib/capa/capa/templates/optioninput.html
+4
-4
common/lib/capa/capa/templates/schematicinput.html
+4
-4
common/lib/capa/capa/templates/textline.html
+9
-9
common/lib/capa/capa/templates/vsepr_input.html
+9
-9
common/lib/capa/capa/tests/test_inputtypes.py
+9
-10
No files found.
common/lib/capa/capa/inputtypes.py
View file @
516b720f
...
...
@@ -21,10 +21,6 @@ Each input type takes the xml tree as 'element', the previous answer as 'value',
graded status as'status'
"""
# TODO: rename "state" to "status" for all below. status is currently the answer for the
# problem ID for the input element, but it will turn into a dict containing both the
# answer and any associated message for the problem ID for the input element.
# TODO: there is a lot of repetitive "grab these elements from xml attributes, with these defaults,
# put them in the context" code. Refactor so class just specifies required and optional attrs (with
# defaults for latter), and InputTypeBase does the right thing.
...
...
@@ -177,7 +173,7 @@ class OptionInput(InputTypeBase):
context
=
{
'id'
:
self
.
id
,
'value'
:
self
.
value
,
'stat
e
'
:
self
.
status
,
'stat
us
'
:
self
.
status
,
'msg'
:
self
.
msg
,
'options'
:
self
.
osetdict
,
'inline'
:
self
.
xml
.
get
(
'inline'
,
''
),
...
...
@@ -236,7 +232,7 @@ class ChoiceGroup(InputTypeBase):
def
_get_render_context
(
self
):
context
=
{
'id'
:
self
.
id
,
'value'
:
self
.
value
,
'stat
e
'
:
self
.
status
,
'stat
us
'
:
self
.
status
,
'input_type'
:
self
.
element_type
,
'choices'
:
self
.
choices
,
'name_array_suffix'
:
self
.
suffix
}
...
...
@@ -362,7 +358,7 @@ class TextLine(InputTypeBase):
context
=
{
'id'
:
self
.
id
,
'value'
:
value
,
'stat
e
'
:
self
.
status
,
'stat
us
'
:
self
.
status
,
'size'
:
self
.
size
,
'msg'
:
self
.
msg
,
'hidden'
:
self
.
hidden
,
...
...
@@ -403,7 +399,7 @@ class FileSubmission(InputTypeBase):
def
_get_render_context
(
self
):
context
=
{
'id'
:
self
.
id
,
'stat
e
'
:
self
.
status
,
'stat
us
'
:
self
.
status
,
'msg'
:
self
.
msg
,
'value'
:
self
.
value
,
'queue_len'
:
self
.
queue_len
,
...
...
@@ -455,7 +451,7 @@ class CodeInput(InputTypeBase):
context
=
{
'id'
:
self
.
id
,
'value'
:
self
.
value
,
'stat
e
'
:
self
.
status
,
'stat
us
'
:
self
.
status
,
'msg'
:
self
.
msg
,
'mode'
:
self
.
mode
,
'linenumbers'
:
self
.
linenumbers
,
...
...
@@ -492,7 +488,7 @@ class Schematic(InputTypeBase):
context
=
{
'id'
:
self
.
id
,
'value'
:
self
.
value
,
'initial_value'
:
self
.
initial_value
,
'stat
e
'
:
self
.
status
,
'stat
us
'
:
self
.
status
,
'width'
:
self
.
width
,
'height'
:
self
.
height
,
'parts'
:
self
.
parts
,
...
...
@@ -542,7 +538,7 @@ class ImageInput(InputTypeBase):
'src'
:
self
.
src
,
'gx'
:
self
.
gx
,
'gy'
:
self
.
gy
,
'stat
e
'
:
self
.
status
,
# to change (VS: to what??)
'stat
us
'
:
self
.
status
,
# to change (VS: to what??)
'msg'
:
self
.
msg
,
# to change
}
return
context
...
...
@@ -577,7 +573,7 @@ class Crystallography(InputTypeBase):
def
_get_render_context
(
self
):
context
=
{
'id'
:
self
.
id
,
'value'
:
self
.
value
,
'stat
e
'
:
self
.
status
,
'stat
us
'
:
self
.
status
,
'size'
:
self
.
size
,
'msg'
:
self
.
msg
,
'hidden'
:
self
.
hidden
,
...
...
@@ -614,7 +610,7 @@ class VseprInput(InputTypeBase):
context
=
{
'id'
:
self
.
id
,
'value'
:
self
.
value
,
'stat
e
'
:
self
.
status
,
'stat
us
'
:
self
.
status
,
'msg'
:
self
.
msg
,
'width'
:
self
.
width
,
'height'
:
self
.
height
,
...
...
common/lib/capa/capa/templates/choicegroup.html
View file @
516b720f
<form
class=
"choicegroup capa_inputtype"
id=
"inputtype_${id}"
>
<div
class=
"indicator_container"
>
% if stat
e
== 'unsubmitted':
% if stat
us
== 'unsubmitted':
<span
class=
"unanswered"
style=
"display:inline-block;"
id=
"status_${id}"
></span>
% elif stat
e
== 'correct':
% elif stat
us
== 'correct':
<span
class=
"correct"
id=
"status_${id}"
></span>
% elif stat
e
== 'incorrect':
% elif stat
us
== 'incorrect':
<span
class=
"incorrect"
id=
"status_${id}"
></span>
% elif stat
e
== 'incomplete':
% elif stat
us
== 'incomplete':
<span
class=
"incorrect"
id=
"status_${id}"
></span>
% endif
</div>
...
...
common/lib/capa/capa/templates/codeinput.html
View file @
516b720f
...
...
@@ -6,13 +6,13 @@
>
${value|h}
</textarea>
<div
class=
"grader-status"
>
% if stat
e
== 'unsubmitted':
% if stat
us
== 'unsubmitted':
<span
class=
"unanswered"
style=
"display:inline-block;"
id=
"status_${id}"
>
Unanswered
</span>
% elif stat
e
== 'correct':
% elif stat
us
== 'correct':
<span
class=
"correct"
id=
"status_${id}"
>
Correct
</span>
% elif stat
e
== 'incorrect':
% elif stat
us
== 'incorrect':
<span
class=
"incorrect"
id=
"status_${id}"
>
Incorrect
</span>
% elif stat
e
== 'queued':
% elif stat
us
== 'queued':
<span
class=
"processing"
id=
"status_${id}"
>
Queued
</span>
<span
style=
"display:none;"
class=
"xqueue"
id=
"${id}"
>
${queue_len}
</span>
% endif
...
...
@@ -21,7 +21,7 @@
<div
style=
"display:none;"
name=
"${hidden}"
inputid=
"input_${id}"
/>
% endif
<p
class=
"debug"
>
${stat
e
}
</p>
<p
class=
"debug"
>
${stat
us
}
</p>
</div>
<span
id=
"answer_${id}"
></span>
...
...
common/lib/capa/capa/templates/crystallography.html
View file @
516b720f
...
...
@@ -6,13 +6,13 @@
<div
class=
"script_placeholder"
data-src=
"/static/js/crystallography.js"
></div>
% if stat
e
== 'unsubmitted':
% if stat
us
== 'unsubmitted':
<div
class=
"unanswered"
id=
"status_${id}"
>
% elif stat
e
== 'correct':
% elif stat
us
== 'correct':
<div
class=
"correct"
id=
"status_${id}"
>
% elif stat
e
== 'incorrect':
% elif stat
us
== 'incorrect':
<div
class=
"incorrect"
id=
"status_${id}"
>
% elif stat
e
== 'incomplete':
% elif stat
us
== 'incomplete':
<div
class=
"incorrect"
id=
"status_${id}"
>
% endif
% if hidden:
...
...
@@ -29,13 +29,13 @@
/>
<p
class=
"status"
>
% if stat
e
== 'unsubmitted':
% if stat
us
== 'unsubmitted':
unanswered
% elif stat
e
== 'correct':
% elif stat
us
== 'correct':
correct
% elif stat
e
== 'incorrect':
% elif stat
us
== 'incorrect':
incorrect
% elif stat
e
== 'incomplete':
% elif stat
us
== 'incomplete':
incomplete
% endif
</p>
...
...
@@ -45,7 +45,7 @@
% if msg:
<span
class=
"message"
>
${msg|n}
</span>
% endif
% if stat
e
in ['unsubmitted', 'correct', 'incorrect', 'incomplete']:
% if stat
us
in ['unsubmitted', 'correct', 'incorrect', 'incomplete']:
</div>
% endif
</section>
common/lib/capa/capa/templates/filesubmission.html
View file @
516b720f
<section
id=
"filesubmission_${id}"
class=
"filesubmission"
>
<div
class=
"grader-status file"
>
% if stat
e
== 'unsubmitted':
% if stat
us
== 'unsubmitted':
<span
class=
"unanswered"
style=
"display:inline-block;"
id=
"status_${id}"
>
Unanswered
</span>
% elif stat
e
== 'correct':
% elif stat
us
== 'correct':
<span
class=
"correct"
id=
"status_${id}"
>
Correct
</span>
% elif stat
e
== 'incorrect':
% elif stat
us
== 'incorrect':
<span
class=
"incorrect"
id=
"status_${id}"
>
Incorrect
</span>
% elif stat
e
== 'queued':
% elif stat
us
== 'queued':
<span
class=
"processing"
id=
"status_${id}"
>
Queued
</span>
<span
style=
"display:none;"
class=
"xqueue"
id=
"${id}"
>
${queue_len}
</span>
% endif
<p
class=
"debug"
>
${stat
e
}
</p>
<p
class=
"debug"
>
${stat
us
}
</p>
<input
type=
"file"
name=
"input_${id}"
id=
"input_${id}"
value=
"${value}"
multiple=
"multiple"
data-required_files=
"${required_files}"
data-allowed_files=
"${allowed_files}"
/>
</div>
...
...
common/lib/capa/capa/templates/imageinput.html
View file @
516b720f
...
...
@@ -4,13 +4,13 @@
<img
src=
"/static/green-pointer.png"
id=
"cross_${id}"
style=
"position: absolute;top: ${gy}px;left: ${gx}px;"
/>
</div>
% if stat
e
== 'unsubmitted':
% if stat
us
== 'unsubmitted':
<span
class=
"unanswered"
style=
"display:inline-block;"
id=
"status_${id}"
></span>
% elif stat
e
== 'correct':
% elif stat
us
== 'correct':
<span
class=
"correct"
id=
"status_${id}"
></span>
% elif stat
e
== 'incorrect':
% elif stat
us
== 'incorrect':
<span
class=
"incorrect"
id=
"status_${id}"
></span>
% elif stat
e
== 'incomplete':
% elif stat
us
== 'incomplete':
<span
class=
"incorrect"
id=
"status_${id}"
></span>
% endif
</span>
common/lib/capa/capa/templates/jstextline.html
View file @
516b720f
...
...
@@ -18,13 +18,13 @@
<textarea
style=
"display:none"
id=
"input_${id}_fromjs"
name=
"input_${id}_fromjs"
></textarea>
% endif
% if stat
e
== 'unsubmitted':
% if stat
us
== 'unsubmitted':
<span
class=
"unanswered"
style=
"display:inline-block;"
id=
"status_${id}"
></span>
% elif stat
e
== 'correct':
% elif stat
us
== 'correct':
<span
class=
"correct"
id=
"status_${id}"
></span>
% elif stat
e
== 'incorrect':
% elif stat
us
== 'incorrect':
<span
class=
"incorrect"
id=
"status_${id}"
></span>
% elif stat
e
== 'incomplete':
% elif stat
us
== 'incomplete':
<span
class=
"incorrect"
id=
"status_${id}"
></span>
% endif
% if msg:
...
...
common/lib/capa/capa/templates/optioninput.html
View file @
516b720f
...
...
@@ -12,13 +12,13 @@
<span
id=
"answer_${id}"
></span>
% if stat
e
== 'unsubmitted':
% if stat
us
== 'unsubmitted':
<span
class=
"unanswered"
style=
"display:inline-block;"
id=
"status_${id}"
></span>
% elif stat
e
== 'correct':
% elif stat
us
== 'correct':
<span
class=
"correct"
id=
"status_${id}"
></span>
% elif stat
e
== 'incorrect':
% elif stat
us
== 'incorrect':
<span
class=
"incorrect"
id=
"status_${id}"
></span>
% elif stat
e
== 'incomplete':
% elif stat
us
== 'incomplete':
<span
class=
"incorrect"
id=
"status_${id}"
></span>
% endif
</form>
common/lib/capa/capa/templates/schematicinput.html
View file @
516b720f
...
...
@@ -12,13 +12,13 @@
</script>
<span
id=
"answer_${id}"
></span>
% if stat
e
== 'unsubmitted':
% if stat
us
== 'unsubmitted':
<span
class=
"ui-icon ui-icon-bullet"
style=
"display:inline-block;"
id=
"status_${id}"
></span>
% elif stat
e
== 'correct':
% elif stat
us
== 'correct':
<span
class=
"ui-icon ui-icon-check"
style=
"display:inline-block;"
id=
"status_${id}"
></span>
% elif stat
e
== 'incorrect':
% elif stat
us
== 'incorrect':
<span
class=
"ui-icon ui-icon-close"
style=
"display:inline-block;"
id=
"status_${id}"
></span>
% elif stat
e
== 'incomplete':
% elif stat
us
== 'incomplete':
<span
class=
"ui-icon ui-icon-close"
style=
"display:inline-block;"
id=
"status_${id}"
></span>
% endif
</span>
...
...
common/lib/capa/capa/templates/textline.html
View file @
516b720f
...
...
@@ -7,13 +7,13 @@
<div
class=
"script_placeholder"
data-src=
"${preprocessor['script_src']}"
/>
% endif
% if stat
e
== 'unsubmitted':
% if stat
us
== 'unsubmitted':
<div
class=
"unanswered ${doinline}"
id=
"status_${id}"
>
% elif stat
e
== 'correct':
% elif stat
us
== 'correct':
<div
class=
"correct ${doinline}"
id=
"status_${id}"
>
% elif stat
e
== 'incorrect':
% elif stat
us
== 'incorrect':
<div
class=
"incorrect ${doinline}"
id=
"status_${id}"
>
% elif stat
e
== 'incomplete':
% elif stat
us
== 'incomplete':
<div
class=
"incorrect ${doinline}"
id=
"status_${id}"
>
% endif
% if hidden:
...
...
@@ -33,13 +33,13 @@
/>
<p
class=
"status"
>
% if stat
e
== 'unsubmitted':
% if stat
us
== 'unsubmitted':
unanswered
% elif stat
e
== 'correct':
% elif stat
us
== 'correct':
correct
% elif stat
e
== 'incorrect':
% elif stat
us
== 'incorrect':
incorrect
% elif stat
e
== 'incomplete':
% elif stat
us
== 'incomplete':
incomplete
% endif
</p>
...
...
@@ -53,7 +53,7 @@
% endif
% if stat
e
in ['unsubmitted', 'correct', 'incorrect', 'incomplete']:
% if stat
us
in ['unsubmitted', 'correct', 'incorrect', 'incomplete']:
</div>
% endif
...
...
common/lib/capa/capa/templates/vsepr_input.html
View file @
516b720f
...
...
@@ -11,13 +11,13 @@
<div
class=
"script_placeholder"
data-src=
"/static/js/vsepr/vsepr.js"
></div>
% if stat
e
== 'unsubmitted':
% if stat
us
== 'unsubmitted':
<div
class=
"unanswered"
id=
"status_${id}"
>
% elif stat
e
== 'correct':
% elif stat
us
== 'correct':
<div
class=
"correct"
id=
"status_${id}"
>
% elif stat
e
== 'incorrect':
% elif stat
us
== 'incorrect':
<div
class=
"incorrect"
id=
"status_${id}"
>
% elif stat
e
== 'incomplete':
% elif stat
us
== 'incomplete':
<div
class=
"incorrect"
id=
"status_${id}"
>
% endif
...
...
@@ -26,13 +26,13 @@
/>
<p
class=
"status"
>
% if stat
e
== 'unsubmitted':
% if stat
us
== 'unsubmitted':
unanswered
% elif stat
e
== 'correct':
% elif stat
us
== 'correct':
correct
% elif stat
e
== 'incorrect':
% elif stat
us
== 'incorrect':
incorrect
% elif stat
e
== 'incomplete':
% elif stat
us
== 'incomplete':
incomplete
% endif
</p>
...
...
@@ -42,7 +42,7 @@
% if msg:
<span
class=
"message"
>
${msg|n}
</span>
% endif
% if stat
e
in ['unsubmitted', 'correct', 'incorrect', 'incomplete']:
% if stat
us
in ['unsubmitted', 'correct', 'incorrect', 'incomplete']:
</div>
% endif
</section>
common/lib/capa/capa/tests/test_inputtypes.py
View file @
516b720f
...
...
@@ -39,7 +39,7 @@ class OptionInputTest(unittest.TestCase):
expected
=
{
'value'
:
'Down'
,
'options'
:
[(
'Up'
,
'Up'
),
(
'Down'
,
'Down'
)],
'stat
e
'
:
'answered'
,
'stat
us
'
:
'answered'
,
'msg'
:
''
,
'inline'
:
''
,
'id'
:
'sky_input'
}
...
...
@@ -72,7 +72,7 @@ class ChoiceGroupTest(unittest.TestCase):
expected
=
{
'id'
:
'sky_input'
,
'value'
:
'foil3'
,
'stat
e
'
:
'answered'
,
'stat
us
'
:
'answered'
,
'input_type'
:
expected_input_type
,
'choices'
:
[(
'foil1'
,
'<text>This is foil One.</text>'
),
(
'foil2'
,
'<text>This is foil Two.</text>'
),
...
...
@@ -147,7 +147,7 @@ class TextLineTest(unittest.TestCase):
expected
=
{
'id'
:
'prob_1_2'
,
'value'
:
'BumbleBee'
,
'stat
e
'
:
'unanswered'
,
'stat
us
'
:
'unanswered'
,
'size'
:
size
,
'msg'
:
''
,
'hidden'
:
False
,
...
...
@@ -175,7 +175,7 @@ class TextLineTest(unittest.TestCase):
expected
=
{
'id'
:
'prob_1_2'
,
'value'
:
'BumbleBee'
,
'stat
e
'
:
'unanswered'
,
'stat
us
'
:
'unanswered'
,
'size'
:
size
,
'msg'
:
''
,
'hidden'
:
False
,
...
...
@@ -215,7 +215,7 @@ class FileSubmissionTest(unittest.TestCase):
context
=
the_input
.
_get_render_context
()
expected
=
{
'id'
:
'prob_1_2'
,
'stat
e
'
:
'queued'
,
'stat
us
'
:
'queued'
,
'msg'
:
'Submitted to grader.'
,
'value'
:
'BumbleBee.py'
,
'queue_len'
:
'3'
,
...
...
@@ -260,7 +260,7 @@ class CodeInputTest(unittest.TestCase):
expected
=
{
'id'
:
'prob_1_2'
,
'value'
:
'print "good evening"'
,
'stat
e
'
:
'queued'
,
'stat
us
'
:
'queued'
,
'msg'
:
'Submitted to grader.'
,
'mode'
:
mode
,
'linenumbers'
:
linenumbers
,
...
...
@@ -311,7 +311,7 @@ class SchematicTest(unittest.TestCase):
expected
=
{
'id'
:
'prob_1_2'
,
'value'
:
value
,
'initial_value'
:
initial_value
,
'stat
e
'
:
'unsubmitted'
,
'stat
us
'
:
'unsubmitted'
,
'width'
:
width
,
'height'
:
height
,
'parts'
:
parts
,
...
...
@@ -349,13 +349,12 @@ class ImageInputTest(unittest.TestCase):
expected
=
{
'id'
:
'prob_1_2'
,
'value'
:
value
,
'stat
e
'
:
'unsubmitted'
,
'stat
us
'
:
'unsubmitted'
,
'width'
:
width
,
'height'
:
height
,
'src'
:
src
,
'gx'
:
egx
,
'gy'
:
egy
,
'state'
:
'unsubmitted'
,
'msg'
:
''
}
self
.
assertEqual
(
context
,
expected
)
...
...
@@ -404,7 +403,7 @@ class CrystallographyTest(unittest.TestCase):
expected
=
{
'id'
:
'prob_1_2'
,
'value'
:
value
,
'stat
e
'
:
'unsubmitted'
,
'stat
us
'
:
'unsubmitted'
,
'size'
:
size
,
'msg'
:
''
,
'hidden'
:
''
,
...
...
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