Trying to get to the end of my jquery experiment and have a few basic questions.
I''m thinking that I don''t need a heavyweight like backbone.js
- at this point, my interest is primarily to manage group memberships and being
able to drag and drop between them.
This is working...
### view
<div class="block" id="member_management">
<ul id="unassigned_users">
<h4>Unassigned People</h4>
<% for p in @unassigned -%><li id="moveable-<%= p
%>" class="ui-widget-content"><%= p
%></li><% end -%>
</ul>
<ul id="droppable2" class="ui-widget-header"
align="left">
<h4><%= @group %> Members</h4>
<% for m in Group.find(''admins_all'').memberlist
%><li><%= m %></li><% end %>
</ul>
</div>
### js
$(function() {
$( "[id^=moveable]" ).draggable();
$( "#droppable2" ).droppable({
drop: function( event, ui ) {
$( this )
.addClass( "ui-state-highlight" )
$( "<li></li>" ).text( ui.draggable.text()
).appendTo( this );
}
});
});
and it definitely adds the the dragged ''user'' to a new LI in
the target but of course, what I want to actually do is send this to my
controller, update the records and refresh the view. So my questions...
1 - how do I send this value to :controller => ''people'',
:action => ''update_memberships'', :id => whatever (Is it
ui.draggable.text() ? )
2 - Is there a way to update just the <div> or must I do as I did with
Rails 1.26 and render :partial => ''some_partial'' for on
screen updates?
3 - I''ve been reading all sorts of jquery stuff (books, web pages,
etc.) which got me this far but I''m uncertain how to properly send data
back to rails controllers... is there a particular web page that explains this
to me?
--
Craig White ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
craig.white-wmL3h9Ogt9Bhl2p70BpVqQ@public.gmane.orgm
1.800.869.6908 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ www.ttiassessments.com
Need help communicating between generations at work to achieve your desired
success? Let us help!
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.