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

Hey Colin and Michael,

Thanks to both of you for your responses.

> Assuming you have "<div id="sidebar"><%= yield :sidebar %></div>"
somewhere in your view... [Michael]

Sidebar is referenced in three file the app (according to my Ruby
Search.rb program):
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"></div>
[snip]
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 %>

> This doesn't appear to be a rails issue at all [Colin}:

I opened Firebug when "New Expenses", the offending page, was being
displayed in Firefox.
Fiirebug referenced Scaffold.css 3 times. But style.css wsas never
mentioned, which is where the following definition is given:

div#sidebar {
width: 200px;
margin-left: 480px;
background-color: #00FFFF;
}

Does that point to an error in my code?

Regards,
Richard

The gory details from Firebug follow:

In the left-hand pane:
body
div (not expanded)
link (")
table
tbody
tr
td (My page's left side, not expanded)
td (My page's right side = "sidebar", not expanded)
/tr
/tbody
/table
div id = divCleekiAttrib (other stuff)
/div
/body

Except for the last div, that structure matches my expenses,html.erb:
<body>
<p style="color: green"><%= flash[:notice] %></p>

<table width="100%">
<tr>
<td> <%= yield %> </td>
<td> <%= yield :sidebar %> </td>
</tr>
</table>
</body>

So far, so good.

But with the focus on the 2nd td in the left-hand pane,
the right-hand pane shows two items:
First:
body, p, ol, ul, td { [scaffo...6718330 (line 3)]
font-family:verdana,arial,helvetica,sans-serif;
font-size:13px;
line-height:18px;
}

Second (two "body" items "inherited from body"):: [scaffo...6718330
(line 3)]
body, p, ol, ul, td {
font-family:verdana,arial,helvetica,sans-serif; [crossed out]
font-size:13px; [crossed out]
line-height:18px; [crossed out]
}

body { [scaffo...6718330 (line 1)]
color:#333333;
}

On Mar 17, 10:54 am, Michael Pavling <pavl...@gmail.com> wrote:
> On 17 March 2010 14:43, Colin Law <clan...@googlemail.com> wrote:
>
> >> Problem: My page displays the sidebar to the right side as I intend,
> >> but:
> >> -       It displays the sidebar's content as intend ... almost: that is, the
> >> text appear centered vertically rather than on top
> >> -       It continues to have a lily-white background.
>
> > This doesn't appear to be a rails issue at all. However, install the
> > Firebug pludin for Firefox and then you can inspect the div and see
> > what it's style is and where those styles are inherited from.
>
> +1
>
> This is a CSS problem, not Rails [1]. Probably a 'float' or 'display'
> property that needs to be tweaked.
>
> [1] Assuming you have "<div id="sidebar"><%= yield :sidebar %></div>"
> somewhere in your view...

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