fix hadnles
authorMarcin Koziej <marcin.koziej@nowoczesnapolska.org.pl>
Fri, 8 Feb 2013 13:34:37 +0000 (14:34 +0100)
committerMarcin Koziej <marcin.koziej@nowoczesnapolska.org.pl>
Fri, 8 Feb 2013 13:34:37 +0000 (14:34 +0100)
lib/librarian
redakcja/static/edumed/js/edumed.coffee
redakcja/static/edumed/js/edumed.js

index 1ffcf32..a1e43b7 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 1ffcf32a8d795681f54bd125ca45e908da5ed3fb
+Subproject commit a1e43b7bba2a0c7cf33280143bb49af3fef5d0d0
index 14c700c..59430a2 100644 (file)
@@ -116,13 +116,20 @@ class Exercise extends Binding
     $placeholder.after($added)
     if not $placeholder.hasClass('multiple')
       $placeholder.hide()
     $placeholder.after($added)
     if not $placeholder.hasClass('multiple')
       $placeholder.hide()
+    if $added.is(".add-li")
+      $added.wrap("<li/>")
+
     $added.append('<span class="remove">x</span>')
     $('.remove', $added).click (ev) =>
     $added.append('<span class="remove">x</span>')
     $('.remove', $added).click (ev) =>
-      $added.prev(".placeholder:not(.multiple)").show()
       if not ismultiple
         $($added.data('original')).removeClass('disabled').draggable('enable')
       if not ismultiple
         $($added.data('original')).removeClass('disabled').draggable('enable')
+
+      if $added.is(".add-li")
+        $added = $added.closest('li')
+      $added.prev(".placeholder:not(.multiple)").show()
       $added.remove()
 
       $added.remove()
 
+
 ## XXX co z issortable?
   dragging: (ismultiple, issortable) ->
     $(".question", @element).each (i, question) =>
 ## XXX co z issortable?
   dragging: (ismultiple, issortable) ->
     $(".question", @element).each (i, question) =>
index cc7b9e1..e3878be 100644 (file)
       if (!$placeholder.hasClass('multiple')) {
         $placeholder.hide();
       }
       if (!$placeholder.hasClass('multiple')) {
         $placeholder.hide();
       }
+      if ($added.is(".add-li")) {
+        $added.wrap("<li/>");
+      }
       $added.append('<span class="remove">x</span>');
       return $('.remove', $added).click(function(ev) {
       $added.append('<span class="remove">x</span>');
       return $('.remove', $added).click(function(ev) {
-        $added.prev(".placeholder:not(.multiple)").show();
         if (!ismultiple) {
           $($added.data('original')).removeClass('disabled').draggable('enable');
         }
         if (!ismultiple) {
           $($added.data('original')).removeClass('disabled').draggable('enable');
         }
+        if ($added.is(".add-li")) {
+          $added = $added.closest('li');
+        }
+        $added.prev(".placeholder:not(.multiple)").show();
         return $added.remove();
       });
     };
         return $added.remove();
       });
     };