isnert li when dragging handles
authorMarcin Koziej <marcin.koziej@nowoczesnapolska.org.pl>
Fri, 8 Feb 2013 13:28:29 +0000 (14:28 +0100)
committerMarcin Koziej <marcin.koziej@nowoczesnapolska.org.pl>
Fri, 8 Feb 2013 13:33:24 +0000 (14:33 +0100)
lib/librarian
redakcja/static/edumed/js/edumed.coffee
redakcja/static/edumed/js/edumed.js

index 11d8630..f921a03 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 11d863057b43462248572daed7c8fc698d573b3d
+Subproject commit f921a036ff55ff3a43ad2c93c8d8eb808fd54724
index 14c700c..59430a2 100644 (file)
@@ -116,13 +116,20 @@ class Exercise extends Binding
     $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.prev(".placeholder:not(.multiple)").show()
       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()
 
+
 ## XXX co z issortable?
   dragging: (ismultiple, issortable) ->
     $(".question", @element).each (i, question) =>
index cc7b9e1..e3878be 100644 (file)
       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.prev(".placeholder:not(.multiple)").show();
         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();
       });
     };