change exercises
[edumed.git] / wtem / templates / wtem / exercises / open.html
index f12e052..b81f08c 100644 (file)
@@ -1,7 +1,7 @@
 <div class="exercise-wtem" data-type="open" data-id="{{exercise.id}}">
 
 <div class="exercise-wtem" data-type="open" data-id="{{exercise.id}}">
 
-    <h3>Zadanie {{no}}</h3>
-        
+    {% include "wtem/exercises/exercise_no.html" %}
+
     <div class="description">
         {% autoescape off %}
         {% for para in exercise.description %}
     <div class="description">
         {% autoescape off %}
         {% for para in exercise.description %}
         {% endautoescape %}
     </div>
 
         {% endautoescape %}
     </div>
 
+    {% if exercise.instruction %}
+        <span class="instruction">{{ exercise.instruction }}</span>
+    {% endif %}
+
     {% if exercise.fields %}
         {% for field in exercise.fields %}
             <div class="wtem-open-field">
     {% if exercise.fields %}
         {% for field in exercise.fields %}
             <div class="wtem-open-field">
-                <label class="wtem-caption">{{field.caption}}</label>
-                <textarea style="width: 100%;" rows="{{field.rows|default:10}}" data-field-id="{{field.id}}" {% if field.max_length %}maxlength="{{field.max_length}}"{% endif %}></textarea>
+                <label class="wtem-caption">{{field.caption|safe}} <span class="label_suffix"></span></label>
+                {% if field.type == 'file' %}
+                    <div style="margin: 15px auto; width:300px;">
+                        <input style="float: left;" type="file" name="attachment_for_{{exercise.id}}__{{field.id}}"/>
+                        <div style="clear:both;"></div>
+                    </div>
+                {% else %}
+                    <textarea style="width: 100%;" rows="{{field.rows|default:10}}" data-field-id="{{field.id}}"
+                              {% if field.max_length %}maxlength="{{field.max_length}}"{% endif %}
+                              {% if field.input_id %}id="{{field.input_id}}"{% endif %}></textarea>
+                {% endif %}
             </div>
         {% endfor %}
     {% else %}
             </div>
         {% endfor %}
     {% else %}
-        <textarea style="width: 100%; margin-top:10px;" rows="{{field.rows|default:10}}" {% if field.max_length %}maxlength="{{field.max_length}}"{% endif %}></textarea>
+        <textarea style="width: 100%; margin-top:10px;" rows="{{field.rows|default:10}}"
+                  {% if field.max_length %}maxlength="{{field.max_length}}"{% endif %}
+                  {% if field.input_id %}id="#{{field.input_id}}"{% endif %}></textarea>
     {% endif %}
 
     {% if exercise.description_after %}
     {% endif %}
 
     {% if exercise.description_after %}
@@ -35,4 +50,4 @@
         </div>
     {% endif%}
 
         </div>
     {% endif%}
 
-</div>
\ No newline at end of file
+</div>