Jquery red rover

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 %><% end -%>


    <%= @group %> Members


    <% for m in Group.find(‘admins_all’).memberlist %>
  • <%= m
    %>
  • <% end %>

js

$(function() {
$( “[id^=moveable]” ).draggable();
$( “#droppable2” ).droppable({
drop: function( event, ui ) {
$( this )
.addClass( “ui-state-highlight” )
$( “

  • ” ).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

    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 W. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    [email protected]
    1.800.869.6908 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Need help communicating between generations at work to achieve your
    desired success? Let us help!

  • This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

    | Privacy Policy | Terms of Service | Remote Ruby Jobs