Commit 7b06d912 by ichuang

rows specification of textbox input now changes codemirror box height properly

parent 6de7d1f9
......@@ -237,14 +237,15 @@ def textbox(element, value, status, render_template, msg=''):
count = int(eid.split('_')[-2])-1 # HACK
size = element.get('size')
rows = element.get('rows') or '30'
height = str(int(rows) * 10)
cols = element.get('cols') or '80'
mode = element.get('mode') or 'python' # mode for CodeMirror, eg "python" or "xml"
hidden = element.get('hidden','') # if specified, then textline is hidden and id is stored in div of name given by hidden
linenumbers = element.get('linenumbers') # for CodeMirror
if not value: value = element.text # if no student input yet, then use the default input given by the problem
if not value: value = element.text or '' # if no student input yet, then use the default input given by the problem
context = {'id':eid, 'value':value, 'state':status, 'count':count, 'size': size, 'msg':msg,
'mode':mode, 'linenumbers':linenumbers,
'rows':rows, 'cols':cols,
'rows': rows, 'cols': cols, 'height': height,
'hidden' : hidden,
}
html = render_template("textbox.html", context)
......
......@@ -42,6 +42,9 @@
});
</script>
<style type="text/css">
.CodeMirror-scroll {
height: ${height}px;
}
.CodeMirror {border-style: solid;
border-width: 1px;}
</style>
......
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