Hi all,
I finally got what I wanted to happen, here’s the source for everyones
reference should anyone else need to do something similar…
#list.rhtml
Listing all positions
<%= javascript_include_tag :defaults %>Job Title | Salary | Location | Action |
---|
<%= link_to ‘Previous page’, { :page => @position_pages.current.previous
} if @position_pages.current.previous %>
<%= link_to ‘Next page’, { :page => @position_pages.current.next } if
@position_pages.current.next %>
<%= link_to ‘New position’, :action => ‘new’ %>
#_position.rhtml (partial)
#_close.rhtml partial
The position [ <%= @position.job_title %> ] is now closed.
#close method of positions_controller
def close
@position = Position.find(params[:id])
@position.close
if @position.save
render :partial => ‘close’
end
end
This should give you an updated info div and a change of text-style
for the id specified in the :complete param. If you wanted to highlight
(Yellow fade) instead of line-through, simply replace
:complete => “$(’#{position.id}’).style.textDecoration = ‘line-through’”
with
:complete => visual_effect(:highlight, position.id)
Hope this helps other people stuck with ajax and rails…
Thanks to Thomas F. for pointing me in teh right direction (and
scriptacuolus)
Kev