Commit 688f8914 by kimth

Update filesubmission template to show state

parent 35a461d9
...@@ -13,6 +13,7 @@ Module containing the problem elements which render into input objects ...@@ -13,6 +13,7 @@ Module containing the problem elements which render into input objects
- checkboxgroup - checkboxgroup
- imageinput (for clickable image) - imageinput (for clickable image)
- optioninput (for option list) - optioninput (for option list)
- filesubmission (upload a file)
These are matched by *.html files templates/*.html which are mako templates with the actual html. These are matched by *.html files templates/*.html which are mako templates with the actual html.
...@@ -306,8 +307,7 @@ def filesubmission(element, value, status, render_template, msg=''): ...@@ -306,8 +307,7 @@ def filesubmission(element, value, status, render_template, msg=''):
Upload a single file (e.g. for programming assignments) Upload a single file (e.g. for programming assignments)
''' '''
eid = element.get('id') eid = element.get('id')
context = { 'id': eid, 'state': status, 'msg': msg, }
context = {'id': eid, }
html = render_template("filesubmission.html", context) html = render_template("filesubmission.html", context)
return etree.XML(html) return etree.XML(html)
......
<section id="filesubmission_${id}" class="filesubmission"> <section id="filesubmission_${id}" class="filesubmission">
<input type="file" name="input_${id}" id="input_${id}" /><br /> <input type="file" name="input_${id}" id="input_${id}" /><br />
% if state == 'unsubmitted':
<span class="unanswered" style="display:inline-block;" id="status_${id}"></span>
% elif state == 'correct':
<span class="correct" id="status_${id}"></span>
% elif state == 'incorrect':
<span class="incorrect" id="status_${id}"></span>
% elif state == 'incomplete':
<span class="incorrect" id="status_${id}"></span>
% endif
<span class="debug">(${state})</span>
<br/>
<span class="message">${msg|n}</span>
<br/>
</section> </section>
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