<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>app/views/pages/_timeline.html.erb</filename>
    </added>
    <added>
      <filename>server</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -12,7 +12,8 @@ class PagesController &lt; ApplicationController
   
   def index
     @pages = Page.paginate :page =&gt; params[:page], :order =&gt; 'total_pageviews DESC'  
-
+    @page = Page.first(:order =&gt; 'total_pageviews desc')
+    
     respond_to do |format|
       format.html # index.html.erb
       format.xml  { render :xml =&gt; @pages }
@@ -24,25 +25,6 @@ class PagesController &lt; ApplicationController
   def show
     @page = Page.find(params[:id])
 
-    # @data = {
-    #   1.day.ago =&gt; { :foo=&gt;123, :bar=&gt;100 },
-    #   2.day.ago =&gt; { :foo=&gt;345, :bar=&gt;200 },
-    #   3.day.ago =&gt; { :foo=&gt;445, :bar=&gt;120 }, 
-    #   4.day.ago =&gt; { :foo=&gt;425, :bar=&gt;140 }, 
-    #   5.day.ago =&gt; { :foo=&gt;515, :bar=&gt;107 }                    
-    # }
-
-    rawdates = JSON.parse(@page.daily_timeline.dates)
-    pageviews = JSON.parse(@page.daily_timeline.pageviews)
-    
-    # TODO: move this out to the model
-    
-    @data ={}
-    rawdates.each_with_index do |date, index|
-      @data[DateTime.strptime( date.to_s, &quot;%Y%m%d&quot;)] = {:page_views =&gt; pageviews[index]}
-    end
-
-
     respond_to do |format|
       format.html # show.html.erb
       format.xml  { render :xml =&gt; @page }</diff>
      <filename>app/controllers/pages_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,6 @@
 class Page &lt; ActiveRecord::Base
   has_one :daily_timeline
   named_scope :title_like, lambda { |query| { :conditions =&gt; ['title like ?', &quot;#{query}%&quot;], :order =&gt; '`total_pageviews` DESC', :limit =&gt; 20 } }
-
   
   def normed_daily_pageviews
     @pageviews = JSON.parse(self.daily_timeline.pageviews)
@@ -17,7 +16,7 @@ class Page &lt; ActiveRecord::Base
     return sorted_pageviews
   end
   
-  def chart
+  def sparkline
     # todo: move the data fetching out to the model
     # prepare some nice charts here 
     # dataset = GC4R::API::GoogleChartDataset.new :data =&gt; (1..30).map{ rand(100) }, :color =&gt; '0000FF'   
@@ -30,4 +29,15 @@ class Page &lt; ActiveRecord::Base
     return @chart
   end  
   
+  def timeline
+    rawdates = JSON.parse(self.daily_timeline.dates)
+    pageviews = JSON.parse(self.daily_timeline.pageviews)
+        
+    @data ={}
+    rawdates.each_with_index do |date, index|
+      @data[DateTime.strptime( date.to_s, &quot;%Y%m%d&quot;)] = {:page_views =&gt; pageviews[index]}
+    end
+    return @data
+  end
+  
 end</diff>
      <filename>app/models/page.rb</filename>
    </modified>
    <modified>
      <diff>@@ -11,7 +11,7 @@
 &lt;/head&gt;
 &lt;body&gt;
 
-&lt;%= render :partial=&gt;&quot;pages/search_pane&quot; %&gt;
+Search Articles: &lt;%= render :partial=&gt;&quot;pages/search_pane&quot; %&gt;
 
 &lt;p style=&quot;color: green&quot;&gt;&lt;%= flash[:notice] %&gt;&lt;/p&gt;
 </diff>
      <filename>app/views/layouts/pages.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,9 @@
-&lt;h1&gt;Top Wikipedia Articles (Last 30 Days)&lt;/h1&gt;
+&lt;h2&gt; Top Article this month:&lt;/h2&gt;
+&lt;div id = &quot;timeline_chart&quot;&gt;
+ &lt;%= render :partial =&gt; &quot;timeline&quot;  %&gt;
+&lt;/div&gt;
+
+&lt;h2&gt;Top Wikipedia Articles (Last 30 Days)&lt;/h2&gt;
 
 &lt;table&gt;
   &lt;tr&gt;
@@ -12,7 +17,7 @@
   &lt;tr&gt;
     &lt;td&gt;&lt;%= index +1 %&gt;&lt;/td&gt;
     &lt;td&gt;&lt;%= number_with_delimiter(page.total_pageviews, ',') %&gt;&lt;/td&gt;  
-    &lt;td&gt;&lt;%= link_to page.title, page  %&gt;&lt;BR&gt;&lt;%= image_tag page.chart.to_url %&gt; &lt;/td&gt;
+    &lt;td&gt;&lt;%= link_to page.title, page  %&gt;&lt;BR&gt;&lt;%= image_tag page.sparkline.to_url %&gt; &lt;/td&gt;
     &lt;td&gt;&lt;%= link_to 'http://en.wikipedia.org/wiki/' + page.url, 'http://en.wikipedia.org/wiki/' + page.url %&gt;&lt;/td&gt;
   &lt;/tr&gt;
 &lt;% end %&gt;</diff>
      <filename>app/views/pages/index.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,8 @@
 
-&lt;%= inline_annotated_timeline @data, 600, 400, 'div_id_to_create' %&gt;
-
 
+&lt;div id = &quot;timeline_chart&quot;&gt;
+ &lt;%= render :partial =&gt; &quot;timeline&quot;  %&gt;
+&lt;/div&gt;
 &lt;p&gt;
   &lt;b&gt;Url:&lt;/b&gt;
   &lt;%=h @page.url %&gt;</diff>
      <filename>app/views/pages/show.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
 ActionController::Routing::Routes.draw do |map|
+  map.root :controller =&gt; &quot;pages&quot;  
   map.resources :daily_timelines
-
   map.resources :pages
 
   # The priority is based upon order of creation: first created -&gt; highest priority.</diff>
      <filename>config/routes.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>8d8ebc803662a8ba1b7661e6c1e0b20c6f941f39</id>
    </parent>
  </parents>
  <author>
    <name>Pete Skomoroch</name>
    <email>pete@datawrangling.com</email>
  </author>
  <url>http://github.com/datawrangling/trendingtopics/commit/c3c7f9229e012474a58b92c0d3744327bed0cb1d</url>
  <id>c3c7f9229e012474a58b92c0d3744327bed0cb1d</id>
  <committed-date>2009-06-02T20:56:55-07:00</committed-date>
  <authored-date>2009-06-02T20:56:55-07:00</authored-date>
  <message>cleanup</message>
  <tree>d4cc1b135132d2d14fc5391122bd6f88f7ef7650</tree>
  <committer>
    <name>Pete Skomoroch</name>
    <email>pete@datawrangling.com</email>
  </committer>
</commit>
