With the functionality for the mini-calendar complete, I am ready to integrate it into the rest of the application. It ought to look like this:
Firing up my browser this is what the mini-calendar looks like (non-mini-ized):
Hmm... There are several problems here:
- the header is displaying—the header goes on the main page, not the mini-calendar
- there do not appear to be any meal links
- the month and day header colors are not quite right
get %r{/mini/(.*)} do |date_str|Without a layout, I need to define the entire HTML document structure, including the link to the stylesheet, directly in the mini-calendar Haml template:
...
haml :mini_calendar, :layout => false
end
%html(commit)
%link{:rel => "stylesheet", :type => "text/css", :href => "/stylesheets/style.css"}
%body
- day1 = Date.parse("#{@month}-01")
%h1
...
One down two to go. So, what's up with the non-links? Checking out the HTML source, I find:
<td id='2008-07-09'>Aw, dang it. That is just a Haml indentation problem:
9
</td>
<td id='2008-07-10'>
<a href='/meals/2008/07/10' title='You Each Take a Side'> </a>
10
</td>
...I want the month date to be a child of the
%a{:href => date.strftime("/meals/%Y/%m/%d"),
:title => @meals_by_date[date.to_s]}
= date.mday
...
<a>
tag. Two spaces resolve the issue:...(commit)
%a{:href => date.strftime("/meals/%Y/%m/%d"),
:title => @meals_by_date[date.to_s]}
= date.mday
...
This leaves me with the mini-calendar working, but in need of a little style:
Before defining the style, I provide a scope for the CSS style changes by adding an
id
attribute to the <body>
tag in the mini-calendar Haml:...To actually style that, I am using less CSS. In the mini-calendar context, the
%body{:id => 'mini-calendar'}
...
<h1>
content should be white, with a green background, and any links should also be white. The less CSS corresponding to that description:#mini-calendar {I fired up less css in watch mode, make this changes and:
h1 {
background-color: @italian_green;
color: white;
font-size: 1.2em;
text-align: center;
a {
color: white;
}
}
}
cstrom@jaynestown:~/repos/eee-code$ lessc public/stylesheets/style.less --watchNow I have a nice green header:
* Watching for changes in public/stylesheets/style.less... Ctrl-C to abort.
: Change detected... * [Updated] style.css
I make similar changes to get the week day headings and the dates with meals colored correctly. To embed this on the homepage, I need an
<iframe >
along the lines of:...This produces:
.home-section
%iframe{:src => '/mini/'}
...
Clearly the
<iframe >
is in need of a little love, but the mini-calendar itself is looking well styled. I will pick up with the <iframe >
tomorrow and deploy.
No comments:
Post a Comment