Rob Blimploid
2009-Apr-16 04:09 UTC
Have simple sidebar code snippet for application.html.erb?
Googled forever trying to find a good example of how to do a simple sidebar (code snippet) in application.html.erb. I''ve found bits and pieces, but I need the whole "piece of meat". Is anyone willing to share a complete example code snippet for doing a sidebar? I''m thinking it may involve some new "show" code in the controller as well? Your help will be most appreciated! Thanks rubio -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Conrad Taylor
2009-Apr-16 04:33 UTC
Re: Have simple sidebar code snippet for application.html.erb?
On Wed, Apr 15, 2009 at 9:09 PM, Rob Blimploid < rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Googled forever trying to find a good example of how to do a simple > sidebar (code snippet) in application.html.erb. I''ve found bits and > pieces, but I need the whole "piece of meat". > > Is anyone willing to share a complete example code snippet for doing a > sidebar? I''m thinking it may involve some new "show" code in the > controller as well? > > Your help will be most appreciated! > > Thanks rubioHi, I would recommend taking a look at the "AWDwRails 3rd Edition" construction of the depot application section page 91 - 93, section B2: Adding a Page Layout. God luck, -Conrad> > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
melvin ram
2009-Apr-16 04:35 UTC
Re: Have simple sidebar code snippet for application.html.erb?
http://pastie.org/private/wcmbr5es6waf50aokxfoig This is from a real app On Apr 15, 9:09 pm, Rob Blimploid <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Googled forever trying to find a good example of how to do a simple > sidebar (code snippet) in application.html.erb. I''ve found bits and > pieces, but I need the whole "piece of meat". > > Is anyone willing to share a complete example code snippet for doing a > sidebar? I''m thinking it may involve some new "show" code in the > controller as well? > > Your help will be most appreciated! > > Thanks rubio > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Freddy Andersen
2009-Apr-16 05:06 UTC
Re: Have simple sidebar code snippet for application.html.erb?
or <div id=''wrapper''> <div id=''side''> <%= content_for(:side) %> </div> <div id=''content''> <%= yield %> </div> </div> Then use css to float the side and content to the left with some with... Was that what you wanted? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Dave S
2009-Apr-16 10:01 UTC
Re: Have simple sidebar code snippet for application.html.erb?
Actually you''d want this... application.html.erb <div id=''wrapper''> <div id=''sidebar''> <%= yield :sidebar %> </div> <div id=''content''> <%= yield %> </div> </div> show.html.erb Anything you type here will show in the content div <% content_for :sidebar do %> this will show up in the sidebar div <% end %> On Apr 16, 12:06 am, Freddy Andersen <fre...-RCI/mp9mI1I6GGFevw1D/A@public.gmane.org> wrote:> or > > <div id=''wrapper''> > <div id=''side''> > <%= content_for(:side) %> > </div> > <div id=''content''> > <%= yield %> > </div> > </div> > > Then use css to float the side and content to the left with some > with... > > Was that what you wanted?--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Bharat
2009-Apr-16 11:41 UTC
Re: Have simple sidebar code snippet for application.html.erb?
The following article teaches you how to create your own sidebars. This is how I got a good grip on it. The agile web development book also explains it well. Actually, the sidebar itself is trivial. What is more important is how to use it in layout files and the intricate interaction of yield with content_for. Once you understand it, you should not have any trouble creating your own. http://errtheblog.com/posts/26-content-for-whom Bharat --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Rubio Ramirez
2009-Apr-16 14:44 UTC
Re: Have simple sidebar code snippet for application.html.erb?
Dave S wrote:> Actually you''d want this... > > application.html.erb > > <div id=''wrapper''> > <div id=''sidebar''> > <%= yield :sidebar %> > </div> > <div id=''content''> > <%= yield %> > </div> > </div> > > > show.html.erb > > Anything you type here will show in the content div > <% content_for :sidebar do %> > this will show up in the sidebar div > <% end %>Ok .. so that''s the trick! Mucho appreciated Dave; thanks for taking the time. rubio -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Rubio Ramirez
2009-Apr-16 14:47 UTC
Re: Have simple sidebar code snippet for application.html.erb?
Bharat Ruparel wrote:> The following article teaches you how to create your own sidebars. > This is how I got a good grip on it. The agile web development book > also explains it well. Actually, the sidebar itself is trivial. What > is more important is how to use it in layout files and the intricate > interaction of yield with content_for. Once you understand it, you > should not have any trouble creating your own. > > http://errtheblog.com/posts/26-content-for-whom > > BharatBharat, Thanks for the great article; I googled all last evening but couldn''t find anything complete. Mucho appreciated, rubio -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---