editor: finalizing exercise.order drag & drop mechanism
authorAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Thu, 7 Aug 2014 14:16:42 +0000 (16:16 +0200)
committerAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Thu, 14 Aug 2014 14:26:14 +0000 (16:26 +0200)
src/editor/plugins/core/edumed/order/order.less
src/editor/plugins/core/edumed/order/view.js
src/editor/plugins/core/edumed/order/viewItem.html

index 67de8bc..e0c1b52 100644 (file)
@@ -12,7 +12,6 @@
         width: 100%;
         border-radius: 5px;
         background-color: #ddd;
-        -webkit-margin-before: -20px; // compensate for Chrome behavior for ol > li > table
     }
 
     .content {
@@ -34,7 +33,6 @@
         text-align: center;
         border-radius: 0 5px 5px 0;
         padding: 10px 10px;
-        pointer-events: none;
 
         .dragEnter {
             opacity: 0.5;
         width:100%;
     }
 
-    .placeholder-top {
-        margin-left: 25px;
+    ol {
+        margin: 0;
+        counter-reset: edumed-order-counter;
     }
-
-    li {
+    ol li {
+        list-style-type: none;
         cursor: move;
         .dragged {
             opacity: 0.6;
index 8905e7a..a90ded4 100644 (file)
@@ -82,6 +82,7 @@ var OrderExerciseView = function(element) {
 
         this.trigger(this.mode === 'initial' ? 'moveItem' : 'moveAnswer', droppedItem.item, first.item, 'before');
         dropTargets.removeClass('active');
+        e.preventDefault();
     }.bind(this));
 };
 _.extend(OrderExerciseView.prototype, Backbone.Events, {
@@ -150,7 +151,7 @@ var ItemView = function(item, exerciseView) {
 
 
     var dropTargets = this.dom.find('.placeholder'),
-        dragSources = this.dom.find('.wrapper');
+        dragSources = this.dom.find('.handle');
 
     dragSources.on('dragstart', function(e) {
         this.dom.addClass('dragged');
index 1e9b1b1..33e242a 100644 (file)
@@ -1,9 +1,9 @@
 <li>
-    <div class="wrapper" draggable="true">
-        <div class="content"></div>
-        <div class="handle">
+    <div class="wrapper">
+        <div class="handle" draggable="true">
             <i class="icon-resize-vertical icon-white"></i>
         </div>
+        <div class="content"></div>
     </div>
     <div class="placeholder"></div>
 </li>
\ No newline at end of file