Changing visual_effect defaults


#1

what is the correct syntax for changing an effect like :highlight? i
tried looking through the api, and found it, but i can’t seem to get it
right.

i want to change the start color of visual_effect(:highlight,
‘user-list’). i tried visual_effect(:highlight, ‘user-list’, :startcolor
= ‘#990000’) and several other variations of that, but i can’t seem to
get it right.


#2

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:

<%= @user_list.full_name %>'s Tasks

    <% @user_list.tasks.each do |task| -%>
  • <%= task.task_name %>
  • <% end %>
<%= 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