<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>app/views/shared/_s_content.html.erb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -55,6 +55,8 @@ class Admin::PostsController &lt; Admin::AdminController
   end
 
   def preview
+    #mark the post as a preview
+    @post_preview = true
     
     if session[&quot;post_preview&quot;]
       @post = session[&quot;post_preview&quot;]
@@ -70,10 +72,13 @@ class Admin::PostsController &lt; Admin::AdminController
   end
   
   def post_preview
+    #mark the post as a preview
+    @post_preview = true
+    
     @post = Post.new(:title =&gt; params[:post_title], :body =&gt; params[:post_body])
     
     respond_to do |format|
-      format.html { render :template =&gt; 'posts/show'}
+      format.html { render :template =&gt; 'posts/show', :layout =&gt; 'application'}
     end
   end
   </diff>
      <filename>app/controllers/admin/posts_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
 class PostsController &lt; ApplicationController
   
-  #caches_page :index
+  before_filter :setup_sidebar
     
   def index
     @posts = Post.by_published(:limit =&gt; 5)
@@ -45,4 +45,12 @@ class PostsController &lt; ApplicationController
       format.html # by_year.html.erb
     end
   end
+  
+  protected
+  
+  def setup_sidebar
+   if request.format.to_sym == :html  
+      @recent_posts = Post.by_published(:limit =&gt; 5)
+    end
+  end
 end</diff>
      <filename>app/controllers/posts_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -25,6 +25,10 @@ module ApplicationHelper
     Soapbox['strapline']
   end
   
+  def post_preview?
+    @post_preview
+  end
+  
   private
   
   def viewing_post?</diff>
      <filename>app/helpers/application_helper.rb</filename>
    </modified>
    <modified>
      <diff>@@ -18,4 +18,10 @@ module PostsHelper
     end
     list.join(&quot;\n  &quot;)
   end
+  
+  def recent_posts
+    content_tag(:ul,
+      @recent_posts.collect { |post| content_tag(:li, link_to_post(post)) }.join(&quot;\n&quot;),
+      :id =&gt; &quot;recent_posts&quot;)
+  end
 end</diff>
      <filename>app/helpers/posts_helper.rb</filename>
    </modified>
    <modified>
      <diff>@@ -25,12 +25,13 @@
         &lt;%= content_tag(:p, blog_strapline) if blog_strapline %&gt;
     &lt;/div&gt;&lt;!-- #header --&gt;
     &lt;div class=&quot;p-content&quot;&gt;
-      &lt;%#= display_page_title %&gt;
-
       &lt;%#= render :partial =&gt; 'layouts/flashes' -%&gt;
       &lt;%= yield %&gt;
 
     &lt;/div&gt;&lt;!-- .p-content --&gt;
+    &lt;div id=&quot;s-content&quot;&gt;
+      &lt;%= render :partial =&gt; 'shared/s_content' unless post_preview? -%&gt;
+    &lt;/div&gt;
     &lt;div id=&quot;footer&quot;&gt;
       &lt;p&gt;Some footer text and a copywrite&lt;/p&gt;
     &lt;/div&gt;</diff>
      <filename>app/views/layouts/application.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,8 @@
-
+&lt;%
+  @page = {:title =&gt; &quot;Archives&quot; }
+%&gt;
+&lt;h1&gt;Archives&lt;/h1&gt;
+&lt;p&gt;Browse the archives and find what you want&lt;/p&gt;
 &lt;h2&gt;By Month&lt;/h2&gt;
 &lt;ul&gt;
   &lt;%= by_month_list(@post_sum_by_month) %&gt;</diff>
      <filename>app/views/posts/archives.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -1,3 +1,5 @@
 &lt;% unless @posts.empty? %&gt;
-  &lt;%= render :partial =&gt; &quot;post&quot;, :collection =&gt; @posts %&gt;
+  &lt;div id=&quot;posts&quot;&gt; 
+    &lt;%= render :partial =&gt; &quot;post&quot;, :collection =&gt; @posts %&gt;
+  &lt;/div&gt;
 &lt;% end %&gt;
\ No newline at end of file</diff>
      <filename>app/views/posts/by_month.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,5 @@
 &lt;%
-  @page = {:title =&gt; @post.title }
+  @page = {:title =&gt; @post.try(:title) }
 %&gt;
 
 &lt;% if @post %&gt;</diff>
      <filename>app/views/posts/show.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -5,6 +5,17 @@ describe PostsController do
   def mock_post(stubs={})
     @mock_post ||= mock(Post, stubs)
   end
+  
+  before(:each) do
+    # minimal spec to check the before filter runs
+    controller.should_receive(:setup_sidebar).once.and_return(true)
+  end
+  
+  shared_examples_for &quot;the sidebar has been setup&quot; do
+    it &quot;should have setup the sidebar&quot; do
+      assigns[:recent_posts].should == [mock_post]
+    end
+  end
 
 
   describe &quot;GET 'index'&quot; do
@@ -18,6 +29,7 @@ describe PostsController do
       get :index
       assigns[:posts].should == [mock_post]
     end
+    
   end
   
   describe &quot;GET 'show'&quot; do
@@ -89,4 +101,4 @@ describe PostsController do
     end
   end
 
-end
+end
\ No newline at end of file</diff>
      <filename>spec/controllers/posts_controller_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -30,4 +30,11 @@ describe PostsHelper do
       by_month_list(@post_sum_by_month).should == &quot;&lt;li&gt;&lt;a href=\&quot;/2009/08\&quot;&gt;August 2009&lt;/a&gt; &lt;span&gt;1&lt;/span&gt;&lt;/li&gt;\n  &lt;li&gt;&lt;a href=\&quot;/2009/06\&quot;&gt;June 2009&lt;/a&gt; &lt;span&gt;1&lt;/span&gt;&lt;/li&gt;&quot;     
     end
   end
+  
+  describe &quot;recent post list&quot; do
+    it &quot;should render a list of recent posts&quot; do
+      @recent_posts = [mock_post(:permalink =&gt; &quot;a-title&quot;, :year_and_month =&gt; [&quot;2009&quot;, &quot;06&quot;], :title =&gt; &quot;a title&quot;)]
+     recent_posts.should == &quot;&lt;ul id=\&quot;recent_posts\&quot;&gt;&lt;li&gt;&lt;a href=\&quot;2009/06/a-title\&quot;&gt;a title&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&quot; 
+    end                                      
+  end
 end</diff>
      <filename>spec/helpers/posts_helper_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -66,5 +66,4 @@ end
 
 def logout
   @user_session = nil
-end
-
+end
\ No newline at end of file</diff>
      <filename>spec/spec_helper.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>5d79609a269c09b830f5f5fec448cde74c9fcaf2</id>
    </parent>
  </parents>
  <author>
    <name>Ben Aldred</name>
    <email>benaldred@gmail.com</email>
  </author>
  <url>http://github.com/benaldred/soapbox/commit/e90d3c82eb04f9c16467c2887e69661546c00061</url>
  <id>e90d3c82eb04f9c16467c2887e69661546c00061</id>
  <committed-date>2009-09-29T02:38:24-07:00</committed-date>
  <authored-date>2009-09-29T02:38:24-07:00</authored-date>
  <message>lots</message>
  <tree>9d60006c32fa3d89ff8bdcf56ad0fa304133fc41</tree>
  <committer>
    <name>Ben Aldred</name>
    <email>benaldred@gmail.com</email>
  </committer>
</commit>
