Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
javascript agnostic feature in rails
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  9 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Erwan Barrier  
View profile  
 More options Jan 28, 8:46 am
From: Erwan Barrier <erwan.barr...@gmail.com>
Date: Wed, 28 Jan 2009 05:46:05 -0800 (PST)
Local: Wed, Jan 28 2009 8:46 am
Subject: javascript agnostic feature in rails
Hi,

I'd like to work on the javascript agnostic feature, but need some
clarifications regarding the implementation before digging too deep in
the code.

1) I've seen two propositions do detach the js framework specific code
from the rails core:

  * Yehuda suggested that we have a javascript file for each framework
(prototype.rails.js, jquery.rails.js, etc...) which implement the
helpers. Rails js helpers would generate js code, implemented by
prototype.rails.js or another depending on the choosen framework.

  * Clemens in this post (http://tinyurl.com/carrpv) suggest that we
abstract the js code generation by having an
AbstractJavaScriptGenerator which sits as a parent for
PrototypeGenerator, JQueryGenerator, etc...

IMO Yehuda's approach is more elegant, because as he says, the js is
completely decoupled from the rails core, and anyone can customize the
js helpers to fit their needs, but I'd like to hear your opinions.

2) I don't know for sure what would be the preferred way to distribute
it.
If we go with Clemens' approach, it does make sense to encapsulate a
js plugin as a rails plugin, as it contains ruby code,
but I'm not sure with Yehuda's approach, as it is just some js files.
It could be handled with a set of rake tasks, although I prefer to put
it in a gem to avoid downloading the js files each time I create a
project.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mislav Marohnić  
View profile  
 More options Jan 28, 2:50 pm
From: Mislav Marohnić <mislav.maroh...@gmail.com>
Date: Wed, 28 Jan 2009 20:50:42 +0100
Local: Wed, Jan 28 2009 2:50 pm
Subject: Re: [Rails-core] javascript agnostic feature in rails

On Wed, Jan 28, 2009 at 14:46, Erwan Barrier <erwan.barr...@gmail.com>wrote:

>  * Yehuda suggested that we have a javascript file for each framework
> (prototype.rails.js, jquery.rails.js, etc...) which implement the
> helpers. Rails js helpers would generate js code, implemented by
> prototype.rails.js or another depending on the choosen framework.

So Rails would generate the same set of JavaScript code which would use some
kind of an API abstracting away jQuery and Prototype? Could work in theory,
but then you're ruining the point of difference between JavaScript libraries
-- different APIs.  Prototype and jQuery have -- for the most part -- same
features; their biggest difference is the API which appeals to different
people for different reasons.

If you abstract that away, how will you decide on how this "adapter" thing
feels -- Prototypish or jQuery-ish?


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David Masover  
View profile  
 More options Jan 28, 3:02 pm
From: David Masover <d...@3mix.com>
Date: Wed, 28 Jan 2009 14:02:21 -0600
Local: Wed, Jan 28 2009 3:02 pm
Subject: Re: [Rails-core] Re: javascript agnostic feature in rails

On Wed, Jan 28, 2009 at 1:50 PM, Mislav Marohnić
<mislav.maroh...@gmail.com>wrote:

> On Wed, Jan 28, 2009 at 14:46, Erwan Barrier <erwan.barr...@gmail.com>wrote:

>>  * Yehuda suggested that we have a javascript file for each framework
>> (prototype.rails.js, jquery.rails.js, etc...) which implement the
>> helpers. Rails js helpers would generate js code, implemented by
>> prototype.rails.js or another depending on the choosen framework.

> So Rails would generate the same set of JavaScript code which would use
> some kind of an API abstracting away jQuery and Prototype?

If that's the case... I assume the purpose of these helpers is that we'd
rather be writing Ruby than Javascript. If that's geneally true, I would
think the API would be easier to build and maintain in Ruby than Javascript
-- and it would probably mean the code that ultimately gets sent to the
client is smaller, lighter, and cleaner.

The only advantage I see of building it in Javascript is to also decouple it
from Ruby -- to make a One True Javascript API, which any server-side
framework, in any language, can generate code for.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
DHH  
View profile  
 More options Jan 28, 6:25 pm
From: DHH <david.heineme...@gmail.com>
Date: Wed, 28 Jan 2009 15:25:38 -0800 (PST)
Local: Wed, Jan 28 2009 6:25 pm
Subject: Re: javascript agnostic feature in rails

> 1) I've seen two propositions do detach the js framework specific code
> from the rails core:

