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 L.

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::Basehttp://api.rubyonrails.com/classes/ActionView/Base.htmlfor
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

Jan P. 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::Basehttp://api.rubyonrails.com/classes/ActionView/Base.htmlfor
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

Good 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 L.

On 2006-07-27 15:45:05 -0400, Ben L.
[email protected] said:

Without using an RJS

Is 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 H.