Forum: Ruby on Rails changing visual_effect defaults

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Josh K. (Guest)
on 2006-04-07 17:19
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.
Josh K. (Guest)
on 2006-04-07 17:34
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
This topic is locked and can not be replied to.