Hi --
On Fri, 7 Mar 2008, Tarscher wrote:
>
> hi all,
>
> I''m trying to do a each on an array the droppable element
> <%= draggable_element "user_" + create_drop_zone(zone),
> :revert => true,
> :onStart => "function(){"
%>
> <% drop_zone_ids.each do |
> zone| %>
>
Element.addClassName(''<%> zone %>'',
''border'');
> <% end %>
>
Element.addClassName(''user_<%> user_node %>'',
''move_user''); }
>
> This results in:
> //<![CDATA[
> new Draggable("user_1_4", {onStart:function(){, revert:true})
> //]]>
> </script>
> Element.addClassName(''3'', ''border'');
> Element.addClassName(''4'', ''border'');
> Element.addClassName(''user_1_4'',
''move_user''); }
You need to drop down to regular Ruby string interpolation. Try this:
<%= draggable_element "user_" + create_drop_zone(zone),
:revert => true,
:onStart => "function(){#{
drop_zone_ids.map do |zone|
"Element.addClassName(''#{zone}'',
''border'');
Element.addClassName(''user_#{user_node}'',
''move_user'');
"
end}
}" %>
David
--
Upcoming Rails training from David A. Black and Ruby Power and Light:
ADVANCING WITH RAILS, April 14-17 2008, New York City
CORE RAILS, June 24-27 2008, London (Skills Matter)
See http://www.rubypal.com for details. Berlin dates coming soon!
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---