>   * Yehuda suggested that we have a javascript file for each framework
> (prototype.rails.js, jquery.rails.js, etc...) which implement the
> helpers. Rails js helpers would generate js code, implemented by
> prototype.rails.js or another depending on the choosen framework.

Yes, this is exactly what we should have. So remote_form_for should
just have either a special class, like rails_remote_form, or a special
attribute, ala remote=true. The JS drivers will then know to look for
that class/attribute and wire the behavior in automatically with their
new onload/dom watcher hooks.

So Rails should never really generate any JS for these helpers. Just
decorate them with the proper class names/attributes. Then every JS
library can write a driver that'll look for these Rails specific clues
and wire them up.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mislav Marohnić  
View profile  
 More options Jan 28, 9:36 pm
From: Mislav Marohnić <mislav.maroh...@gmail.com>
Date: Thu, 29 Jan 2009 03:36:47 +0100
Local: Wed, Jan 28 2009 9:36 pm
Subject: Re: [Rails-core] Re: javascript agnostic feature in rails

On Thu, Jan 29, 2009 at 00:25, DHH <david.heineme...@gmail.com> wrote:

> So Rails should never really generate any JS for these helpers. Just
> decorate them with the proper class names/attributes.

Rails stops generating inline JavaScript? I like the sound of that! :)

Custom microformats and unobtrusive scripting ftw


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael Koziarski  
View profile  
 More options Jan 28, 10:19 pm
From: Michael Koziarski <mich...@koziarski.com>
Date: Thu, 29 Jan 2009 16:19:38 +1300
Local: Wed, Jan 28 2009 10:19 pm
Subject: Re: [Rails-core] Re: javascript agnostic feature in rails

> Rails stops generating inline JavaScript? I like the sound of that! :)
> Custom microformats and unobtrusive scripting ftw

My only concern with this approach is the enormous amount of
bikeshedding that will no doubt take place.  However custom
microformats and default implementations in prototype and jquery, and
we've 'won' from my POV :)

--
Cheers

Koz


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Clemens  
View profile  
 More options Jan 29, 4:48 am
From: Clemens <clem...@railway.at>
Date: Thu, 29 Jan 2009 01:48:07 -0800 (PST)
Local: Thurs, Jan 29 2009 4:48 am
Subject: Re: javascript agnostic feature in rails
Obviously, I like that too - otherwise I wouldn't have made the
suggestion half a year ago! :-) Make sure that you contact me as soon
as something's decided - I'd be happy to help implementing this!

- Clemens

On Jan 29, 3:36 am, Mislav Marohnić <mislav.maroh...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Erwan Barrier  
View profile  
 More options Jan 29, 12:34 pm
From: Erwan Barrier <erwan.barr...@gmail.com>
Date: Thu, 29 Jan 2009 09:34:11 -0800 (PST)
Local: Thurs, Jan 29 2009 12:34 pm
Subject: Re: javascript agnostic feature in rails

> So Rails should never really generate any JS for these helpers. Just
> decorate them with the proper class names/attributes.

Ok, I'll start working on this in the next few days and keep you
updated on the progress.

> Obviously, I like that too - otherwise I wouldn't have made the
> suggestion half a year ago! :-) Make sure that you contact me as soon
> as something's decided - I'd be happy to help implementing this!

Clemens, your help is welcome, I contact you as soon as I have free
time to work on this.

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
toredar...@gmail.com  
View profile  
 More options Feb 5, 3:36 pm
From: toredar...@gmail.com
Date: Thu, 5 Feb 2009 12:36:27 -0800 (PST)
Local: Thurs, Feb 5 2009 3:36 pm
Subject: Re: javascript agnostic feature in rails
I wrote something like this for Prototype a while back:

http://github.com/toretore/experiments/blob/b1b1a93370762cf95ff50254c...

Example HTML here:

http://github.com/toretore/experiments/tree/b1b1a93370762cf95ff50254c...

It might not be exactly what's imagined in this thread, but it might
provide some ideas or be of use otherwise. It works quite well up
until a point where the complexity doesn't allow you to be completely
unobtrusive and not have to write JavaScript. A hacked in some rather
ugly solutions where you can add onFoo handler code by putting them in
custom attributes, but you'd probably be better off just writing the
JS yourself at this point. The JS is written to be modular and
reusable so for example you can instantiate a Rails.RemoteForm
manually and customise it.

Tore

On Jan 29, 6:34 pm, Erwan Barrier <erwan.barr...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google