Looking at this again, I realize that there are a couple of problems
with this approach.
It looks like what you want to do is fade out the element, replace it,
and then make it appear.
The correct way to do this with a remote call would be to fade the
element using a ‘before’ callback, and then let the RJS template worry
about the replacement and appearance.
If you put everything into the RJS template, then the browser waits
until the request completes before it does anything.
The real problem here is that RJS templates only get called at one point
in the process. You can’t specify an RJS template to be called as part
of the ‘before’ callback unless you do it by hand.
I realize this is a contrived example, so if you have an example that
runs into sync’ing problems that doesn’t use visual effects, I’d like to
see it.
By the way… one way to implement the OP’s RJS template would be
this…
page.visual_effect :fade, 'comment_error', :duration=>0.5
page.delay(0.5) do
page.replace_html 'comment_error',
“#{error_messages_for(‘comment’)}”
page.visual_effect :appear, ‘comment_error’, :duration=>0.5
end
I have some ideas about how to have rails load a RJS template before
calling the action. I’ll put together a plugin for testing once I get
it worked out.
On Thursday, April 06, 2006, at 12:43 AM, charlie bowman wrote:
page.visual_effect :appear, ‘comment_error’, :duration => 0.5
–
Posted via http://www.ruby-forum.com/.
Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails
_Kevin