content_for Inside Formbuilder
I've got a formbuilder field specifically for doing DateTime using jQuery. What I'd like to do is have the helper able to push content out to my < head > through content_for. Any ideas? Thanks, Stefan ...
I've got a formbuilder field specifically for doing DateTime using jQuery. What I'd like to do is have the helper able to push content out to my < head > through content_for. Any ideas? Thanks, Stefan ...
Example: I have 2 partial _map.haml and _bigmap.haml. :: _map.haml - content_for :map do %script{:type => "text/javascript", :src => "http://maps.google.com/maps/api/js?sensor=true"} ... :: _bigmap.haml - content_for :bigmap do %script{:type => "text/javascript", :src => "http://maps.google.com/maps/api/js?sensor=true"} .....
I am using content_for and yeild to inject javascript files into the bottom of my layout but am wondering what the best practice is for including inline javascript. Specifically I'm wondering where the put the script type declaration: <% content_for :javascript do %> <script type="text/javascript"> ... </script> <% end %> or <% ...
Right now in my code I'm calling content_for like... <% content_for :javascript do -%> <%= "var boxplot_data=#{@survey.boxplot_answers.to_json};" %> <% end -%> Rather then having to convert a whole array at once I'd rather add to the array boxplot_data and then have it display as a var. That way I can make my code easier to read...
Using 2.3.8 of rails. In the view template I have this type of code <%content_for :sidebar do %> <h2>Sidebar</h2> <p><%=link_to "somewhere", "http://www.google.com/"%></p> <% end %> <h1>Pictures#new</h1> <p>Find me in app/views/pictures/new.html.erb</p> In the application.html.erb template I have <!-- END: Header --> <...
Hi All, I have the following requirement. Ex: There is a transaction table where it has columns say, transaction_name and amount. I want to loop through the transactions and display their details (transaction_name and amount) and finally I want to display the total amount (sum of all the amounts) in the head (before the loop) section...