From 2961b402514487c9f5a943f7f28d8a9a9544c63d Mon Sep 17 00:00:00 2001 From: Wesley Moore Date: Thu, 4 Feb 2010 13:38:35 +1100 Subject: [PATCH] Improvements to post page and other layout --- Rules | 42 +++++++-------------------------- content/articles.html | 2 +- content/personal/articles.html | 2 +- content/technical/articles.html | 2 +- layouts/article.html | 22 ++++++++--------- layouts/articles.html | 8 +++---- layouts/default.html | 6 ++--- layouts/home.html | 12 +++++----- lib/articles.rb | 13 ++++++++++ output/css/style.css | 26 +++++++++++--------- 10 files changed, 62 insertions(+), 73 deletions(-) diff --git a/Rules b/Rules index 06dc076..c5581bd 100644 --- a/Rules +++ b/Rules @@ -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 diff --git a/content/articles.html b/content/articles.html index d762f0f..b297bdf 100644 --- a/content/articles.html +++ b/content/articles.html @@ -1,5 +1,5 @@ \ No newline at end of file diff --git a/content/personal/articles.html b/content/personal/articles.html index 0daa02a..bb16265 100644 --- a/content/personal/articles.html +++ b/content/personal/articles.html @@ -1,3 +1,3 @@ <% personal_articles[0..9].each do |article| %> - <%= render 'article', :article => article %> + <%= render '_article', :article => article %> <% end %> diff --git a/content/technical/articles.html b/content/technical/articles.html index f8b3129..cc1b74d 100644 --- a/content/technical/articles.html +++ b/content/technical/articles.html @@ -1,3 +1,3 @@ <% technical_articles[0..9].each do |article| %> - <%= render 'article', :article => article %> + <%= render '_article', :article => article %> <% end %> diff --git a/layouts/article.html b/layouts/article.html index 72bf4d4..77dd37e 100644 --- a/layouts/article.html +++ b/layouts/article.html @@ -1,12 +1,10 @@ -<% post_date = WezM::Helpers.post_date(@article) %> -
  • - - <%= post_date.day %> - <%= post_date.strftime('%b') %> - <%= post_date.year %> - -

    - <%= @article[:title] %> - <%= @item[:summary] %> -

    -
  • +<%= yield %> +<% short = short_url("http://www.wezm.net#{@item.identifier}") %> +
    +

    Got Something to Add?

    + +
    diff --git a/layouts/articles.html b/layouts/articles.html index 06e9103..5b1ea91 100644 --- a/layouts/articles.html +++ b/layouts/articles.html @@ -1,7 +1,7 @@ - <%= render 'head_common' %> + <%= render '_head' %> <% if @item.identifier =~ %r{/page/$} %> @@ -18,9 +18,9 @@ <% end %> - <%= render 'header' %> -

    Archives

    + <%= render '_header' %>
    +

    Archives

    <% menu = [ @@ -57,6 +57,6 @@ Older »
    - <%= render 'footer' %> + <%= render '_footer' %> diff --git a/layouts/default.html b/layouts/default.html index d5589f2..2393265 100644 --- a/layouts/default.html +++ b/layouts/default.html @@ -9,11 +9,11 @@ > - <%= render 'header' %> -

    <%= @item[:title] %>

    + <%= render '_header' %>
    +

    <%= @item[:title] %>

    <%= yield %>
    - <%= render 'footer' %> + <%= render '_footer' %> diff --git a/layouts/home.html b/layouts/home.html index 27f37af..07e75c0 100644 --- a/layouts/home.html +++ b/layouts/home.html @@ -13,15 +13,15 @@ - <%= render 'header' %> + <%= render '_header' %>

    Geeky

      - <% sorted_articles[0..4].each do |article| %> - <%= render 'article', :article => article %> + <% technical_articles[0..4].each do |article| %> + <%= render '_article', :article => article %> <% end %>
    More @@ -34,8 +34,8 @@
      - <% sorted_articles[5..9].each do |article| %> - <%= render 'article', :article => article %> + <% personal_articles[0..4].each do |article| %> + <%= render '_article', :article => article %> <% end %>
    More @@ -49,6 +49,6 @@ Test Monochrome
    - <%= render 'footer' %> + <%= render '_footer' %> diff --git a/lib/articles.rb b/lib/articles.rb index a69d85e..49fa6ba 100644 --- a/lib/articles.rb +++ b/lib/articles.rb @@ -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 \ No newline at end of file diff --git a/output/css/style.css b/output/css/style.css index 9933e32..8fb3878 100644 --- a/output/css/style.css +++ b/output/css/style.css @@ -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; +}