[ANN] RJSCallback 0.1

Announcing RJSCallback 0.1

The RJS Callback plugin is being developed to provide Ruby On Rails with
the ability to easily call RJS templates for the various callbacks
associated with AJAX function calls (e.g., :before, :loading,
:complete).

Currently this plugin automatically detects, loads, and renders RJS
templates with specific names and inserts them in the appropriate spot
in remote_function calls.

The templates follow a specific naming convention…


‘shared/_#{callback}.rjs’ will be used for the ‘callback’ of all AJAX
calls.

‘shared/#{action}_#{callback}.rjs’ will be used for all 'callback’s from
all controllers generated to the ‘action’ method

‘views/controller/_#{callback}.rjs’ will be used for the callback of all
AJAX calls in a particular controller

‘views/controller/#{action}_#{callback}.rjs’ will be used for a specific
controller/action/callback combination.

Manually specified callbacks in any remote_function calls will override
these template files.

The biggest drawback to this approach right now is that this plugin
scans for available files for EACH instance of an AJAX call every time a
page is rendered. Even if the resulting scripts are the same. If you
have a lot of AJAX calls, or if your RJS template is complicated, this
could make your HTML pretty messy.

Future versions will hopefully improve the performance a bit and
suggestions of how to accomplish this are welcome.

Standard disclaimers apply, use at your own risk, may cause rashes if
used improperly.
It’s also probably full of bugs
MIT Licence

_Kevin

Link Please!

:wink:

-Ezra

Ezra Z. wrote:

Link Please!

:wink:

-Ezra

Prolly this:
http://rjscallback.rubyforge.org/wiki/wiki.pl?HomePage

And @ RubyForge:
http://rubyforge.org/projects/rjscallback/

Joe

Kevin

Announcing RJSCallback 0.1

The RJS Callback plugin is being developed to provide Ruby On Rails with
the ability to easily call RJS templates for the various callbacks
associated with AJAX function calls (e.g., :before, :loading, :complete).

In a Ajax heavy project, I replaced all the tiny RJS files by inline RJS
calls because it was much easier to maintain : all the code in one - or
2 - places.

Question: wouldn’t you solution trigger a RJS file population explosion,
and aggravate the situation?

Alain

Yeah, those are the right ones… Duh.

On Thursday, May 04, 2006, at 3:47 AM, Joe wrote:

And @ RubyForge:
http://rubyforge.org/projects/rjscallback/

Joe


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


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

_Kevin

Quite possibly. It would depend on how you used it.
It certainly isn’t ideal for every circumstance.

The way I use it is to define one RJS template file for a particular
type of action… for example, all the calls to redraw a table could use
the ‘shared/list_before.rjs’ callback. This would result in consistent
behavior across controllers and would DRY things up a bit since you
would only have to maintain the RJS template in one place.

In other words, it gives you the ability to make the AJAX actions more
consistent and easy to implement. Using this approach, I put all the
fancy transitions in the callback templates and have the normal RJS
template handle all the DOM manipulation and content rendering.

If you really wanted to you could define a separate RJS template for
every controller/action/callback combo, but I wouldn’t recommend that.

On Thursday, May 04, 2006, at 11:12 AM, Alain R. wrote:

In a Ajax heavy project, I replaced all the tiny RJS files by inline RJS
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

_Kevin

On 4 May 2006, at 13:28, Kevin O. wrote:

Quite possibly. It would depend on how you used it.
It certainly isn’t ideal for every circumstance.

Top-quoting is at least half as annoying as spam. Just FYI, but
thanks for RJSCallback all the same. :slight_smile:

I like top-quoting better.

Joe

Paul R. wrote:

On 4 May 2006, at 13:28, Kevin O. wrote:

Quite possibly. It would depend on how you used it.
It certainly isn’t ideal for every circumstance.

Top-quoting is at least half as annoying as spam. Just FYI, but
thanks for RJSCallback all the same. :slight_smile:

Sometimes I like it on top…

Joe wrote:

Quite possibly. It would depend on how you used it.
It certainly isn’t ideal for every circumstance.

Top-quoting is at least half as annoying as spam. Just FYI, but
thanks for RJSCallback all the same. :slight_smile:

…and sometimes I like it on the bottom.

:slight_smile:

b

On Friday, May 05, 2006, at 11:07 AM, Alain R. wrote:

productive
counter
is
top-quoting


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

Almost as counter productive as arguing about it on a mailing list.

_Kevin

Joe wrote:

I like top-quoting better.

Alain

bottom
top to
read
we
productive
counter
is
top-quoting

On Friday, May 05, 2006, at 3:19 PM, Paul R. wrote:

Really.


Paul


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

Not complaining about your comment, just about how this thread has
degenerated into noise about posting styles (Notice that I didn’t top
quote this one).

I do appreciate the thanks. Feedback regarding RJSCallback would be
welcome as well.

_Kevin

On 5 May 2006, at 13:53, Kevin O. wrote:

Almost as counter productive as arguing about it on a mailing list.

I wasn’t arguing, just trying to say “hey, can you not do that, we’re
processing several hundred mails a day here and you’re making it a
little harder”

But I really meant it when I said thanks for RJSCallback.

Really.


Paul