Forum: Ruby on Rails Rails AJAX helpers or DIY

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.
Kris@AFM (Guest)
on 2006-05-31 18:49
I've used script.aculo.us before (pre-Rails) to do JS effects like
having a menu link that when clicked shows a sub menu, that kind of
thing.

Now I want to do something very similar but in Rails. Basically I have a
list of summaries displayed in a view. I want to have a link that when
pressed shows the detail.

To do this I would normally have each summary in a DIV, the ID of each
DIV would have a number suffix. The on_click event would pass the suffix
to a JS function which would hide/show (using a script.aculo.us effect)
the relevent DIV containing the detail.

How should I go about this in Rails, in other words is there a helper,
better way of doing it, Javascript views maybe...

Best wishes!
AFM (Guest)
on 2006-06-28 14:38
Kris@AFM wrote:
> I've used script.aculo.us before (pre-Rails) to do JS effects like
> having a menu link that when clicked shows a sub menu, that kind of
> thing.
>
> Now I want to do something very similar but in Rails. Basically I have a
> list of summaries displayed in a view. I want to have a link that when
> pressed shows the detail.
>
> To do this I would normally have each summary in a DIV, the ID of each
> DIV would have a number suffix. The on_click event would pass the suffix
> to a JS function which would hide/show (using a script.aculo.us effect)
> the relevent DIV containing the detail.
>
> How should I go about this in Rails, in other words is there a helper,
> better way of doing it, Javascript views maybe...
>
> Best wishes!

Any thoughts?
Brian H. (Guest)
on 2006-06-28 17:49
(Received via mailing list)
I would say it depends on your goal. There are lots of approaches to
take in
Rails. There are lots of helpers and even a great book on Rails and RJS
from
O'Reilly that you could investigate.

But if you have a timetable, just do it the way you know how and then
refactor it later.

I still tend to use a bit of HTML form tags instead of the helper tags.
:)
This topic is locked and can not be replied to.