Expanding details examples?


#1

I’m currently using page.visual_effect :toggle_appear to toggle the
appearance of details associated with an order. As I am inserting
the detail data prior to making it visible, this method is not
appropriate (it also loads the data on hide).

I was thinking I could change the hide/show href each time it is
clicked, or even store a value on the page and toggle it each time
it’s clicked - but it seems like there must be a better solution.

Here’s my makeshift .rjs template:

page.replace_html “items” + params[:id].to_s, :partial =>
‘order_item’, :collection => @order_items
page.replace_html “item_footer” + params[:id].to_s, :partial =>
‘order_item_form’

page.replace_html “comments” + params[:id], :partial =>
‘order_detail’, :collection => @order_details
page.replace_html “comment_footer” + params[:id].to_s, :partial =>
‘order_comment_form’

page.visual_effect :toggle_appear, ‘item_container’ + params
[:id].to_s, ‘duration’ => 0.5

All of the RJS tutorials / examples I’ve been able to find are quite
basic - is there a good place for information on this stuff?

Thanks in advance,
-Mike