Can :before and :success move from view file into .rjs file?

Within the RJS template is there a way to specify when the visual_effect
should occur?

I’m trying not to repeat the :before and :success blind_down
visual_effect statements throughout my views.

It seems like the rjs templates can only take visual effects statements
in the form of
page.visual_effect :blind_up, ‘divname’. I can’t figure out how to add
:before or :success to this statement.

Thanks,
DAN

On Wednesday, August 09, 2006, at 2:16 AM, DAN wrote:

Thanks,
DAN


Posted via http://www.ruby-forum.com/.


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

Try out this plugin.
http://rubyforge.org/projects/rjscallback

It allows you to define rjs template files for the various callbacks and
then links to them when appropriate.

_Kevin
www.sciwerks.com

DAN wrote:

Within the RJS template is there a way to specify when the visual_effect
should occur?

I’m trying not to repeat the :before and :success blind_down
visual_effect statements throughout my views.

It seems like the rjs templates can only take visual effects statements
in the form of
page.visual_effect :blind_up, ‘divname’. I can’t figure out how to add
:before or :success to this statement.

By :before do you mean :loading?

If so, all these pre-response phases must be encoded in the view.
To avoid repeating your effect calls you can put them in your own
Javascript function, in an included .js file, and then just refer
to your function in your remote calls.

RJS is just an easy way to build an executable response
sequence to Ajax requests. So to restrict execution of the
RJS effects to :success you need to ensure that this RJS is only
built if everything went OK, and if it didn’t, to either render
some other RJS, or to set the response status to 500, render nothing,
and signal failure in some way e.g.:

 :failure => "alert('Remote function failed')"


We develop, watch us RoR, in numbers too big to ignore.

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