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
0aba5874
Commit
0aba5874
authored
May 29, 2015
by
Adam Palay
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Fieldset and legend solution is lost when edit Problem"
This reverts commit
16a248b9
.
parent
509f27f0
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
33 additions
and
91 deletions
+33
-91
common/lib/capa/capa/capa_problem.py
+0
-21
common/lib/capa/capa/inputtypes.py
+0
-2
common/lib/capa/capa/templates/choicegroup.html
+2
-2
common/lib/capa/capa/tests/test_html_render.py
+0
-1
common/lib/capa/capa/tests/test_input_templates.py
+17
-19
common/lib/capa/capa/tests/test_inputtypes.py
+1
-30
common/lib/xmodule/xmodule/js/spec/problem/edit_spec.coffee
+8
-9
common/lib/xmodule/xmodule/js/src/problem/edit.coffee
+1
-3
common/lib/xmodule/xmodule/templates/problem/checkboxes_response.yaml
+2
-1
common/lib/xmodule/xmodule/templates/problem/multiplechoice.yaml
+2
-1
common/lib/xmodule/xmodule/templates/problem/numericalresponse.yaml
+0
-1
common/lib/xmodule/xmodule/templates/problem/optionresponse.yaml
+0
-1
common/lib/xmodule/xmodule/templates/problem/string_response.yaml
+0
-0
No files found.
common/lib/capa/capa/capa_problem.py
View file @
0aba5874
...
@@ -139,7 +139,6 @@ class LoncapaProblem(object):
...
@@ -139,7 +139,6 @@ class LoncapaProblem(object):
self
.
do_reset
()
self
.
do_reset
()
self
.
problem_id
=
id
self
.
problem_id
=
id
self
.
capa_system
=
capa_system
self
.
capa_system
=
capa_system
self
.
question_label
=
""
state
=
state
or
{}
state
=
state
or
{}
...
@@ -733,7 +732,6 @@ class LoncapaProblem(object):
...
@@ -733,7 +732,6 @@ class LoncapaProblem(object):
'status'
:
status
,
'status'
:
status
,
'id'
:
input_id
,
'id'
:
input_id
,
'input_state'
:
self
.
input_state
[
input_id
],
'input_state'
:
self
.
input_state
[
input_id
],
'question_label'
:
self
.
question_label
if
self
.
question_label
else
None
,
'answervariable'
:
answervariable
,
'answervariable'
:
answervariable
,
'feedback'
:
{
'feedback'
:
{
'message'
:
msg
,
'message'
:
msg
,
...
@@ -764,11 +762,7 @@ class LoncapaProblem(object):
...
@@ -764,11 +762,7 @@ class LoncapaProblem(object):
tree
=
etree
.
Element
(
problemtree
.
tag
)
tree
=
etree
.
Element
(
problemtree
.
tag
)
for
item
in
problemtree
:
for
item
in
problemtree
:
item_xhtml
=
self
.
_extract_html
(
item
)
item_xhtml
=
self
.
_extract_html
(
item
)
item_sibling
=
self
.
sibling_for_item
(
problemtree
,
item
)
if
item_xhtml
is
not
None
:
if
item_xhtml
is
not
None
:
if
item_xhtml
.
tag
==
"legend"
and
item_sibling
is
not
None
and
item_sibling
in
self
.
responders
:
self
.
question_label
=
item_xhtml
.
text
else
:
tree
.
append
(
item_xhtml
)
tree
.
append
(
item_xhtml
)
if
tree
.
tag
in
html_transforms
:
if
tree
.
tag
in
html_transforms
:
...
@@ -840,18 +834,3 @@ class LoncapaProblem(object):
...
@@ -840,18 +834,3 @@ class LoncapaProblem(object):
for
solution
in
tree
.
findall
(
'.//solution'
):
for
solution
in
tree
.
findall
(
'.//solution'
):
solution
.
attrib
[
'id'
]
=
"
%
s_solution_
%
i"
%
(
self
.
problem_id
,
solution_id
)
solution
.
attrib
[
'id'
]
=
"
%
s_solution_
%
i"
%
(
self
.
problem_id
,
solution_id
)
solution_id
+=
1
solution_id
+=
1
def
sibling_for_item
(
self
,
tree
,
node
):
"""
Check if node exist in problem tree and return next sibling if exist
else return None
"""
problem_tree
=
tree
.
xpath
(
'//problem/*'
)
if
node
in
problem_tree
:
node_index
=
problem_tree
.
index
(
node
)
try
:
return
problem_tree
[
node_index
+
1
]
except
IndexError
:
return
None
else
:
return
None
common/lib/capa/capa/inputtypes.py
View file @
0aba5874
...
@@ -214,7 +214,6 @@ class InputTypeBase(object):
...
@@ -214,7 +214,6 @@ class InputTypeBase(object):
self
.
hintmode
=
feedback
.
get
(
'hintmode'
,
None
)
self
.
hintmode
=
feedback
.
get
(
'hintmode'
,
None
)
self
.
input_state
=
state
.
get
(
'input_state'
,
{})
self
.
input_state
=
state
.
get
(
'input_state'
,
{})
self
.
answervariable
=
state
.
get
(
"answervariable"
,
None
)
self
.
answervariable
=
state
.
get
(
"answervariable"
,
None
)
self
.
question_label
=
state
.
get
(
"question_label"
,
None
)
# put hint above msg if it should be displayed
# put hint above msg if it should be displayed
if
self
.
hintmode
==
'always'
:
if
self
.
hintmode
==
'always'
:
...
@@ -314,7 +313,6 @@ class InputTypeBase(object):
...
@@ -314,7 +313,6 @@ class InputTypeBase(object):
context
.
update
(
self
.
_extra_context
())
context
.
update
(
self
.
_extra_context
())
if
self
.
answervariable
:
if
self
.
answervariable
:
context
.
update
({
'answervariable'
:
self
.
answervariable
})
context
.
update
({
'answervariable'
:
self
.
answervariable
})
context
.
update
({
'question_label'
:
self
.
question_label
if
self
.
question_label
is
not
None
else
""
})
return
context
return
context
def
_extra_context
(
self
):
def
_extra_context
(
self
):
...
...
common/lib/capa/capa/templates/choicegroup.html
View file @
0aba5874
...
@@ -17,8 +17,8 @@
...
@@ -17,8 +17,8 @@
% endif
% endif
</div>
</div>
<fieldset>
<fieldset
role=
"${input_type}group"
aria-label=
"${label}"
>
<legend>
${question_label}
</legend>
% for choice_id, choice_description in choices:
% for choice_id, choice_description in choices:
<label
for=
"input_${id}_${choice_id}"
<label
for=
"input_${id}_${choice_id}"
##
If
the
student
has
selected
this
choice
...
##
If
the
student
has
selected
this
choice
...
...
...
common/lib/capa/capa/tests/test_html_render.py
View file @
0aba5874
...
@@ -175,7 +175,6 @@ class CapaHtmlRenderTest(unittest.TestCase):
...
@@ -175,7 +175,6 @@ class CapaHtmlRenderTest(unittest.TestCase):
'label'
:
''
,
'label'
:
''
,
'value'
:
''
,
'value'
:
''
,
'preprocessor'
:
None
,
'preprocessor'
:
None
,
'question_label'
:
''
,
'msg'
:
''
,
'msg'
:
''
,
'inline'
:
False
,
'inline'
:
False
,
'hidden'
:
False
,
'hidden'
:
False
,
...
...
common/lib/capa/capa/tests/test_input_templates.py
View file @
0aba5874
...
@@ -126,7 +126,6 @@ class ChoiceGroupTemplateTest(TemplateTestCase):
...
@@ -126,7 +126,6 @@ class ChoiceGroupTemplateTest(TemplateTestCase):
self
.
context
=
{
'id'
:
'1'
,
self
.
context
=
{
'id'
:
'1'
,
'choices'
:
choices
,
'choices'
:
choices
,
'status'
:
Status
(
'correct'
),
'status'
:
Status
(
'correct'
),
'question_label'
:
''
,
'label'
:
'test'
,
'label'
:
'test'
,
'input_type'
:
'checkbox'
,
'input_type'
:
'checkbox'
,
'name_array_suffix'
:
'1'
,
'name_array_suffix'
:
'1'
,
...
@@ -142,7 +141,6 @@ class ChoiceGroupTemplateTest(TemplateTestCase):
...
@@ -142,7 +141,6 @@ class ChoiceGroupTemplateTest(TemplateTestCase):
self
.
context
[
'status'
]
=
Status
(
'correct'
)
self
.
context
[
'status'
]
=
Status
(
'correct'
)
self
.
context
[
'input_type'
]
=
'checkbox'
self
.
context
[
'input_type'
]
=
'checkbox'
self
.
context
[
'value'
]
=
[
'1'
,
'2'
]
self
.
context
[
'value'
]
=
[
'1'
,
'2'
]
self
.
context
[
'question_label'
]
=
[
''
]
# Should mark the entire problem correct
# Should mark the entire problem correct
xml
=
self
.
render_to_xml
(
self
.
context
)
xml
=
self
.
render_to_xml
(
self
.
context
)
...
@@ -224,8 +222,8 @@ class ChoiceGroupTemplateTest(TemplateTestCase):
...
@@ -224,8 +222,8 @@ class ChoiceGroupTemplateTest(TemplateTestCase):
(not the entire problem) is marked correct.
(not the entire problem) is marked correct.
"""
"""
conditions
=
[
conditions
=
[
{
'input_type'
:
'radio'
,
'
question_label'
:
''
,
'
value'
:
'2'
},
{
'input_type'
:
'radio'
,
'value'
:
'2'
},
{
'input_type'
:
'radio'
,
'
question_label'
:
''
,
'
value'
:
[
'2'
]}]
{
'input_type'
:
'radio'
,
'value'
:
[
'2'
]}]
self
.
context
[
'status'
]
=
Status
(
'correct'
)
self
.
context
[
'status'
]
=
Status
(
'correct'
)
...
@@ -272,16 +270,16 @@ class ChoiceGroupTemplateTest(TemplateTestCase):
...
@@ -272,16 +270,16 @@ class ChoiceGroupTemplateTest(TemplateTestCase):
"""
"""
conditions
=
[
conditions
=
[
{
'input_type'
:
'radio'
,
'status'
:
Status
(
'correct'
),
'
question_label'
:
''
,
'
value'
:
''
},
{
'input_type'
:
'radio'
,
'status'
:
Status
(
'correct'
),
'value'
:
''
},
{
'input_type'
:
'radio'
,
'status'
:
Status
(
'correct'
),
'
question_label'
:
''
,
'
value'
:
'2'
},
{
'input_type'
:
'radio'
,
'status'
:
Status
(
'correct'
),
'value'
:
'2'
},
{
'input_type'
:
'radio'
,
'status'
:
Status
(
'correct'
),
'
question_label'
:
''
,
'
value'
:
[
'2'
]},
{
'input_type'
:
'radio'
,
'status'
:
Status
(
'correct'
),
'value'
:
[
'2'
]},
{
'input_type'
:
'radio'
,
'status'
:
Status
(
'incorrect'
),
'
question_label'
:
''
,
'
value'
:
'2'
},
{
'input_type'
:
'radio'
,
'status'
:
Status
(
'incorrect'
),
'value'
:
'2'
},
{
'input_type'
:
'radio'
,
'status'
:
Status
(
'incorrect'
),
'
question_label'
:
''
,
'
value'
:
[]},
{
'input_type'
:
'radio'
,
'status'
:
Status
(
'incorrect'
),
'value'
:
[]},
{
'input_type'
:
'radio'
,
'status'
:
Status
(
'incorrect'
),
'
question_label'
:
''
,
'
value'
:
[
'2'
]},
{
'input_type'
:
'radio'
,
'status'
:
Status
(
'incorrect'
),
'value'
:
[
'2'
]},
{
'input_type'
:
'checkbox'
,
'status'
:
Status
(
'correct'
),
'
question_label'
:
''
,
'
value'
:
[]},
{
'input_type'
:
'checkbox'
,
'status'
:
Status
(
'correct'
),
'value'
:
[]},
{
'input_type'
:
'checkbox'
,
'status'
:
Status
(
'correct'
),
'
question_label'
:
''
,
'
value'
:
[
'2'
]},
{
'input_type'
:
'checkbox'
,
'status'
:
Status
(
'correct'
),
'value'
:
[
'2'
]},
{
'input_type'
:
'checkbox'
,
'status'
:
Status
(
'incorrect'
),
'
question_label'
:
''
,
'
value'
:
[]},
{
'input_type'
:
'checkbox'
,
'status'
:
Status
(
'incorrect'
),
'value'
:
[]},
{
'input_type'
:
'checkbox'
,
'status'
:
Status
(
'incorrect'
),
'
question_label'
:
''
,
'
value'
:
[
'2'
]}]
{
'input_type'
:
'checkbox'
,
'status'
:
Status
(
'incorrect'
),
'value'
:
[
'2'
]}]
self
.
context
[
'show_correctness'
]
=
'never'
self
.
context
[
'show_correctness'
]
=
'never'
self
.
context
[
'submitted_message'
]
=
'Test message'
self
.
context
[
'submitted_message'
]
=
'Test message'
...
@@ -317,9 +315,9 @@ class ChoiceGroupTemplateTest(TemplateTestCase):
...
@@ -317,9 +315,9 @@ class ChoiceGroupTemplateTest(TemplateTestCase):
"""
"""
conditions
=
[
conditions
=
[
{
'input_type'
:
'radio'
,
'status'
:
Status
(
'unsubmitted'
),
'
question_label'
:
''
,
'
value'
:
''
},
{
'input_type'
:
'radio'
,
'status'
:
Status
(
'unsubmitted'
),
'value'
:
''
},
{
'input_type'
:
'radio'
,
'status'
:
Status
(
'unsubmitted'
),
'
question_label'
:
''
,
'
value'
:
[]},
{
'input_type'
:
'radio'
,
'status'
:
Status
(
'unsubmitted'
),
'value'
:
[]},
{
'input_type'
:
'checkbox'
,
'status'
:
Status
(
'unsubmitted'
),
'
question_label'
:
''
,
'
value'
:
[]},
{
'input_type'
:
'checkbox'
,
'status'
:
Status
(
'unsubmitted'
),
'value'
:
[]},
# These tests expose bug #365
# These tests expose bug #365
# When the bug is fixed, uncomment these cases.
# When the bug is fixed, uncomment these cases.
...
@@ -927,7 +925,7 @@ class ChoiceTextGroupTemplateTest(TemplateTestCase):
...
@@ -927,7 +925,7 @@ class ChoiceTextGroupTemplateTest(TemplateTestCase):
(not the entire problem) is marked correct."""
(not the entire problem) is marked correct."""
conditions
=
[
conditions
=
[
{
'input_type'
:
'radio'
,
'
question_label'
:
''
,
'
value'
:
self
.
VALUE_DICT
}]
{
'input_type'
:
'radio'
,
'value'
:
self
.
VALUE_DICT
}]
self
.
context
[
'status'
]
=
'correct'
self
.
context
[
'status'
]
=
'correct'
...
@@ -947,7 +945,7 @@ class ChoiceTextGroupTemplateTest(TemplateTestCase):
...
@@ -947,7 +945,7 @@ class ChoiceTextGroupTemplateTest(TemplateTestCase):
(not the entire problem) is marked incorrect."""
(not the entire problem) is marked incorrect."""
conditions
=
[
conditions
=
[
{
'input_type'
:
'radio'
,
'
question_label'
:
''
,
'
value'
:
self
.
VALUE_DICT
}]
{
'input_type'
:
'radio'
,
'value'
:
self
.
VALUE_DICT
}]
self
.
context
[
'status'
]
=
'incorrect'
self
.
context
[
'status'
]
=
'incorrect'
...
...
common/lib/capa/capa/tests/test_inputtypes.py
View file @
0aba5874
...
@@ -61,7 +61,6 @@ class OptionInputTest(unittest.TestCase):
...
@@ -61,7 +61,6 @@ class OptionInputTest(unittest.TestCase):
'value'
:
'Down'
,
'value'
:
'Down'
,
'options'
:
[(
'Up'
,
'Up'
),
(
'Down'
,
'Down'
),
(
'Don
\'
t know'
,
'Don
\'
t know'
)],
'options'
:
[(
'Up'
,
'Up'
),
(
'Down'
,
'Down'
),
(
'Don
\'
t know'
,
'Don
\'
t know'
)],
'status'
:
inputtypes
.
Status
(
'answered'
),
'status'
:
inputtypes
.
Status
(
'answered'
),
'question_label'
:
''
,
'label'
:
''
,
'label'
:
''
,
'msg'
:
''
,
'msg'
:
''
,
'inline'
:
False
,
'inline'
:
False
,
...
@@ -122,7 +121,6 @@ class ChoiceGroupTest(unittest.TestCase):
...
@@ -122,7 +121,6 @@ class ChoiceGroupTest(unittest.TestCase):
'id'
:
'sky_input'
,
'id'
:
'sky_input'
,
'value'
:
'foil3'
,
'value'
:
'foil3'
,
'status'
:
inputtypes
.
Status
(
'answered'
),
'status'
:
inputtypes
.
Status
(
'answered'
),
'question_label'
:
''
,
'label'
:
''
,
'label'
:
''
,
'msg'
:
''
,
'msg'
:
''
,
'input_type'
:
expected_input_type
,
'input_type'
:
expected_input_type
,
...
@@ -176,7 +174,6 @@ class JavascriptInputTest(unittest.TestCase):
...
@@ -176,7 +174,6 @@ class JavascriptInputTest(unittest.TestCase):
'STATIC_URL'
:
'/dummy-static/'
,
'STATIC_URL'
:
'/dummy-static/'
,
'id'
:
'prob_1_2'
,
'id'
:
'prob_1_2'
,
'status'
:
inputtypes
.
Status
(
'unanswered'
),
'status'
:
inputtypes
.
Status
(
'unanswered'
),
'question_label'
:
''
,
# 'label': '',
# 'label': '',
'msg'
:
''
,
'msg'
:
''
,
'value'
:
'3'
,
'value'
:
'3'
,
...
@@ -210,7 +207,6 @@ class TextLineTest(unittest.TestCase):
...
@@ -210,7 +207,6 @@ class TextLineTest(unittest.TestCase):
'id'
:
'prob_1_2'
,
'id'
:
'prob_1_2'
,
'value'
:
'BumbleBee'
,
'value'
:
'BumbleBee'
,
'status'
:
inputtypes
.
Status
(
'unanswered'
),
'status'
:
inputtypes
.
Status
(
'unanswered'
),
'question_label'
:
''
,
'label'
:
'testing 123'
,
'label'
:
'testing 123'
,
'size'
:
size
,
'size'
:
size
,
'msg'
:
''
,
'msg'
:
''
,
...
@@ -243,7 +239,6 @@ class TextLineTest(unittest.TestCase):
...
@@ -243,7 +239,6 @@ class TextLineTest(unittest.TestCase):
'id'
:
'prob_1_2'
,
'id'
:
'prob_1_2'
,
'value'
:
'BumbleBee'
,
'value'
:
'BumbleBee'
,
'status'
:
inputtypes
.
Status
(
'unanswered'
),
'status'
:
inputtypes
.
Status
(
'unanswered'
),
'question_label'
:
''
,
'label'
:
''
,
'label'
:
''
,
'size'
:
size
,
'size'
:
size
,
'msg'
:
''
,
'msg'
:
''
,
...
@@ -288,7 +283,6 @@ class TextLineTest(unittest.TestCase):
...
@@ -288,7 +283,6 @@ class TextLineTest(unittest.TestCase):
'id'
:
'prob_1_2'
,
'id'
:
'prob_1_2'
,
'value'
:
'BumbleBee'
,
'value'
:
'BumbleBee'
,
'status'
:
inputtypes
.
Status
(
'unanswered'
),
'status'
:
inputtypes
.
Status
(
'unanswered'
),
'question_label'
:
''
,
'label'
:
''
,
'label'
:
''
,
'size'
:
size
,
'size'
:
size
,
'msg'
:
''
,
'msg'
:
''
,
...
@@ -330,7 +324,6 @@ class FileSubmissionTest(unittest.TestCase):
...
@@ -330,7 +324,6 @@ class FileSubmissionTest(unittest.TestCase):
'STATIC_URL'
:
'/dummy-static/'
,
'STATIC_URL'
:
'/dummy-static/'
,
'id'
:
'prob_1_2'
,
'id'
:
'prob_1_2'
,
'status'
:
inputtypes
.
Status
(
'queued'
),
'status'
:
inputtypes
.
Status
(
'queued'
),
'question_label'
:
''
,
'label'
:
''
,
'label'
:
''
,
'msg'
:
the_input
.
submitted_msg
,
'msg'
:
the_input
.
submitted_msg
,
'value'
:
'BumbleBee.py'
,
'value'
:
'BumbleBee.py'
,
...
@@ -381,7 +374,6 @@ class CodeInputTest(unittest.TestCase):
...
@@ -381,7 +374,6 @@ class CodeInputTest(unittest.TestCase):
'id'
:
'prob_1_2'
,
'id'
:
'prob_1_2'
,
'value'
:
'print "good evening"'
,
'value'
:
'print "good evening"'
,
'status'
:
inputtypes
.
Status
(
'queued'
),
'status'
:
inputtypes
.
Status
(
'queued'
),
'question_label'
:
''
,
# 'label': '',
# 'label': '',
'msg'
:
the_input
.
submitted_msg
,
'msg'
:
the_input
.
submitted_msg
,
'mode'
:
mode
,
'mode'
:
mode
,
...
@@ -437,7 +429,6 @@ class MatlabTest(unittest.TestCase):
...
@@ -437,7 +429,6 @@ class MatlabTest(unittest.TestCase):
'id'
:
'prob_1_2'
,
'id'
:
'prob_1_2'
,
'value'
:
'print "good evening"'
,
'value'
:
'print "good evening"'
,
'status'
:
inputtypes
.
Status
(
'queued'
),
'status'
:
inputtypes
.
Status
(
'queued'
),
'question_label'
:
''
,
# 'label': '',
# 'label': '',
'msg'
:
self
.
the_input
.
submitted_msg
,
'msg'
:
self
.
the_input
.
submitted_msg
,
'mode'
:
self
.
mode
,
'mode'
:
self
.
mode
,
...
@@ -469,7 +460,6 @@ class MatlabTest(unittest.TestCase):
...
@@ -469,7 +460,6 @@ class MatlabTest(unittest.TestCase):
'id'
:
'prob_1_2'
,
'id'
:
'prob_1_2'
,
'value'
:
'print "good evening"'
,
'value'
:
'print "good evening"'
,
'status'
:
inputtypes
.
Status
(
'queued'
),
'status'
:
inputtypes
.
Status
(
'queued'
),
'question_label'
:
''
,
# 'label': '',
# 'label': '',
'msg'
:
the_input
.
submitted_msg
,
'msg'
:
the_input
.
submitted_msg
,
'mode'
:
self
.
mode
,
'mode'
:
self
.
mode
,
...
@@ -501,7 +491,6 @@ class MatlabTest(unittest.TestCase):
...
@@ -501,7 +491,6 @@ class MatlabTest(unittest.TestCase):
'id'
:
'prob_1_2'
,
'id'
:
'prob_1_2'
,
'value'
:
'print "good evening"'
,
'value'
:
'print "good evening"'
,
'status'
:
inputtypes
.
Status
(
status
),
'status'
:
inputtypes
.
Status
(
status
),
'question_label'
:
''
,
# 'label': '',
# 'label': '',
'msg'
:
''
,
'msg'
:
''
,
'mode'
:
self
.
mode
,
'mode'
:
self
.
mode
,
...
@@ -533,7 +522,6 @@ class MatlabTest(unittest.TestCase):
...
@@ -533,7 +522,6 @@ class MatlabTest(unittest.TestCase):
'id'
:
'prob_1_2'
,
'id'
:
'prob_1_2'
,
'value'
:
'print "good evening"'
,
'value'
:
'print "good evening"'
,
'status'
:
inputtypes
.
Status
(
'queued'
),
'status'
:
inputtypes
.
Status
(
'queued'
),
'question_label'
:
''
,
# 'label': '',
# 'label': '',
'msg'
:
the_input
.
submitted_msg
,
'msg'
:
the_input
.
submitted_msg
,
'mode'
:
self
.
mode
,
'mode'
:
self
.
mode
,
...
@@ -660,14 +648,7 @@ class MatlabTest(unittest.TestCase):
...
@@ -660,14 +648,7 @@ class MatlabTest(unittest.TestCase):
output
=
self
.
the_input
.
get_html
()
output
=
self
.
the_input
.
get_html
()
self
.
assertEqual
(
self
.
assertEqual
(
etree
.
tostring
(
output
),
etree
.
tostring
(
output
),
" "
.
join
(
textwrap
.
dedent
(
"""
"""<div>{
\'
status
\'
: Status(
\'
queued
\'
),
\'
button_enabled
\'
: True,
\'
rows
\'
:
\'
10
\'
,
\'
queue_len
\'
:
\'
3
\'
,
\'
mode
\'
:
\'\'
,
\'
cols
\'
:
\'
80
\'
,
\'
STATIC_URL
\'
:
\'
/dummy-static/
\'
,
\'
linenumbers
\'
:
\'
true
\'
,
\'
queue_msg
\'
:
\'\'
,
\'
value
\'
:
\'
print "good evening"
\'
,
\'
msg
\'
: u
\'
Submitted. As soon as a response is returned, this message will be replaced by that feedback.
\'
,
\'
matlab_editor_js
\'
:
\'
/dummy-static/js/vendor/CodeMirror/octave.js
\'
,
\'
hidden
\'
:
\'\'
,
\'
id
\'
:
\'
prob_1_2
\'
,
\'
tabsize
\'
: 4}</div>"""
<div>{
\'
status
\'
: Status(
\'
queued
\'
),
\'
button_enabled
\'
: True,
\'
rows
\'
:
\'
10
\'
,
\'
queue_len
\'
:
\'
3
\'
,
\'
question_label
\'
:
\'\'
,
\'
mode
\'
:
\'\'
,
\'
cols
\'
:
\'
80
\'
,
\'
STATIC_URL
\'
:
\'
/dummy-static/
\'
,
\'
linenumbers
\'
:
\'
true
\'
,
\'
queue_msg
\'
:
\'\'
,
\'
value
\'
:
\'
print "good evening"
\'
,
\'
msg
\'
: u
\'
Submitted. As soon as a response is returned, this message will be replaced by that feedback.
\'
,
\'
matlab_editor_js
\'
:
\'
/dummy-static/js/vendor/CodeMirror/octave.js
\'
,
\'
hidden
\'
:
\'\'
,
\'
id
\'
:
\'
prob_1_2
\'
,
\'
tabsize
\'
: 4}</div>
"""
)
.
replace
(
'
\n
'
,
' '
)
.
split
())
)
)
# test html, that is correct HTML5 html, but is not parsable by XML parser.
# test html, that is correct HTML5 html, but is not parsable by XML parser.
...
@@ -758,7 +739,6 @@ class MatlabTest(unittest.TestCase):
...
@@ -758,7 +739,6 @@ class MatlabTest(unittest.TestCase):
'id'
:
'prob_1_2'
,
'id'
:
'prob_1_2'
,
'value'
:
'print "good evening"'
,
'value'
:
'print "good evening"'
,
'status'
:
inputtypes
.
Status
(
'queued'
),
'status'
:
inputtypes
.
Status
(
'queued'
),
'question_label'
:
''
,
'msg'
:
self
.
the_input
.
submitted_msg
,
'msg'
:
self
.
the_input
.
submitted_msg
,
'mode'
:
self
.
mode
,
'mode'
:
self
.
mode
,
'rows'
:
self
.
rows
,
'rows'
:
self
.
rows
,
...
@@ -868,7 +848,6 @@ class SchematicTest(unittest.TestCase):
...
@@ -868,7 +848,6 @@ class SchematicTest(unittest.TestCase):
'id'
:
'prob_1_2'
,
'id'
:
'prob_1_2'
,
'value'
:
value
,
'value'
:
value
,
'status'
:
inputtypes
.
Status
(
'unsubmitted'
),
'status'
:
inputtypes
.
Status
(
'unsubmitted'
),
'question_label'
:
''
,
'label'
:
''
,
'label'
:
''
,
'msg'
:
''
,
'msg'
:
''
,
'initial_value'
:
initial_value
,
'initial_value'
:
initial_value
,
...
@@ -913,7 +892,6 @@ class ImageInputTest(unittest.TestCase):
...
@@ -913,7 +892,6 @@ class ImageInputTest(unittest.TestCase):
'id'
:
'prob_1_2'
,
'id'
:
'prob_1_2'
,
'value'
:
value
,
'value'
:
value
,
'status'
:
inputtypes
.
Status
(
'unsubmitted'
),
'status'
:
inputtypes
.
Status
(
'unsubmitted'
),
'question_label'
:
''
,
'label'
:
''
,
'label'
:
''
,
'width'
:
width
,
'width'
:
width
,
'height'
:
height
,
'height'
:
height
,
...
@@ -969,7 +947,6 @@ class CrystallographyTest(unittest.TestCase):
...
@@ -969,7 +947,6 @@ class CrystallographyTest(unittest.TestCase):
'id'
:
'prob_1_2'
,
'id'
:
'prob_1_2'
,
'value'
:
value
,
'value'
:
value
,
'status'
:
inputtypes
.
Status
(
'unsubmitted'
),
'status'
:
inputtypes
.
Status
(
'unsubmitted'
),
'question_label'
:
''
,
# 'label': '',
# 'label': '',
'msg'
:
''
,
'msg'
:
''
,
'width'
:
width
,
'width'
:
width
,
...
@@ -1012,7 +989,6 @@ class VseprTest(unittest.TestCase):
...
@@ -1012,7 +989,6 @@ class VseprTest(unittest.TestCase):
'id'
:
'prob_1_2'
,
'id'
:
'prob_1_2'
,
'value'
:
value
,
'value'
:
value
,
'status'
:
inputtypes
.
Status
(
'unsubmitted'
),
'status'
:
inputtypes
.
Status
(
'unsubmitted'
),
'question_label'
:
''
,
'msg'
:
''
,
'msg'
:
''
,
'width'
:
width
,
'width'
:
width
,
'height'
:
height
,
'height'
:
height
,
...
@@ -1046,7 +1022,6 @@ class ChemicalEquationTest(unittest.TestCase):
...
@@ -1046,7 +1022,6 @@ class ChemicalEquationTest(unittest.TestCase):
'id'
:
'prob_1_2'
,
'id'
:
'prob_1_2'
,
'value'
:
'H2OYeah'
,
'value'
:
'H2OYeah'
,
'status'
:
inputtypes
.
Status
(
'unanswered'
),
'status'
:
inputtypes
.
Status
(
'unanswered'
),
'question_label'
:
''
,
'label'
:
''
,
'label'
:
''
,
'msg'
:
''
,
'msg'
:
''
,
'size'
:
self
.
size
,
'size'
:
self
.
size
,
...
@@ -1136,7 +1111,6 @@ class FormulaEquationTest(unittest.TestCase):
...
@@ -1136,7 +1111,6 @@ class FormulaEquationTest(unittest.TestCase):
'id'
:
'prob_1_2'
,
'id'
:
'prob_1_2'
,
'value'
:
'x^2+1/2'
,
'value'
:
'x^2+1/2'
,
'status'
:
inputtypes
.
Status
(
'unanswered'
),
'status'
:
inputtypes
.
Status
(
'unanswered'
),
'question_label'
:
''
,
'label'
:
''
,
'label'
:
''
,
'msg'
:
''
,
'msg'
:
''
,
'size'
:
self
.
size
,
'size'
:
self
.
size
,
...
@@ -1266,7 +1240,6 @@ class DragAndDropTest(unittest.TestCase):
...
@@ -1266,7 +1240,6 @@ class DragAndDropTest(unittest.TestCase):
'id'
:
'prob_1_2'
,
'id'
:
'prob_1_2'
,
'value'
:
value
,
'value'
:
value
,
'status'
:
inputtypes
.
Status
(
'unsubmitted'
),
'status'
:
inputtypes
.
Status
(
'unsubmitted'
),
'question_label'
:
''
,
# 'label': '',
# 'label': '',
'msg'
:
''
,
'msg'
:
''
,
'drag_and_drop_json'
:
json
.
dumps
(
user_input
)
'drag_and_drop_json'
:
json
.
dumps
(
user_input
)
...
@@ -1319,7 +1292,6 @@ class AnnotationInputTest(unittest.TestCase):
...
@@ -1319,7 +1292,6 @@ class AnnotationInputTest(unittest.TestCase):
'STATIC_URL'
:
'/dummy-static/'
,
'STATIC_URL'
:
'/dummy-static/'
,
'id'
:
'annotation_input'
,
'id'
:
'annotation_input'
,
'status'
:
inputtypes
.
Status
(
'answered'
),
'status'
:
inputtypes
.
Status
(
'answered'
),
'question_label'
:
''
,
# 'label': '',
# 'label': '',
'msg'
:
''
,
'msg'
:
''
,
'title'
:
'foo'
,
'title'
:
'foo'
,
...
@@ -1396,7 +1368,6 @@ class TestChoiceText(unittest.TestCase):
...
@@ -1396,7 +1368,6 @@ class TestChoiceText(unittest.TestCase):
expected
=
{
expected
=
{
'STATIC_URL'
:
'/dummy-static/'
,
'STATIC_URL'
:
'/dummy-static/'
,
'msg'
:
''
,
'msg'
:
''
,
'question_label'
:
''
,
'label'
:
''
,
'label'
:
''
,
'input_type'
:
expected_input_type
,
'input_type'
:
expected_input_type
,
'choices'
:
choices
,
'choices'
:
choices
,
...
...
common/lib/xmodule/xmodule/js/spec/problem/edit_spec.coffee
View file @
0aba5874
...
@@ -509,7 +509,7 @@ describe 'MarkdownEditingDescriptor', ->
...
@@ -509,7 +509,7 @@ describe 'MarkdownEditingDescriptor', ->
[Explanation]
[Explanation]
"""
)
"""
)
expect
(
data
).
toEqual
(
"""<problem>
expect
(
data
).
toEqual
(
"""<problem>
<
legend>Who lead the civil right movement in the United States of America?</legend
>
<
p>Who lead the civil right movement in the United States of America?</p
>
<stringresponse answer="w*.?s*Luther Kings*.*" type="ci regexp" >
<stringresponse answer="w*.?s*Luther Kings*.*" type="ci regexp" >
<textline label="Who lead the civil right movement in the United States of America?" size="20"/>
<textline label="Who lead the civil right movement in the United States of America?" size="20"/>
</stringresponse>
</stringresponse>
...
@@ -541,14 +541,14 @@ describe 'MarkdownEditingDescriptor', ->
...
@@ -541,14 +541,14 @@ describe 'MarkdownEditingDescriptor', ->
expect
(
data
).
toEqual
(
"""<problem>
expect
(
data
).
toEqual
(
"""<problem>
<p>France is a country in Europe.</p>
<p>France is a country in Europe.</p>
<
legend>What is the capital of France?</legend
>
<
p>What is the capital of France?</p
>
<stringresponse answer="Paris" type="ci" >
<stringresponse answer="Paris" type="ci" >
<textline label="What is the capital of France?" size="20"/>
<textline label="What is the capital of France?" size="20"/>
</stringresponse>
</stringresponse>
<p>Germany is a country in Europe, too.</p>
<p>Germany is a country in Europe, too.</p>
<
legend>What is the capital of Germany?</legend
>
<
p>What is the capital of Germany?</p
>
<multiplechoiceresponse>
<multiplechoiceresponse>
<choicegroup label="What is the capital of Germany?" type="MultipleChoice">
<choicegroup label="What is the capital of Germany?" type="MultipleChoice">
<choice correct="false">Bonn</choice>
<choice correct="false">Bonn</choice>
...
@@ -574,12 +574,11 @@ describe 'MarkdownEditingDescriptor', ->
...
@@ -574,12 +574,11 @@ describe 'MarkdownEditingDescriptor', ->
( ) Hamburg
( ) Hamburg
(x) Berlin
(x) Berlin
( ) Donut
( ) Donut
"""
)
"""
)
expect
(
data
).
toEqual
(
"""<problem>
expect
(
data
).
toEqual
(
"""<problem>
<p>France is a country in Europe.</p>
<p>France is a country in Europe.</p>
<
legend>What is the capital of France?</legend
>
<
p>What is the capital of France?</p
>
<stringresponse answer="Paris" type="ci" >
<stringresponse answer="Paris" type="ci" >
<textline label="What is the capital of France?" size="20"/>
<textline label="What is the capital of France?" size="20"/>
</stringresponse>
</stringresponse>
...
@@ -605,7 +604,7 @@ describe 'MarkdownEditingDescriptor', ->
...
@@ -605,7 +604,7 @@ describe 'MarkdownEditingDescriptor', ->
>>What is the capital of France?<
>>What is the capital of France?<
= Paris
= Paris
>>What is the capital of <<Germany?<<
blah
>>What is the capital of <<Germany?<<
( ) Bonn
( ) Bonn
( ) Hamburg
( ) Hamburg
(x) Berlin
(x) Berlin
...
@@ -619,7 +618,7 @@ describe 'MarkdownEditingDescriptor', ->
...
@@ -619,7 +618,7 @@ describe 'MarkdownEditingDescriptor', ->
<textline size="20"/>
<textline size="20"/>
</stringresponse>
</stringresponse>
<
legend>What is the capital of Germany?</legend
>
<
p>blahWhat is the capital of Germany?</p
>
<multiplechoiceresponse>
<multiplechoiceresponse>
<choicegroup label="What is the capital of <<Germany?" type="MultipleChoice">
<choicegroup label="What is the capital of <<Germany?" type="MultipleChoice">
<choice correct="false">Bonn</choice>
<choice correct="false">Bonn</choice>
...
@@ -637,7 +636,7 @@ describe 'MarkdownEditingDescriptor', ->
...
@@ -637,7 +636,7 @@ describe 'MarkdownEditingDescriptor', ->
= 3.14159 +- .02
= 3.14159 +- .02
"""
)
"""
)
expect
(
data
).
toEqual
(
"""<problem>
expect
(
data
).
toEqual
(
"""<problem>
<
legend>Enter the numerical value of Pi:</legend
>
<
p>Enter the numerical value of Pi:</p
>
<numericalresponse answer="3.14159">
<numericalresponse answer="3.14159">
<responseparam type="tolerance" default=".02" />
<responseparam type="tolerance" default=".02" />
<formulaequationinput label="Enter the numerical value of Pi:" />
<formulaequationinput label="Enter the numerical value of Pi:" />
...
@@ -651,7 +650,7 @@ describe 'MarkdownEditingDescriptor', ->
...
@@ -651,7 +650,7 @@ describe 'MarkdownEditingDescriptor', ->
= Paris
= Paris
"""
)
"""
)
expect
(
data
).
toEqual
(
"""<problem>
expect
(
data
).
toEqual
(
"""<problem>
<
legend>What is the "capital" of France & the 'best' > place < to live"?</legend
>
<
p>What is the "capital" of France & the 'best' > place < to live"?</p
>
<stringresponse answer="Paris" type="ci" >
<stringresponse answer="Paris" type="ci" >
<textline label="What is the "capital" of France & the 'best' > place < to live"?" size="20"/>
<textline label="What is the "capital" of France & the 'best' > place < to live"?" size="20"/>
</stringresponse>
</stringresponse>
...
...
common/lib/xmodule/xmodule/js/src/problem/edit.coffee
View file @
0aba5874
...
@@ -371,9 +371,7 @@ class @MarkdownEditingDescriptor extends XModule.Descriptor
...
@@ -371,9 +371,7 @@ class @MarkdownEditingDescriptor extends XModule.Descriptor
.
replace
(
/>/g
,
'>'
)
.
replace
(
/>/g
,
'>'
)
.
replace
(
/"/g
,
'"'
)
.
replace
(
/"/g
,
'"'
)
.
replace
(
/'/g
,
'''
);
.
replace
(
/'/g
,
'''
);
line
=
line
.
replace
(
/>>/g
,
'<legend>'
);
line
=
line
.
replace
(
/>>|<</g
,
''
);
line
=
line
.
replace
(
/<+$/g
,
'</legend>'
);
line
=
line
.
replace
(
/<</g
,
''
);
}
else
if
(
line
.
match
(
/<\w+response/
)
&&
didinput
&&
curlabel
==
prevlabel
)
{
}
else
if
(
line
.
match
(
/<\w+response/
)
&&
didinput
&&
curlabel
==
prevlabel
)
{
//
reset
label
to
prevent
gobbling
up
previous
one
(
if
multiple
questions
)
//
reset
label
to
prevent
gobbling
up
previous
one
(
if
multiple
questions
)
curlabel
=
''
;
curlabel
=
''
;
...
...
common/lib/xmodule/xmodule/templates/problem/checkboxes_response.yaml
View file @
0aba5874
...
@@ -16,7 +16,6 @@ metadata:
...
@@ -16,7 +16,6 @@ metadata:
[x] French
[x] French
[ ] Hungarian
[ ] Hungarian
Note: Make sure you select all of the correct options—there may be more than one!
Note: Make sure you select all of the correct options—there may be more than one!
[explanation]
[explanation]
...
@@ -29,6 +28,7 @@ data: |
...
@@ -29,6 +28,7 @@ data: |
<p>When you add the component, be sure to select <strong>Settings</strong>
<p>When you add the component, be sure to select <strong>Settings</strong>
to specify a <strong>Display Name</strong> and other values that apply.</p>
to specify a <strong>Display Name</strong> and other values that apply.</p>
<p>You can use the following example problem as a model.</p>
<p>You can use the following example problem as a model.</p>
<fieldset>
<legend>The following languages are in the Indo-European family:</legend>
<legend>The following languages are in the Indo-European family:</legend>
<choiceresponse>
<choiceresponse>
<checkboxgroup direction="vertical">
<checkboxgroup direction="vertical">
...
@@ -39,6 +39,7 @@ data: |
...
@@ -39,6 +39,7 @@ data: |
<choice correct="false" name="hungarian">Hungarian</choice>
<choice correct="false" name="hungarian">Hungarian</choice>
</checkboxgroup>
</checkboxgroup>
</choiceresponse>
</choiceresponse>
</fieldset>
<p><strong>Note</strong>: Make sure you select all of the correct options—there may be more than one!</p>
<p><strong>Note</strong>: Make sure you select all of the correct options—there may be more than one!</p>
<solution>
<solution>
<div class="detailed-solution">
<div class="detailed-solution">
...
...
common/lib/xmodule/xmodule/templates/problem/multiplechoice.yaml
View file @
0aba5874
...
@@ -15,7 +15,6 @@ metadata:
...
@@ -15,7 +15,6 @@ metadata:
(x) Indonesia
(x) Indonesia
( ) Russia
( ) Russia
[explanation]
[explanation]
According to September 2014 estimates:
According to September 2014 estimates:
The population of Indonesia is approximately 250 million.
The population of Indonesia is approximately 250 million.
...
@@ -31,6 +30,7 @@ data: |
...
@@ -31,6 +30,7 @@ data: |
<p>When you add the problem, be sure to select <strong>Settings</strong>
<p>When you add the problem, be sure to select <strong>Settings</strong>
to specify a <strong>Display Name</strong> and other values that apply.</p>
to specify a <strong>Display Name</strong> and other values that apply.</p>
<p>You can use the following example problem as a model.</p>
<p>You can use the following example problem as a model.</p>
<fieldset>
<legend>Which of the following countries has the largest population?</legend>
<legend>Which of the following countries has the largest population?</legend>
<multiplechoiceresponse>
<multiplechoiceresponse>
<choicegroup type="MultipleChoice">
<choicegroup type="MultipleChoice">
...
@@ -40,6 +40,7 @@ data: |
...
@@ -40,6 +40,7 @@ data: |
<choice correct="false" name="russia">Russia</choice>
<choice correct="false" name="russia">Russia</choice>
</choicegroup>
</choicegroup>
</multiplechoiceresponse>
</multiplechoiceresponse>
</fieldset>
<solution>
<solution>
<div class="detailed-solution">
<div class="detailed-solution">
<p>Explanation</p>
<p>Explanation</p>
...
...
common/lib/xmodule/xmodule/templates/problem/numericalresponse.yaml
View file @
0aba5874
...
@@ -16,7 +16,6 @@ metadata:
...
@@ -16,7 +16,6 @@ metadata:
= 9.3*10^6
= 9.3*10^6
or= 9.296*10^6
or= 9.296*10^6
>>The square of what number is -100?<<
>>The square of what number is -100?<<
= 10*i
= 10*i
...
...
common/lib/xmodule/xmodule/templates/problem/optionresponse.yaml
View file @
0aba5874
...
@@ -14,7 +14,6 @@ metadata:
...
@@ -14,7 +14,6 @@ metadata:
[[(India), Spain, China, Bermuda]]
[[(India), Spain, China, Bermuda]]
[explanation]
[explanation]
India became an independent nation on August 15, 1947.
India became an independent nation on August 15, 1947.
[explanation]
[explanation]
...
...
common/lib/xmodule/xmodule/templates/problem/string_response.yaml
View file @
0aba5874
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