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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <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="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> <script src="/js/common.js" type="text/javascript" charset="utf-8"></script>
<% if @item.identifier =~ %r{/page/$} %> <% if @item.identifier =~ %r{/page/$} %>
@ -18,9 +18,9 @@
<% end %> <% end %>
</head> </head>
<body class="articles"> <body class="articles">
<%= render 'header' %> <%= render '_header' %>
<h1>Archives</h1>
<div id="content"> <div id="content">
<h1>Archives</h1>
<% <%
menu = [ menu = [
@ -57,6 +57,6 @@
<a href="<%= pagepath %>" class="older">Older &raquo;</a> <a href="<%= pagepath %>" class="older">Older &raquo;</a>
</div> </div>
</div> </div>
<%= render 'footer' %> <%= render '_footer' %>
</body> </body>
</html> </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)" /> <link rel="stylesheet" href="/css/mobile.css" type="text/css" media="only screen and (max-device-width: 480px)" />
</head> </head>
<body<%= %Q( class="#{@item[:body_class]}") if @item[:body_class] %>> <body<%= %Q( class="#{@item[:body_class]}") if @item[:body_class] %>>
<%= render 'header' %> <%= render '_header' %>
<h1><a href="<%= @item.reps.first.path %>"><%= @item[:title] %></a></h1>
<div id="content"> <div id="content">
<h1><a href="<%= @item.reps.first.path %>"><%= @item[:title] %></a></h1>
<%= yield %> <%= yield %>
</div> </div>
<%= render 'footer' %> <%= render '_footer' %>
</body> </body>
</html> </html>

View file

@ -13,15 +13,15 @@
<script src="/js/home.js" type="text/javascript" charset="utf-8"></script> <script src="/js/home.js" type="text/javascript" charset="utf-8"></script>
</head> </head>
<body class="home"> <body class="home">
<%= render 'header' %> <%= render '_header' %>
<div id="technical" class="column"> <div id="technical" class="column">
<div> <div>
<h1>Geeky <h1>Geeky
<sup><a href="<%= feed_url %>"><img src="/images/black-feed-icon.png" width="12" height="12" /></a></sup> <sup><a href="<%= feed_url %>"><img src="/images/black-feed-icon.png" width="12" height="12" /></a></sup>
</h1> </h1>
<ul class="articles"> <ul class="articles">
<% sorted_articles[0..4].each do |article| %> <% technical_articles[0..4].each do |article| %>
<%= render 'article', :article => article %> <%= render '_article', :article => article %>
<% end %> <% end %>
</ul> </ul>
<a href="/technical/articles/" class="more">More</a> <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> <sup><a href="<%= feed_url %>"><img src="/images/black-feed-icon.png" width="12" height="12" /></a></sup>
</h1> </h1>
<ul class="articles"> <ul class="articles">
<% sorted_articles[5..9].each do |article| %> <% personal_articles[0..4].each do |article| %>
<%= render 'article', :article => article %> <%= render '_article', :article => article %>
<% end %> <% end %>
</ul> </ul>
<a href="/personal/articles/" class="more">More</a> <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> <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> </li>
</div> </div>
<%= render 'footer' %> <%= render '_footer' %>
</body> </body>
</html> </html>

View file

@ -1,3 +1,5 @@
require 'bitly'
module WezM module WezM
module Helpers module Helpers
module Articles module Articles
@ -19,6 +21,17 @@ module WezM
} }
end 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 end
end end

View file

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