I've carefully read all of the responses to this thread (keep em coming), and believe that my solution will work very well for almost all of the concerns expressed here.
I'll announce more details about the mechanism and syntax sometime in the next week or so, but I believe everyone will be very satisfied.
-- Yehuda
<div><span class="gmail_quote">On 2/21/07, <b class="gmail_sendername">Peter De Berdt</b> <<a href="mailto:peter.de.berdt@gmail.com">
peter.de.berdt@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
> I realize there is a group of people who'd like to just write everything in Ruby (i.e. get to
> use javascript without having to know javascript), but I think that's a red herring.
That's not the main issue, but without MinusMOR, your RJS files would
always look like
page << "some_jquery_code;"
page << "some_jquery_code;"
I don't mind writing JavaScript myself either, but in order for jQuery
for Rails to be easily integrated into existing applications, the
helpers are a must. I have my fair share of applications that combine
both helpers and sporadically some custom JS code, but I don't want to
refactor all my RJS and view code just for being able to integrate
jQuery instead of proto/script. If it could be plug-and-play (and not
plug-and-pray) I wouldn't doubt and just deploy new versions of my
AJAXed apps just for jQuery.
> Here are the main issues I've run into:
> + unobtrusively including js specific to a view
... and a Rails way of keeping the behavior in a separate file
(separate behavior from representation). What I would do now, is
either use a partial to render the JS in the header and put it in my
layout or just add JS files to the public/javascripts directory, but I
don't find it very Rails-like, it doesn't feel like the best solution.
> So, in whatever.rhtml, do something like:
>
> <% javascript :file => 'path/to/plugin.js' %>
> <% javascript :text => %{ $('p').css('color','blue'); } %>
>
Whatever...
> <% javascript :text => %{ $('p').css('font-size', '2em'); }% %>
>
> And get:
>
> <html>
> <head>
> <script type="text/javascript" src="
whatever.js"></script>
> </head>
> <body>
>
Whatever...
> </body>
> </html>
Looks like Luke Redpath's UJS4Rails way of doing things :-) It's not a
bad solution, but UJS4Rails has introduced unreliable behavior in some
of the apps I have been working on.
_______________________________________________
jQuery mailing list
<a href="mailto:discuss@jquery.com">
discuss@jquery.com</a>
<a href="http://jquery.com/discuss/">
http://jquery.com/discuss/</a></blockquote></div>
<br clear="all">
--
Yehuda Katz
Web Developer | Wycats Designs
(ph) 718.877.1325
_______________________________________________
jQuery mailing list
discuss@jquery.comhttp://jquery.com/discuss/