Not quite sure how to do this?

Everyone’s has to seen this but don’t know what it is called nor where
to start. Take youtube for example, in their comments or tags section
there is a (more) or (less) link that expands and collapses. Is this
AJAX? How would you go about doing this is in Ruby?

It’s JavaScript (probably) and there are various ways to do it - I’d
recomend checking out the Prototype library which makes this kind of
thing easer. Using Prototype you might do something like

this is some text
show hide

Clicking the links will hide and show the ‘thisPanel’ div. Expanding
and contracting is similarly achieved but really depends on the type
of effect you want.

Dale

here’s another way that’s a bit more railsish:

<%= description.truncate(100) %> <%= link_to_function "(more)", f = update_page { |p| p.toggle("description"); p.toggle("description_more") } %>
<%= description %> <%= link_to_function "(less)", f %>

This really isn’t AJAX. It would be, if the “more” description was
being pulled from the server on click.

So the function sits on the top of the view? I never really worked with
Javascripts also. This is all new to me. Also, I was messing around,
not sure, but I have multiple items from a search that I do. But I was
limited to one item only to be able to toggle. I tried putting the
entire item in a div, but couldn’t. Here is what I’m using:

Show Items

That is what I’m doing. I have to use intCount because I have multiple
categories, and under each category are items. So, I want to display
the category, but hide the items and use the more or less. Could you
please elaborate if it is possible to do this?

Eden Li wrote:

here’s another way that’s a bit more railsish:

<%= description.truncate(100) %> <%= link_to_function "(more)", f = update_page { |p| p.toggle("description"); p.toggle("description_more") } %>
<%= description %> <%= link_to_function "(less)", f %>

This really isn’t AJAX. It would be, if the “more” description was
being pulled from the server on click.