[ANN] RJSCallback 0.1


#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


#2

Link Please!

:wink:

-Ezra


#3

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


#4

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


#5

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
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails

_Kevin


#6

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
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails

_Kevin


#7

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:


#8

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:


#9

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


#10

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

productive
counter
is
top-quoting


Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails

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

_Kevin


#11

Joe wrote:

I like top-quoting better.

Alain

bottom
top to
read
we
productive
counter
is
top-quoting


#12

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

Really.


Paul


Rails mailing list
removed_email_address@domain.invalid
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


#13

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