Is there a way to get drop_receiving_element to not generate "// ..
-
The code for the
drop_receiving_element
isdef drop_receiving_element(element_id, options = {}) javascript_tag(drop_receiving_element_js(element_id, options).chop!) end
javascript_tag
is what adds the script tags, so it looks like you should just be able to leave those out, and enter this yourself.drop_receiving_element_js(element_id, options).chop!
Note: It might be a private method, in which case just use
send(:drop_receiving_element_js, element_id, options).chop!
-
I'm not sure what you want to acheve (the script helpers job is to write scripts in tags). But if what you want is to place the code elsewhere, for instance at the bottom of the page since loading javascript last makes the page appear faster, you could use
content_for
.<% content_for :inline_javascript do %> <%# Script helpers here %> <% end %>
then in the bottom (or wherever you want it), you place this line:
<%# Include tags for other Js code the inline scripts rely on above here %> <%= yield :inline_javascript %>
This doesn't work for asyncronous content (ajax), but on the other hand the other script includes is allready loaded when you update a page with ajax content.
(You can write your own helper that, depending on the request type, uses the content_for variable or writes the script tag inline. I've made one before, I can try locate it if you want me to)
0 comments:
Post a Comment