textbox.html 1.33 KB
Newer Older
1
<section id="textbox_${id}" class="textbox">
2
  <textarea rows="${rows}" cols="${cols}" name="input_${id}" id="input_${id}">${value|h}</textarea>
3 4 5 6 7

  <span id="answer_${id}"></span>

  % if state == 'unsubmitted':
  <span class="unanswered" style="display:inline-block;" id="status_${id}"></span>
8
  % elif state == 'correct':
9 10 11 12 13 14 15 16 17
  <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
  <br/>
  <span class="debug">(${state})</span>
  <br/>
18
  <span class="message">${msg|n}</span>
19 20
  <br/>

21 22 23 24 25 26 27 28 29
  <br/>

  <script type="text/javascript" src="${ settings.LIB_URL }CodeMirror/codemirror.js"></script>
  <script type="text/javascript" src="${ settings.LIB_URL }CodeMirror/python.js"></script>
  <link rel="stylesheet" href="${ settings.LIB_URL }CodeMirror/codemirror.css" />
  <script>
    // Note: We need to make the area follow the CodeMirror for this to work.
    $(function(){
      var cm = CodeMirror.fromTextArea(document.getElementById("input_${id}"), {
30 31 32 33
        % if linenumbers == 'true':
        lineNumbers: true,
        % endif
        mode: "${mode}"
34 35 36 37 38 39 40
      });
    });
  </script>
  <style type="text/css">
    .CodeMirror {border-style: solid;
      border-width: 1px;}
  </style>
41
</section>