Improvements to post page and other layout

This commit is contained in:
Wesley Moore 2010-02-04 13:38:35 +11:00
parent 65d2bcf0a6
commit 2961b40251
10 changed files with 62 additions and 73 deletions

42
Rules
View file

@ -4,39 +4,19 @@ compile '/' do
layout 'home'
end
compile '/articles/json/' do
filter :erb
end
compile '/technical/articles/json/' do
filter :erb
end
compile '/personal/articles/json/' do
compile '*/json/' do
filter :erb
end
compile '/articles/' do
compile %r{/(technical|personal|)articles/(page/|)} do
filter :erb
layout 'articles'
end
compile '/articles/page/' do
filter :erb
layout 'articles'
end
compile '/technical/articles/' do
filter :erb
layout 'articles'
end
compile '/technical/articles/page/' do
filter :erb
layout 'articles'
end
compile '/personal/articles/' do
filter :erb
layout 'articles'
end
compile '/personal/articles/page/' do
filter :erb
layout 'articles'
compile %r(/\d{4}/*) do
filter :rdiscount
layout 'article'
layout 'default'
end
compile '*' do
@ -44,13 +24,7 @@ compile '*' do
layout 'default'
end
route '/articles/json/' do
item.identifier + 'articles.json'
end
route '/technical/articles/json/' do
item.identifier + 'articles.json'
end
route '/personal/articles/json/' do
route '*/json/' do
item.identifier + 'articles.json'
end

View file

@ -1,5 +1,5 @@
<ul class="articles">
<% sorted_articles[0..9].each do |article| %>
<%= render 'article', :article => article %>
<%= render '_article', :article => article %>
<% end %>
</ul>

View file

@ -1,3 +1,3 @@
<% personal_articles[0..9].each do |article| %>
<%= render 'article', :article => article %>
<%= render '_article', :article => article %>
<% end %>

View file

@ -1,3 +1,3 @@
<% technical_articles[0..9].each do |article| %>
<%= render 'article', :article => article %>
<%= render '_article', :article => article %>
<% end %>

View file

@ -1,12 +1,10 @@
<% post_date = WezM::Helpers.post_date(@article) %>
<li>
<abbr class="calender date" title="<%= post_date.iso8601 %>">
<span class="day"><%= post_date.day %></span>
<span class="month"><%= post_date.strftime('%b') %></span>
<span class="year"><%= post_date.year %></span>
</abbr>
<p>
<strong><a href="<%= @article.reps.first.path %>"><%= @article[:title] %></a></strong>
<%= @item[:summary] %>
</p>
</li>
<%= yield %>
<% short = short_url("http://www.wezm.net#{@item.identifier}") %>
<div class="respond">
<h2>Got Something to Add?</h2>
<ul class="inline">
<li><a href="#">Email Me</a></li>
<li><a href="http://twitter.com/home?status=<%= URI.encode("@wezm #{short}") %>">Tweet</a></li>
<li>Short URL: <a href="<%= short %>"><%= short %></a></li>
</ul>
</div>

View file

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<%= render 'head_common' %>
<%= render '_head' %>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js" type="text/javascript"></script>
<script src="/js/common.js" type="text/javascript" charset="utf-8"></script>
<% if @item.identifier =~ %r{/page/$} %>
@ -18,9 +18,9 @@
<% end %>
</head>
<body class="articles">
<%= render 'header' %>
<h1>Archives</h1>
<%= render '_header' %>
<div id="content">
<h1>Archives</h1>
<%
menu = [
@ -57,6 +57,6 @@
<a href="<%= pagepath %>" class="older">Older &raquo;</a>
</div>
</div>
<%= render 'footer' %>
<%= render '_footer' %>
</body>
</html>

View file

@ -9,11 +9,11 @@
<link rel="stylesheet" href="/css/mobile.css" type="text/css" media="only screen and (max-device-width: 480px)" />
</head>
<body<%= %Q( class="#{@item[:body_class]}") if @item[:body_class] %>>
<%= render 'header' %>
<h1><a href="<%= @item.reps.first.path %>"><%= @item[:title] %></a></h1>
<%= render '_header' %>
<div id="content">
<h1><a href="<%= @item.reps.first.path %>"><%= @item[:title] %></a></h1>
<%= yield %>
</div>
<%= render 'footer' %>
<%= render '_footer' %>
</body>
</html>

View file

@ -13,15 +13,15 @@
<script src="/js/home.js" type="text/javascript" charset="utf-8"></script>
</head>
<body class="home">
<%= render 'header' %>
<%= render '_header' %>
<div id="technical" class="column">
<div>
<h1>Geeky
<sup><a href="<%= feed_url %>"><img src="/images/black-feed-icon.png" width="12" height="12" /></a></sup>
</h1>
<ul class="articles">
<% sorted_articles[0..4].each do |article| %>
<%= render 'article', :article => article %>
<% technical_articles[0..4].each do |article| %>
<%= render '_article', :article => article %>
<% end %>
</ul>
<a href="/technical/articles/" class="more">More</a>
@ -34,8 +34,8 @@
<sup><a href="<%= feed_url %>"><img src="/images/black-feed-icon.png" width="12" height="12" /></a></sup>
</h1>
<ul class="articles">
<% sorted_articles[5..9].each do |article| %>
<%= render 'article', :article => article %>
<% personal_articles[0..4].each do |article| %>
<%= render '_article', :article => article %>
<% end %>
</ul>
<a href="/personal/articles/" class="more">More</a>
@ -49,6 +49,6 @@
<a href="http://farm3.static.flickr.com/2708/4302496460_a1ec313d06.jpg" rel="prettyPhoto[flickr]"><img src="/images/photos/4302496460_a1ec313d06.jpg" alt="Test Monochrome" /></a>
</li>
</div>
<%= render 'footer' %>
<%= render '_footer' %>
</body>
</html>

View file

@ -1,3 +1,5 @@
require 'bitly'
module WezM
module Helpers
module Articles
@ -19,6 +21,17 @@ module WezM
}
end
def short_url(url)
@bitly ||= Bitly.new('wezm', 'R_f2bfdace56c886671086eb0c8acb9ce7')
@cache ||= {}
unless u = @cache[url]
u = @bitly.shorten(url)
else
puts "Cache hit on #{url}"
end
u.short_url
end
end
end
end

View file

@ -1,13 +1,13 @@
body {
font-family: Constantia, Georgia, "Bitstream Vera Serif", "Liberation Serif", serif;
font-size: 62.5%;
font-size: 16px;
background: #fff;
color: #223;
}
p,li,div {
/*p,li,div {
font-size: 16px;
}
}*/
p,li {
line-height: 1.2;
}
@ -35,12 +35,12 @@ h1,h2,h3,h4,h5,h6 {
/* 6,7,8,9,10,11,12,14,16,18,21,24,36,48,60,72 */
h1 {
font-size: 36px;
padding-left: 20px;
padding-right: 20px;
/* padding-left: 20px;
padding-right: 20px;*/
}
body.home h1 {
padding-left: 0;
padding-right: 0;
/* padding-left: 0;
padding-right: 0;*/
}
h2 {
font-size: 24px;
@ -91,12 +91,12 @@ pre,code {
font-family: Consolas, "Andale Mono", "Liberation Mono", Menlo, Monaco, "Bitstream Vera Sans Mono", fixed;
}
pre {
font-size: 1.2em;
font-size: 12px;
}
#header {
font-family: "Helvetica Neue", Helvetica, "Liberation Sans", "Bitstream Vera Sans", Tahoma, Geneva, Arial, sans-serif;
font-size: 1.8em;
font-size: 18px;
color: white;
padding: 0.5em;
background: #1C1C1C; /* url(/images/texture.png) repeat-y top left; */
@ -182,7 +182,7 @@ ul.articles li:first-child {
}
ul.articles abbr {
display: block;
font-size: 0.8em;
font-size: 12px;
color: #aaa;
}
ul.articles strong {
@ -207,7 +207,7 @@ ul.inline {
ul.inline li {
display: inline;
}
ul.menu li:first-child {
ul.inline li:first-child {
margin-left: 0;
}
@ -279,3 +279,7 @@ ul.menu li:first-child {
width: 19px;
height: 19px;
}
.respond {
border-top: 1px solid gray;
}