Exercise of type uporzadkuj
authorAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Thu, 31 Oct 2013 12:08:55 +0000 (13:08 +0100)
committerAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Wed, 15 Jan 2014 10:18:53 +0000 (11:18 +0100)
wtem/static/wtem/edumed.coffee
wtem/static/wtem/edumed.js
wtem/templates/wtem/exercises/edumed_uporzadkuj.html [new file with mode: 0644]

index cb1920b..f4c5c28 100644 (file)
@@ -297,6 +297,12 @@ class Uporzadkuj extends Exercise
     for p in pkts
       parent.prepend(p)
 
     for p in pkts
       parent.prepend(p)
 
+  get_answer: (question) ->
+    answer = []
+    $(".question-piece", @element).each (i, qpiece) =>
+      answer.push($(qpiece).attr('data-pos'))
+    return answer
+
 
 # XXX propozycje="1/0"
 class Luki extends Exercise
 
 # XXX propozycje="1/0"
 class Luki extends Exercise
index 18ed499..df98753 100644 (file)
       return _results;
     };
 
       return _results;
     };
 
+    Uporzadkuj.prototype.get_answer = function(question) {
+      var answer,
+        _this = this;
+      answer = [];
+      $(".question-piece", this.element).each(function(i, qpiece) {
+        return answer.push($(qpiece).attr('data-pos'));
+      });
+      return answer;
+    };
+
     return Uporzadkuj;
 
   })(Exercise);
     return Uporzadkuj;
 
   })(Exercise);
diff --git a/wtem/templates/wtem/exercises/edumed_uporzadkuj.html b/wtem/templates/wtem/exercises/edumed_uporzadkuj.html
new file mode 100644 (file)
index 0000000..dad28f3
--- /dev/null
@@ -0,0 +1,22 @@
+<div class="exercise uporzadkuj" data-type="uporzadkuj">
+
+    <h3>Zadanie {{no}}</h3>
+
+    <div class="question" data-no="1">
+        <div class="description">
+        {% for para in exercise.description %}
+            <p class="paragraph">
+                {{para}}
+            </p>
+        {% endfor %}
+        </div>
+
+        <ol class="lista num ui-sortable">
+            {% for item in exercise.items %}
+                <li class="question-piece" data-pos="{{item.id}}">{{item.text}}</li>
+            {% endfor %}
+        </ol>
+
+    </div>
+</div>
+