rubyonrailsin

A Ruby and Rails talk

Wednesday, March 17, 2010


[Rails] Re: Problem with content-position and background-color in a sidebar

by rubyonrailsin 0 comments

Tag


Share this post:
Design Float
StumbleUpon
Reddit

> I don't see where you are putting this in a div with id=sidebar.
> Should you have
> <% content_for :sidebar do %>
> <div id="sidebar">
> This is my sidebar stuff from:<br>
> new.html.erb<br>
> RTS\app\views\expenses
> </div>
> <% end %>
> or something similar?

Here's what I've got:

In app\views\expenses\new.html.erb (at the bottom) I have:
<% content_for :sidebar do %>
This is my sidebar stuff from:<br>
new.html.erb<br>
RTS\app\views\expenses
<% end %>

Both divs are defined in app\views\layouts\standard.html.erb:
<body id="library">
<div id="container">
<div id="header">
<h1>Receipts Tracking System</h1>
<h3>Library powered by Ruby on Rails</h3>
</div>

<div id="content">
<%= yield -%>
</div>
<div id="sidebar">
<%= yield -%>
</div>
</div>
</body>
</html>

I just added that yield to div/sidebar based on no more than hot air.
I availed me naught.

On Mar 17, 1:18 pm, Colin Law <clan...@googlemail.com> wrote:
> On 17 March 2010 16:52, RichardOnRails
>
>
>
> <RichardDummyMailbox58...@uscomputergurus.com> wrote:
> >...
> > app\views\layouts\expenses.html.erb:
> > <body>
> >    <p style="color: green"><%= flash[:notice] %></p>
>
> >    <table width="100%">
> >        <tr>
> >            <td>  <%= yield %>              </td>
> >            <td>  <%= yield :sidebar %>  </td>
> >        [snip]
> > app\views\expenses\new.html.erb (at the bottom):
> >        <% content_for :sidebar do %>
> >          This is my sidebar stuff from:<br>
> >            new.html.erb<br>
> >            RTS\app\views\expenses
> >        <% end %>
>
> I don't see where you are putting this in a div with id=sidebar.
> Should you have
>         <% content_for :sidebar do %>
> <div id="sidebar">
>           This is my sidebar stuff from:<br>
>             new.html.erb<br>
>             RTS\app\views\expenses
> </div>
>         <% end %>
> or something similar?
>
> Colin

--
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@googlegroups.com.
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.

No comments:

Post a Comment

Subscribe feeds via e-mail

Blog Archive