i think i have solved that problem. i ended up with:
visual_effect(:highlight, ''user-list'', {
"startcolor" => "''#990000''" })
but i do have another question. the visual_effect changes the entire
list. how can i extract the id of the item that was moved so that i
could have an effect on just that item?
here is the script i am using -
in my view:
<h2><%= @user_list.full_name %>''s Tasks</h2>
<ul id="user-list">
<% @user_list.tasks.each do |task| -%>
<li id="item_<%= task.id %>">
<%= task.task_name %>
</li>
<% end %>
</ul>
<%= sortable_element ''user-list'',
:url => { :action => ''sort'', :id => @user_list },
:complete => visual_effect(:highlight, ''user-list'', {
"startcolor" =>
"''#990000''" })
%>
in my controller:
def sort
@user_list = User.find(params[:id])
@user_list.tasks.each do |task|
task.position = params[''user-list''].index(task.id.to_s)
+ 1
task.save
end
render :nothing => true
end
--
Posted via http://www.ruby-forum.com/.