Commit 50b2f9ce by Peter Baratta

Convert all usage of textline to formulaequationinput going forward

Especially, the defaults in studio to use formulaequationinputs and some of
the documentation and examples.
parent aad997ea
...@@ -16,6 +16,8 @@ Module containing the problem elements which render into input objects ...@@ -16,6 +16,8 @@ Module containing the problem elements which render into input objects
- crystallography - crystallography
- vsepr_input - vsepr_input
- drag_and_drop - drag_and_drop
- formulaequationinput
- chemicalequationinput
These are matched by *.html files templates/*.html which are mako templates with the These are matched by *.html files templates/*.html which are mako templates with the
actual html. actual html.
......
...@@ -931,7 +931,7 @@ class CustomResponse(LoncapaResponse): ...@@ -931,7 +931,7 @@ class CustomResponse(LoncapaResponse):
'chemicalequationinput', 'vsepr_input', 'chemicalequationinput', 'vsepr_input',
'drag_and_drop_input', 'editamoleculeinput', 'drag_and_drop_input', 'editamoleculeinput',
'designprotein2dinput', 'editageneinput', 'designprotein2dinput', 'editageneinput',
'annotationinput', 'jsinput'] 'annotationinput', 'jsinput', 'formulaequationinput']
def setup_response(self): def setup_response(self):
xml = self.xml xml = self.xml
......
...@@ -447,6 +447,7 @@ class TextlineTemplateTest(TemplateTestCase): ...@@ -447,6 +447,7 @@ class TextlineTemplateTest(TemplateTestCase):
xpath = "//span[@class='message']" xpath = "//span[@class='message']"
self.assert_has_text(xml, xpath, self.context['msg']) self.assert_has_text(xml, xpath, self.context['msg'])
# TODO formulaequationinput tests
class AnnotationInputTemplateTest(TemplateTestCase): class AnnotationInputTemplateTest(TemplateTestCase):
""" """
......
...@@ -32,7 +32,7 @@ $wrongans</tt> to see a hint.</p> ...@@ -32,7 +32,7 @@ $wrongans</tt> to see a hint.</p>
<formularesponse samples="x@-5:5#11" id="11" answer="$answer"> <formularesponse samples="x@-5:5#11" id="11" answer="$answer">
<responseparam description="Numerical Tolerance" type="tolerance" default="0.001" name="tol" /> <responseparam description="Numerical Tolerance" type="tolerance" default="0.001" name="tol" />
<text>y = <textline size="25" /></text> <text>y = <formulaequationinput size="25" /></text>
<hintgroup> <hintgroup>
<formulahint samples="x@-5:5#11" answer="$wrongans" name="inversegrad"> <formulahint samples="x@-5:5#11" answer="$wrongans" name="inversegrad">
</formulahint> </formulahint>
......
...@@ -121,18 +121,18 @@ describe 'MarkdownEditingDescriptor', -> ...@@ -121,18 +121,18 @@ describe 'MarkdownEditingDescriptor', ->
<p>Enter the numerical value of Pi:</p> <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" />
<textline /> <formulaequationinput />
</numericalresponse> </numericalresponse>
<p>Enter the approximate value of 502*9:</p> <p>Enter the approximate value of 502*9:</p>
<numericalresponse answer="4518"> <numericalresponse answer="4518">
<responseparam type="tolerance" default="15%" /> <responseparam type="tolerance" default="15%" />
<textline /> <formulaequationinput />
</numericalresponse> </numericalresponse>
<p>Enter the number of fingers on a human hand:</p> <p>Enter the number of fingers on a human hand:</p>
<numericalresponse answer="5"> <numericalresponse answer="5">
<textline /> <formulaequationinput />
</numericalresponse> </numericalresponse>
<solution> <solution>
...@@ -157,7 +157,7 @@ describe 'MarkdownEditingDescriptor', -> ...@@ -157,7 +157,7 @@ describe 'MarkdownEditingDescriptor', ->
<p>Enter 0 with a tolerance:</p> <p>Enter 0 with a tolerance:</p>
<numericalresponse answer="0"> <numericalresponse answer="0">
<responseparam type="tolerance" default=".02" /> <responseparam type="tolerance" default=".02" />
<textline /> <formulaequationinput />
</numericalresponse> </numericalresponse>
......
...@@ -239,7 +239,7 @@ class @MarkdownEditingDescriptor extends XModule.Descriptor ...@@ -239,7 +239,7 @@ class @MarkdownEditingDescriptor extends XModule.Descriptor
} else { } else {
string = '<numericalresponse answer="' + floatValue + '">\n'; string = '<numericalresponse answer="' + floatValue + '">\n';
} }
string += ' <textline />\n'; string += ' <formulaequationinput />\n';
string += '</numericalresponse>\n\n'; string += '</numericalresponse>\n\n';
} else { } else {
string = '<stringresponse answer="' + p + '" type="ci">\n <textline size="20"/>\n</stringresponse>\n\n'; string = '<stringresponse answer="' + p + '" type="ci">\n <textline size="20"/>\n</stringresponse>\n\n';
......
...@@ -24,15 +24,15 @@ data: | ...@@ -24,15 +24,15 @@ data: |
</script> </script>
<p>Give an equation for the relativistic energy of an object with mass m. Explicitly indicate multiplication with a <tt>*</tt> symbol.</p> <p>Give an equation for the relativistic energy of an object with mass m. Explicitly indicate multiplication with a <tt>*</tt> symbol.</p>
<formularesponse type="cs" samples="m,c@1,2:3,4#10" answer="m*c^2"> <formularesponse type="cs" samples="m,c@1,2:3,4#10" answer="m*c^2">
<responseparam type="tolerance" default="0.00001"/> <responseparam type="tolerance" default="0.00001"/>
<br/><text>E =</text> <textline size="40" math="1" /> <br/><text>E =</text> <formulaequationinput size="40" />
</formularesponse> </formularesponse>
<p>The answer to this question is (R_1*R_2)/R_3. </p> <p>The answer to this question is (R_1*R_2)/R_3. </p>
<formularesponse type="ci" samples="R_1,R_2,R_3@1,2,3:3,4,5#10" answer="$VoVi"> <formularesponse type="ci" samples="R_1,R_2,R_3@1,2,3:3,4,5#10" answer="$VoVi">
<responseparam type="tolerance" default="0.00001"/> <responseparam type="tolerance" default="0.00001"/>
<textline size="40" math="1" /> <formulaequationinput size="40" />
</formularesponse> </formularesponse>
<solution> <solution>
<div class="detailed-solution"> <div class="detailed-solution">
......
...@@ -119,9 +119,8 @@ data: | ...@@ -119,9 +119,8 @@ data: |
<p> <p>
<p style="display:inline">Energy saved = </p> <p style="display:inline">Energy saved = </p>
<numericalresponse inline="1" answer="0.52"> <numericalresponse inline="1" answer="0.52">
<textline inline="1"> <responseparam description="Numerical Tolerance" type="tolerance" default="0.02" name="tol"/>
<responseparam description="Numerical Tolerance" type="tolerance" default="0.02" name="tol"/> <formulaequationinput/>
</textline>
</numericalresponse> </numericalresponse>
<p style="display:inline">&#xA0;EJ/year</p> <p style="display:inline">&#xA0;EJ/year</p>
</p> </p>
......
...@@ -47,19 +47,19 @@ data: | ...@@ -47,19 +47,19 @@ data: |
<p>Enter the numerical value of Pi: <p>Enter the numerical value of Pi:
<numericalresponse answer="3.14159"> <numericalresponse answer="3.14159">
<responseparam type="tolerance" default=".02" /> <responseparam type="tolerance" default=".02" />
<textline /> <formulaequationinput />
</numericalresponse> </numericalresponse>
</p> </p>
<p>Enter the approximate value of 502*9: <p>Enter the approximate value of 502*9:
<numericalresponse answer="$computed_response"> <numericalresponse answer="$computed_response">
<responseparam type="tolerance" default="15%"/> <responseparam type="tolerance" default="15%"/>
<textline /> <formulaequationinput />
</numericalresponse> </numericalresponse>
</p> </p>
<p>Enter the number of fingers on a human hand: <p>Enter the number of fingers on a human hand:
<numericalresponse answer="5"> <numericalresponse answer="5">
<textline /> <formulaequationinput />
</numericalresponse> </numericalresponse>
</p> </p>
<solution> <solution>
......
...@@ -28,7 +28,7 @@ class CHModuleFactory(object): ...@@ -28,7 +28,7 @@ class CHModuleFactory(object):
<p>The answer is correct if it is within a specified numerical tolerance of the expected answer.</p> <p>The answer is correct if it is within a specified numerical tolerance of the expected answer.</p>
<p>Enter the number of fingers on a human hand:</p> <p>Enter the number of fingers on a human hand:</p>
<numericalresponse answer="5"> <numericalresponse answer="5">
<textline/> <formulaequationinput/>
</numericalresponse> </numericalresponse>
<solution> <solution>
<div class="detailed-solution"> <div class="detailed-solution">
...@@ -114,7 +114,7 @@ class VerticalWithModulesFactory(object): ...@@ -114,7 +114,7 @@ class VerticalWithModulesFactory(object):
<problem display_name="Numerical Input" markdown=" " rerandomize="never" showanswer="finished"> <problem display_name="Numerical Input" markdown=" " rerandomize="never" showanswer="finished">
<p>Test numerical problem.</p> <p>Test numerical problem.</p>
<numericalresponse answer="5"> <numericalresponse answer="5">
<textline/> <formulaequationinput/>
</numericalresponse> </numericalresponse>
<solution> <solution>
<div class="detailed-solution"> <div class="detailed-solution">
...@@ -129,7 +129,7 @@ class VerticalWithModulesFactory(object): ...@@ -129,7 +129,7 @@ class VerticalWithModulesFactory(object):
<problem display_name="Numerical Input" markdown=" " rerandomize="never" showanswer="finished"> <problem display_name="Numerical Input" markdown=" " rerandomize="never" showanswer="finished">
<p>Another test numerical problem.</p> <p>Another test numerical problem.</p>
<numericalresponse answer="5"> <numericalresponse answer="5">
<textline/> <formulaequationinput/>
</numericalresponse> </numericalresponse>
<solution> <solution>
<div class="detailed-solution"> <div class="detailed-solution">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment