<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,2 +1,3 @@
 * Don't make a new version if all that changed was the status. 
-  (or do we want this? it would mess up git SHAs if we ever added a git interface)
\ No newline at end of file
+  (or do we want this? it would mess up git SHAs if we ever added a git interface)
+* Limit the number of versions visible in the timeline
\ No newline at end of file</diff>
      <filename>TODO</filename>
    </modified>
    <modified>
      <diff>@@ -3,24 +3,42 @@ module Admin::TimelineHelper
     versions = page.versions
     content_tag(:div, :id=&gt;&quot;timeline&quot;) do
       content_tag(:ol) do
+        this_version_node +
         page.versions.collect do |version|
-          version_id = &quot;version-#{version.number}&quot;
-          content_tag(:li, :id =&gt; version_id) do
-            tags = []
-            tags &lt;&lt; tag(:img, :id=&gt;&quot;#{version_id}-icon&quot;, :src=&gt;&quot;/images/admin/#{version.instance.status.name.downcase}.png&quot;)
-            if (version.instance.status_id &lt; Status[:published].id) &amp;&amp; version.current?
-              tags &lt;&lt; tag(:img, :class=&gt;&quot;marker&quot;, :id=&gt;&quot;dev-marker&quot;,   :src=&gt;&quot;/images/admin/dev.png&quot;)
-            else
-              if version.current?
-                tags &lt;&lt; tag(:img, :class=&gt;&quot;marker&quot;, :id=&gt;&quot;dev-and-live-marker&quot;,   :src=&gt;&quot;/images/admin/dev-and-live.png&quot;)
-              elsif version.current_live?
-                tags &lt;&lt; tag(:img, :class=&gt;&quot;marker&quot;, :id=&gt;&quot;live-marker&quot;,   :src=&gt;&quot;/images/admin/live.png&quot;)
-              end
-            end
-            tags.join
-          end
+          version_node(version)
         end.join
       end
     end
   end
+  
+  def version_node(version)
+    content_tag(:li, :id =&gt; &quot;version-#{version.number}&quot;) do
+      tags = [ version_icon(version) ]
+      case
+      when version.only_visible_in_dev_mode? &amp;&amp; version.current?
+        tags &lt;&lt; marker(:dev)
+      when version.current?
+        tags &lt;&lt; marker(&quot;dev-and-live&quot;)
+      when version.current_live?
+        tags &lt;&lt; marker(:live)
+      end
+      tags.join
+    end
+    
+  end
+  
+  def marker(type)
+    type = type.to_s
+    tag(:img, :class=&gt;&quot;marker&quot;, :id=&gt;&quot;#{type}-marker&quot;,   :src=&gt;&quot;/images/admin/#{type}.png&quot;)
+  end
+  
+  def version_icon(version)
+    tag(:img, :id=&gt;&quot;version-#{version.number}-icon&quot;, :src=&gt;&quot;/images/admin/#{version.instance.status.name.downcase}.png&quot;)
+  end
+  
+  def this_version_node
+    content_tag(:li, :id =&gt; &quot;this&quot;) do
+      tag(:img, :id=&gt;&quot;this-icon&quot;, :src=&gt;&quot;/images/admin/this.png&quot;)
+    end
+  end
 end</diff>
      <filename>app/helpers/admin/timeline_helper.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,12 +1,3 @@
-&lt;!-- &lt;div id=&quot;timeline&quot;&gt;
-  &lt;ol&gt;
-    &lt;li id=&quot;this&quot;&gt;&lt;img src=&quot;/images/admin/this.png&quot; /&gt;&lt;/li&gt;
-    &lt;li id=&quot;version-24&quot;&gt;&lt;img src=&quot;/images/admin/draft.png&quot; id=&quot;version-24-icon&quot; /&gt;&lt;img class=&quot;marker&quot; id=&quot;live&quot; src=&quot;/images/admin/dev.png&quot; /&gt;&lt;/li&gt;
-    &lt;li id=&quot;version-23&quot;&gt;&lt;img src=&quot;/images/admin/published.png&quot; /&gt;&lt;img class=&quot;marker&quot; id=&quot;live&quot; src=&quot;/images/admin/live.png&quot; /&gt;&lt;/li&gt;
-    &lt;li id=&quot;version-22&quot;&gt;&lt;img src=&quot;/images/admin/reviewed.png&quot; /&gt;&lt;/li&gt;
-    &lt;li id=&quot;version-21&quot; class=&quot;beginning&quot;&gt;&lt;img src=&quot;/images/admin/hidden.png&quot; /&gt;&lt;img class=&quot;marker&quot; id=&quot;live&quot; src=&quot;/images/admin/dev-and-live.png&quot; /&gt;&lt;/li&gt;
-  &lt;ol&gt;
-&lt;/div&gt; --&gt;
 &lt;%= timeline(@page) %&gt;
 &lt;script type=&quot;text/javascript&quot;&gt;
   new HelpBalloon({</diff>
      <filename>app/views/admin/_timeline.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -22,4 +22,8 @@ module Chronicle::VersionExtensions
     current_live = versionable.versions.find(:first, :conditions =&gt; &quot;status_id &gt;= #{Status[:published].id}&quot;, :order =&gt; 'number DESC')
     current_live &amp;&amp; (current_live.number == self.number)
   end
+  
+  def only_visible_in_dev_mode?
+    status_id &lt; Status[:published].id
+  end
 end
\ No newline at end of file</diff>
      <filename>lib/chronicle/version_extensions.rb</filename>
    </modified>
    <modified>
      <diff>@@ -25,6 +25,9 @@
   width: 40px;
   background-image: url(/images/admin/line-beginning.png);
 }
+#timeline li#version-1 {
+  background-image: none;
+}
 #timeline li .marker {
   position: absolute;
   right: -8px;</diff>
      <filename>public/stylesheets/admin/chronicle.css</filename>
    </modified>
    <modified>
      <diff>@@ -8,6 +8,11 @@ describe Admin::TimelineHelper do
     included_modules.should include(Admin::TimelineHelper)
   end
   
+  it &quot;should have a node for the version I am currently editing&quot; do
+    page = pages(:draft)
+    helper.timeline(page).should have_selector(&quot;li&quot;, :id=&gt;&quot;this&quot;)
+  end
+  
   it &quot;should produce a dev flag on a first-version draft&quot; do
     page = pages(:draft)
     helper.timeline(page).should have_version(1).as(:draft) do |li|
@@ -64,6 +69,10 @@ describe Admin::TimelineHelper do
     end
   end
   
+  it &quot;should make the line fade out when the timeline does not begin with version 1&quot; do
+    pending # timeline limit is not implemented yet, but class=&quot;beginning&quot; on the LI will make the line fade
+  end
+  
   def have_marker(type=nil)
     opts = {:class=&gt;&quot;marker&quot;}
     if type</diff>
      <filename>spec/helpers/admin/timeline_helper_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -2,9 +2,9 @@ module Webrat
   module Matchers
     
     class TimelineTags &lt; HaveSelector
-      def initialize(version_number = nil, &amp;block)
+      def initialize(version_number = nil, options = {}, &amp;block)
         @expected = &quot;li&quot;
-        @options  = {:id=&gt;&quot;version-#{version_number.to_s}&quot;}
+        @options  = options.merge(:id=&gt;&quot;version-#{version_number.to_s}&quot;)
         @block    = block
         @version_number = version_number
       end
@@ -32,8 +32,8 @@ module Webrat
     
     # timeline.should have_version(version_number)
     # timeline.should have_version(version_number).as(status)
-    def have_version(version_number)
-      TimelineTags.new(version_number)
+    def have_version(version_number, options={})
+      TimelineTags.new(version_number, options)
     end
 
   end</diff>
      <filename>spec/matchers/timeline_matcher.rb</filename>
    </modified>
    <modified>
      <diff>@@ -3,6 +3,16 @@ require File.dirname(__FILE__) + '/../spec_helper'
 describe Version do
   dataset :versions
   
+  it &quot;should be only visible in dev mode when status is draft&quot; do
+    version = pages(:draft).versions.current
+    version.should be_only_visible_in_dev_mode
+  end
+  
+  it &quot;should be only visible in dev mode when status is reviewed&quot; do
+    version = pages(:reviewed).versions.current
+    version.should be_only_visible_in_dev_mode
+  end
+  
   it &quot;should respond to #instance&quot; do
     version = pages(:page_with_draft).versions.current
     version.instance.should be_a(Page)</diff>
      <filename>spec/models/version_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>3faa62b8ef874e8817e26dc454e373d8017c8fbe</id>
    </parent>
  </parents>
  <author>
    <name>Jason Garber</name>
    <email>jg@jasongarber.com</email>
  </author>
  <url>http://github.com/jgarber/radiant-chronicle-extension/commit/ab08b3e529175623bdf0e620e079383e96b449cb</url>
  <id>ab08b3e529175623bdf0e620e079383e96b449cb</id>
  <committed-date>2009-04-15T14:56:49-07:00</committed-date>
  <authored-date>2009-04-15T14:56:49-07:00</authored-date>
  <message>Refactored the timeline helper and added the
&quot;this&quot; (current working version) node to the
timeline.</message>
  <tree>a5ec6bea1b6d79a1b97a10b6ed7d96ae7c15d0ad</tree>
  <committer>
    <name>Jason Garber</name>
    <email>jg@jasongarber.com</email>
  </committer>
</commit>
