Do they belong to you? Claim these comments.
Eric Anderson
Is this you? Claim Profile »
1 year ago
in You should be on ruby-talk on Virtuous Code
I also got into Ruby before Rails (although only by a period of a few months so I was still a Ruby newbie when Rails first started making news). I also have experience the "Ruby can do XYZ" with my responding "didn't everybody know that". I also enjoyed the discussion on ruby-talk for a long while. But as Ruby continues to get more popular the volume on the mailing list got so high that I couldn't keep up with it. The content is good but the volume is just too much to keep up with. Seems to be a common problem on the best newgroups. Wish there was a way to combat that volume in a sensible way.
1 year ago
in Using RJS generator methods in raw JS on The Pug Automatic
I know this post is old but thought I would post an alternate solution for anybody else that comes along this post.
I had a very similar problem that I was solving with delay as well. It worked because the timing was right but it didn't seem elegant as it could be. Then I found the update_page helper which is great for putting JavaScript on HTML event handlers and for RJS. The following is a snippet example that will fade out some info, replace it with new info and fade it back in without using delay:
The only thing to make this nice is to create a helper that will wrap the JavaScript in a function. Something like:
Then you can make your RJS just be:
I had a very similar problem that I was solving with delay as well. It worked because the timing was right but it didn't seem elegant as it could be. Then I found the update_page helper which is great for putting JavaScript on HTML event handlers and for RJS. The following is a snippet example that will fade out some info, replace it with new info and fade it back in without using delay:
display_actions = update_page do |p|
p.replace_html 'family-info', :partial => @event
p.visual_effect :appear, 'family-info'
end
page.visual_effect :fade, 'family-info', :to => 0.01,
:afterFinish => "function() {#{display_actions}}"
The only thing to make this nice is to create a helper that will wrap the JavaScript in a function. Something like:
def javascript_function(code)
"function() {#{code}}"
end
Then you can make your RJS just be:
display_actions = update_page do |p|
p.replace_html 'family-info', :partial => @event
p.visual_effect :appear, 'family-info'
end
page.visual_effect :fade, 'family-info', :to => 0.01,
:afterFinish => javascript_function(display_actions)