Woops!
Sorry guys, went moronic for a moment. My suggested helper is not so
good for the original need, which was to significantly reduce overhead:
it only reduces the script wrapper tags, not the Draggable calls. This
is because I wanted to reuse the draggable_element_js method.
Here's another go, that produces something more like what was originally
wanted:
def draggable_elements(*args)
return '' if args.empty?
options = {}
options = args.pop if args.last.is_a?(Hash)
js = '[' + args.map { |a| a.to_json }.join(', ') + ']'
js << ".each(function(a) {\n "
js << "new Draggable(a, #{options_for_javascript(options)});\n"
js << '});'
javascript_tag(js)
end
There, much better.
--
Christophe Porteneuve a.k.a. TDD
"[They] did not know it was impossible, so they did it." --Mark Twain
Email: [EMAIL PROTECTED]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" 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-spinoffs
-~----------~----~----~----~------~----~------~--~---