Ben Lisbakken
2006-Jul-27 19:45 UTC
[Rails] How do I update a div''s content in the controller?
Without using an RJS, is there a call I can do in the controller? All I want to do is this statement, but in the controller: new Effect.toggle(''notifier_nav'',''appear'', {duration:12.0}); Thanks, Ben Lisbakken -- Posted via http://www.ruby-forum.com/.
Jan Prill
2006-Jul-27 21:16 UTC
[Rails] How do I update a div''s content in the controller?
Hi Ben, please try the following snip from the rails api: Rendering inline JavaScriptGenerator page updates In addition to rendering JavaScriptGenerator page updates with Ajax in RJS templates (see ActionView::Base<http://api.rubyonrails.com/classes/ActionView/Base.html>for details), you can also pass the :update parameter to render, along with a block, to render page updates inline. render :update do |page| page.replace_html ''user_list'', :partial => ''user'', :collection => @users page.visual_effect :highlight, ''user_list'' end And for your case: page << new Effect...your js Haven''t tried it myself... Cheers, Jan On 7/27/06, Ben Lisbakken <lisbakke@gmail.com> wrote:> > Without using an RJS, is there a call I can do in the controller? All I > want to do is this statement, but in the controller: > > new Effect.toggle(''notifier_nav'',''appear'', {duration:12.0}); > > Thanks, > Ben Lisbakken > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060727/1c30e844/attachment.html
Ben Lisbakken
2006-Jul-27 21:28 UTC
[Rails] Re: How do I update a div''s content in the controller?
Jan Prill wrote:> Hi Ben, > > please try the following snip from the rails api: > > Rendering inline JavaScriptGenerator page updates > > In addition to rendering JavaScriptGenerator page updates with Ajax in > RJS > templates (see > ActionView::Base<http://api.rubyonrails.com/classes/ActionView/Base.html>for > details), you can also pass the > :update parameter to render, along with a block, to render page updates > inline. > > render :update do |page| > page.replace_html ''user_list'', :partial => ''user'', :collection => > @users > page.visual_effect :highlight, ''user_list'' > end > > And for your case: > > page << new Effect...your js > > Haven''t tried it myself... > > Cheers, > JanGood stuff, thanks. I ended up just making a helper in application_helper.rb that returned the content of the javascript. A different technique, but achieved the same thing. Thanks Jan, Ben Lisbakken -- Posted via http://www.ruby-forum.com/.
Nathan Herald
2006-Jul-28 16:57 UTC
[Rails] Re: How do I update a div''s content in the controller?
On 2006-07-27 15:45:05 -0400, Ben Lisbakken <lisbakke@gmail.com> said:> Without using an RJSIs there a reason that inline RJS would not work? render :update do |page| page[''notifier_nav''].toggle_appear end This looks like it would work fine. Would have to figure out the duration thing. -- :// Nathan Herald