content-for

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 ...

Rails global content_for

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"} .....

Including inline javascript using content_for in rails

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 <% ...

How to add to a javascript var array using content_for in Ruby on Rails?

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...

Ruby on Rails: Yield content_for Display Issues

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/"%&gt;&lt;/p&gt; <% 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 --> <...

Rails yield - content_for problem

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...