Commit 79174259 by Victor Shnayder

Address Ike's comments.

- change a few comments / strings
- move extract_choices into the ChoiceGroup class
parent b78fb8df
......@@ -265,6 +265,8 @@ class OptionInput(InputTypeBase):
Example:
<optioninput options="('Up','Down')" correct="Up"/><text>The location of the sky</text>
# TODO: allow ordering to be randomized
"""
template = "optioninput.html"
......@@ -288,7 +290,6 @@ class OptionInput(InputTypeBase):
# make list of (option_id, option_description), with description=id
return [(t, t) for t in tokens]
@classmethod
def get_attributes(cls):
"""
......@@ -344,14 +345,15 @@ class ChoiceGroup(InputTypeBase):
else:
raise Exception("ChoiceGroup: unexpected tag {0}".format(self.tag))
self.choices = extract_choices(self.xml)
self.choices = self.extract_choices(self.xml)
def _extra_context(self):
return {'input_type': self.html_input_type,
'choices': self.choices,
'name_array_suffix': self.suffix}
def extract_choices(element):
@staticmethod
def extract_choices(element):
'''
Extracts choices for a few input types, such as ChoiceGroup, RadioGroup and
CheckboxGroup.
......@@ -424,6 +426,9 @@ registry.register(JavascriptInput)
class TextLine(InputTypeBase):
"""
A text line input. Can do math preview if "math"="1" is specified.
If the hidden attribute is specified, the textline is hidden and the input id is stored in a div with name equal
to the value of the hidden attribute. This is used e.g. for embedding simulations turned into questions.
"""
template = "textline.html"
......@@ -438,8 +443,7 @@ class TextLine(InputTypeBase):
return [
Attribute('size', None),
# if specified, then textline is hidden and input id is stored
# in div with name=self.hidden. (TODO: is this functionality used by anyone?)
Attribute('hidden', False),
Attribute('inline', False),
......@@ -537,7 +541,7 @@ class CodeInput(InputTypeBase):
]
# pulled out for testing
submitted_msg = ("Your file(s) have been submitted; as soon as your submission is"
submitted_msg = ("Submitted. As soon as your submission is"
" graded, this message will be replaced with the grader's feedback.")
@classmethod
......
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