Re: How to check the existence of div?

On 20 May 2008, at 11:53, Nathan E. wrote:

then?
Two ways…simple way is simply write the function in pure javascript
and then invoke it in the rjs…i.e page.call “someFunction”,
“param1”,
“param2”

but what if I REALLY want to be able to dynamically evaluate ruby code
as part of the template…I have used a plugin called MinusMOR

http://agilewebdevelopment.com/plugins/minusmor

Neat. Not surprising to see yet another excellent thing from Dan
Webb!. With the latest stuff I’ve been I doing I’ve taking to just the
writing the javascript statically.
Actions render :json (or just html fragments) and the ajax callbacks
on the other side put things together. With a good dose of prototype
javascript isn’t that bad. And I can write better unit tests for my
static javascript than I can for generated javacscript.

Fred


My ramblings: http://www.spacevatican.org

page.select("##{params[:id]}parents").any(elem){|elem|.replace_html
‘blah’}

page.select will return a collection of dom elements that match a css
selector, so the first part of that line is selecting the element with
id=‘xparents’

The second half of the line (*.any(){}) translates to a javascript
iterator on the returned collection. I have not tested that
particular code but I’ve used rjs like it to conditionally update the
browser in the past.

On May 20, 7:01 am, Frederick C. [email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs