Commit 5cecd0ac by pmitros

Merge pull request #8 from MITx/textline_size

Input size now works
parents 79476eca 75f5a1cf
...@@ -8,7 +8,8 @@ class textline(object): ...@@ -8,7 +8,8 @@ class textline(object):
def render(element, value, state): def render(element, value, state):
eid=element.get('id') eid=element.get('id')
count = int(eid.split('_')[-2])-1 # HACK count = int(eid.split('_')[-2])-1 # HACK
context = {'id':eid, 'value':value, 'state':state, 'count':count} size = element.get('size')
context = {'id':eid, 'value':value, 'state':state, 'count':count, 'size': size}
html=render_to_string("textinput.html", context) html=render_to_string("textinput.html", context)
return etree.XML(html) return etree.XML(html)
......
<section class="text-input"> <section class="text-input">
<input type="text" name="input_${id}" id="input_${id}" value="${value}" /> <input type="text" name="input_${id}" id="input_${id}" value="${value}"
% if size:
size="${size}"
% endif
/>
<span id="answer_${id}"></span> <span id="answer_${id}"></span>
......
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