Commit cc7f7910 by Arthur Barrett

parse xml for annotationinput

parent 07f64abb
......@@ -968,11 +968,25 @@ class AnnotationInput(InputTypeBase):
tags = ['annotationinput']
def setup(self):
# Pull out all the things from the xml
self.text = 'text'
self.comment_prompt = 'comment_prompt'
self.tag_prompt = 'tag_prompt'
self.options = [(0, 'blue'), (1, 'green'), (2, 'red')]
xml = self.xml
self.text = xml.findtext('./text')
self.comment_prompt = xml.findtext('./comment_prompt')
self.tag_prompt = xml.findtext('./tag_prompt')
self.options = self._find_options()
def _find_options(self):
options = []
index = 0
for option in self.xml.findall('./options/option'):
options.append({
'id': index,
'tag': option.text,
'description': option.get('description', ''),
'score': option.get('score', 0)
})
index += 1
return options
def _extra_context(self):
return {'text': self.text,
......
......@@ -14,8 +14,8 @@ TODO: make the textline hidden once it all works
Value: ${value}
% for option_id, option_description in options:
<p>${option_id}, ${option_description}</p>
% for option in options:
<p>${option['id']}, ${option['tag']}, ${option['description']}, ${option['score']}</p>
% endfor
<span id="answer_${id}"></span>
......
......@@ -15,7 +15,6 @@
<div class="annotatable-problem-controls">
<button class="button annotatable-problem-save">Save</button>
<button class="button annotatable-problem-submit">Submit</button>
<a class="annotatable-problem-return" href="javascript:void(0);" data-discussion-id="${problem['discussion_id']}">Return to annotation</a>
</div>
</div>
<div class="annotatable-problem-footer">
......
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