views:

186

answers:

1

Hi all,

users can be dragged to nodes to move or copy a user from one node to another node. I have a problem with how I send the variables to user move and copy methods in userscontrol.

The drop zone is defined as:

<%=drop_receiving_element "move_drop_zone_"+node.id.to_s, 
  :update => "users", 
  :url => move_user_path(:id => node.id),
  :method => :put,
  :accept => "move_user" %>

The draggable user in a node is defined as:

<span id="move_user_<%=user.id%>_<%= node.id.to_s %>" class="move_user" >
  <%=image_tag('move_user.png') %>
</span> 
<%= draggable_element "move_user_" + user_node, :revert => true %>

I also added to routes:

map.resources :users, :member => { :move => :put, :copy => :put }

The problem is that I don't know how to pass the user id and from node id. Since it's a put operation I only see the id (which is the target node id) defined in the url of drop_receiving_element.

Thanks, Stijn

A: 

Is it possible that you could use the :with parameter of drop_receiving_element?

drop_receiving_element Documentation

Oliver N.
:with - A JavaScript expression specifying the parameters for the XMLHttpRequest. Any expressions should return a valid URL query string.If I understand it correctly :with just passes extra parameters? The problem is that I don't see how I can know the user_id and the from_node_id since they are part of the draggable_element and not the receiving_element.
Tarscher