Mk 27 wrote:
> You have hit a paradox by saying that you want to use prototype, etc. 
> but you do not want to see any js calls in your html files. I do 
> understand it is an explicit goal of rails to minimize the 

Look up "Unobtrusive javascript". Eg 
http://en.wikipedia.org/wiki/Unobtrusive_JavaScript

You can keep almost all javascript out of HTML except for simply loading 
external script files which then attach the appropriate javascript 
behaviors where necessary.

I have become quite enamored of this approach, I think it both 
facillitates more maintainable code with proper seperation of concerns, 
as well as facillitates better 'accessibility' (not just for non-js 
user-agents, but the possibility of swapping in _different_ js 
functionality for different contexts and/or user-agents).

And as I become more enamored of this approach, I'm more and more 
unhappy with Rails js helpers, which definitely don't follow it.

Curious if someone in the Rails community has figured out a good way to 
accomplish what Rails helpers do (controller logic in the controller 
instead of view, DRY for js idioms, etc) but in an "unobtrusive" idiom 
where no JS (apart from <script src> to load external js) is embedded in 
the HTML.  It's not entirely obvious how to accomplish this, but I think 
it's probably possible, probably using some design where the actual 
external js files are dynamically created themselves, not just static on 
disk.
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to