From 3e4d96cd7fdd08910887be91ead79e446a96fe53 Mon Sep 17 00:00:00 2001 From: Marcin Koziej Date: Fri, 8 Feb 2013 14:28:29 +0100 Subject: [PATCH] isnert li when dragging handles --- lib/librarian | 2 +- redakcja/static/edumed/js/edumed.coffee | 9 ++++++++- redakcja/static/edumed/js/edumed.js | 8 +++++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/lib/librarian b/lib/librarian index 11d86305..f921a036 160000 --- a/lib/librarian +++ b/lib/librarian @@ -1 +1 @@ -Subproject commit 11d863057b43462248572daed7c8fc698d573b3d +Subproject commit f921a036ff55ff3a43ad2c93c8d8eb808fd54724 diff --git a/redakcja/static/edumed/js/edumed.coffee b/redakcja/static/edumed/js/edumed.coffee index 14c700ce..59430a29 100644 --- a/redakcja/static/edumed/js/edumed.coffee +++ b/redakcja/static/edumed/js/edumed.coffee @@ -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("
  • ") + $added.append('x') $('.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) => diff --git a/redakcja/static/edumed/js/edumed.js b/redakcja/static/edumed/js/edumed.js index cc7b9e12..e3878be5 100644 --- a/redakcja/static/edumed/js/edumed.js +++ b/redakcja/static/edumed/js/edumed.js @@ -152,12 +152,18 @@ if (!$placeholder.hasClass('multiple')) { $placeholder.hide(); } + if ($added.is(".add-li")) { + $added.wrap("
  • "); + } $added.append('x'); 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(); }); }; -- 2.20.1