Skip to content
Browse files

fixes for drag'n'drop

  • Loading branch information...
1 parent dfc5643 commit dc6310c4b42d375e987daab900863806f8227998 @elser committed
View
16 lib/netzke/basepack/tree_panel/javascripts/tree_panel.js
@@ -12,6 +12,18 @@
this.nodeSelected({node: e.id});
}, this);
this.on('beforenodedrop', this.onReceiveDragAndDrop, this);
+ this.on('nodedragover', function(dragOverEvent){
+ // do not invite users to drop teasers, lists or items in between nodes
+ // FIXME: user has to drag over text exactly. if we disable this function, then the user still has to drag over text exactly,
+ // except if they are not on exact text it goes in between nodes. so this issue occurs no matter.
+ // this does not seem to be an issue with our css (i disabled ours and tested).
+ //var isDraggedTeaserListOrItem = dragOverEvent.data.selections; // if it's from the grid, it's a list, teaser or digital item
+ var isDragAboveOrBelow = dragOverEvent.point != "append"; // it is above or below the node
+
+ if(isDragAboveOrBelow) {
+ return false;
+ }
+ });
},
onContextMenu: function(node){
@@ -87,13 +99,13 @@
// reset cancel flag
e.cancel = false;
// setup dropNode (it can be array of nodes)
- e.dropNode = [];
+ //e.dropNode = [];
for(var i = 0; i < e.data.selections.length; i++) {
// get record from selectons
var r = e.data.selections[i];
this.nodeReceivedDragAndDrop({node: e.target.id, draggable: r.id});
}
- // we want Ext to complete the drop, thus return true
+ // we don't want Ext to complete the drop, thus return false
return true;
}
// if we get here the drop is automatically cancelled by Ext
View
2 test/rails_app/app/components/folder_tree_drag_n_drop.rb
@@ -4,7 +4,7 @@ class FolderTreeDragNDrop < Netzke::Basepack::BorderLayoutPanel
:name => "folder_tree",
:region => :west,
:width => '50%',
- :enable_d_d => true,
+ :enable_drop => true,
:dd_group => 'grid2tree',
},
{

0 comments on commit dc6310c

Please sign in to comment.
Something went wrong with that request. Please try again.