<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>script/console</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -28,6 +28,10 @@ class PageOptions
     @sort_order || 'ASC'
   end
   
+  def sort_column?(column)
+    column.human_name == sort_column
+  end
+  
   def active_record_order_option
     if self.sort_column &amp;&amp; self.sort_order
       {:order =&gt; [self.sort_column, self.sort_order].map{|x| x.tr(&quot; &quot;, &quot;_&quot;)}.join(&quot; &quot;)}</diff>
      <filename>lib/page_options.rb</filename>
    </modified>
    <modified>
      <diff>@@ -87,5 +87,12 @@ END
     &quot;#{fragment}::#{name}::#{item.id}::#{class_name}#{'::win' if in_window}&quot;
   end
   
+  def render_th(context,view)
+    x = Builder::XmlMarkup.new
+    x.th(:scope=&gt;&quot;col&quot;) {
+      x &lt;&lt; human_name
+    }
+  end
+  
 end
 </diff>
      <filename>lib/streamlined/column/association.rb</filename>
    </modified>
    <modified>
      <diff>@@ -19,4 +19,20 @@ class Streamlined::Column::Base
     end
     content
   end
+  # TODO: make a streamlined_context that delegates to pageoptions, etc.
+  def sort_image(context, view)
+    if context.sort_column?(self)
+      direction = context.ascending? ? 'up' : 'down'
+      view.image_tag(&quot;streamlined/arrow-#{direction}_16.png&quot;, {:height =&gt; '10px', :border =&gt; 0})
+    else
+      ''
+    end
+  end
+  def render_th(context,view)
+    x = Builder::XmlMarkup.new
+    x.th(:scope=&gt;&quot;col&quot;, :class=&gt;&quot;sortSelector&quot;) {
+      x &lt;&lt; human_name
+      x &lt;&lt; sort_image(context,view)
+    }
+  end
 end
\ No newline at end of file</diff>
      <filename>lib/streamlined/column/base.rb</filename>
    </modified>
    <modified>
      <diff>@@ -66,7 +66,7 @@ module Streamlined::Controller::CrudMethods
      #     flash[:info] = @controller.list_notice_info if @controller.respond_to?( &quot;list_notice_info&quot; )
      # end
     render :partial =&gt; 'list' if request.xhr?
-    render :template =&gt; generic_view('atom'), :controler =&gt; @model_name, :layout =&gt; false if params[:syndicated]
+    render :template =&gt; generic_view('atom'), :controller =&gt; @model_name, :layout =&gt; false if params[:syndicated]
   end
    # Renders the Show view for a given instance.
    def show</diff>
      <filename>lib/streamlined/controller/crud_methods.rb</filename>
    </modified>
    <modified>
      <diff>@@ -37,17 +37,6 @@ END
     image_tag(image, options) if(File.exist?File.join(RAILS_ROOT, 'public', 'images', image)) 
   end
   
-  # TODO: move this onto mixin that mixes into AR Column and into Streamlined Column
-  # column_sort_image(page_options.sort_column, column.human_name, page_options.sort_order)
-  def column_sort_image(page_options, column)
-    if page_options.sort_column == column.human_name
-      direction = page_options.ascending? ? 'up' : 'down'
-      image_tag(&quot;streamlined/arrow-#{direction}_16.png&quot;, {:height =&gt; '10px', :border =&gt; 0})
-    else
-      ''
-    end
-  end
-  
   # invisible links are plucked out by unobtrusive JavaScript to add functionality
   def invisible_link_to(options = {}, html_options={}, *parms)
     link_to('', options, html_options.merge(:style=&gt;&quot;display:none;&quot;), *parms)    </diff>
      <filename>lib/streamlined/helper.rb</filename>
    </modified>
    <modified>
      <diff>@@ -2,7 +2,7 @@
   &lt;thead&gt;
 	&lt;tr&gt;
   &lt;% list_columns_for_model(@model, @model_ui, params[:controller]).each do |column| %&gt;
-    &lt;th scope=&quot;col&quot; class=&quot;sortSelector&quot;&gt;&lt;%= column.human_name %&gt;&lt;%= column_sort_image(@page_options, column)%&gt;&lt;/th&gt;
+    &lt;%= column.render_th(@page_options, self )%&gt;
   &lt;% end %&gt;
   &lt;%= streamlined_table_row_button_header %&gt;
   &lt;/tr&gt;</diff>
      <filename>templates/generic_views/_list.rhtml</filename>
    </modified>
    <modified>
      <diff>@@ -24,4 +24,21 @@ class Streamlined::Column::BaseTest &lt; Test::Unit::TestCase
     assert_equal '&lt;span class=&quot;sl-popup&quot;&gt;&lt;a href=&quot;/people/foo/1&quot; style=&quot;display:none;&quot;&gt;&lt;/a&gt;Justin&lt;/span&gt;', @ui.column(:first_name).render_td(@view,people(:justin),@ui,@controller)
   end
   
+  def test_sort_image_up
+    options = PageOptions.new(:sort_column=&gt;&quot;First name&quot;)
+    assert_equal &quot;&lt;img alt=\&quot;Arrow-up_16\&quot; border=\&quot;0\&quot; height=\&quot;10px\&quot; src=\&quot;/images/streamlined/arrow-up_16.png\&quot; /&gt;&quot;, 
+                 @ui.column(:first_name).sort_image(options,@view)
+  end
+
+  def test_sort_image_down
+    options = PageOptions.new(:sort_column=&gt;&quot;First name&quot;, :sort_order=&gt;&quot;DESC&quot;)
+    assert_equal &quot;&lt;img alt=\&quot;Arrow-down_16\&quot; border=\&quot;0\&quot; height=\&quot;10px\&quot; src=\&quot;/images/streamlined/arrow-down_16.png\&quot; /&gt;&quot;, 
+                 @ui.column(:first_name).sort_image(options,@view)
+  end
+
+  def test_sort_image_none
+    options = PageOptions.new
+    assert_equal '', @ui.column(:first_name).sort_image(options,nil)
+  end
+  
 end
\ No newline at end of file</diff>
      <filename>test/functional/streamlined/column/base_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -24,4 +24,11 @@ class PageOptionsTest &lt; Test::Unit::TestCase
     assert_equal({}, o.active_record_order_option)
   end
   
+  def test_sort_column
+    o = PageOptions.new
+    column = Struct.new(:human_name).new(&quot;foo&quot;)
+    assert_equal false, o.sort_column?(column)
+    o.sort_column = &quot;foo&quot;
+    assert_equal true, o.sort_column?(column)
+  end
 end
\ No newline at end of file</diff>
      <filename>test/unit/page_options_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -3,42 +3,6 @@ require 'streamlined/helper'
 
 module Streamlined; end
 class Streamlined::HelperTest &lt; Test::Unit::TestCase
-  include FlexMock::TestCase
-  include Streamlined::Helper
-
-  def column_named_name
-    column = flexmock(&quot;column&quot;)
-    column.should_expect do |o|
-      o.human_name.returns(&quot;name&quot;)
-    end
-    column
-  end
-  
-  def test_column_sort_image_up
-    options = flexmock(&quot;options&quot;)
-    options.should_expect do |o|
-      o.sort_column.returns(&quot;name&quot;)
-      o.ascending?.returns(true)
-    end
-    flexstub(self).should_receive(:image_tag).with(&quot;streamlined/arrow-up_16.png&quot;, Hash).and_return(&quot;testing up&quot;)
-    assert_equal(&quot;testing up&quot;, column_sort_image(options,column_named_name))
-  end
-
-  def test_column_sort_image_down
-    options = flexmock(&quot;options&quot;)
-    options.should_expect do |o|
-      o.sort_column.returns(&quot;name&quot;)
-      o.ascending?.returns(false)
-    end
-    flexstub(self).should_receive(:image_tag).with(&quot;streamlined/arrow-down_16.png&quot;, Hash).and_return(&quot;testing down&quot;)
-    assert_equal(&quot;testing down&quot;, column_sort_image(options,column_named_name))
-  end
-
-  def test_column_sort_image_none
-    options = flexmock(&quot;options&quot;)
-    options.should_expect do |o|
-      o.sort_column.returns(&quot;foo&quot;)
-    end
-    assert_equal(&quot;&quot;, column_sort_image(options,column_named_name))
+  def test_truth
   end
 end</diff>
      <filename>test/unit/streamlined_helper_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>782fc00b5040fae7cc129f41797a3f5478c58e83</id>
    </parent>
  </parents>
  <author>
    <name>stu</name>
    <email>stu@4f249914-c612-0410-8deb-f4485a9d85ab</email>
  </author>
  <url>http://github.com/relevance/streamlined/commit/9e95dbbb557f9020d3c3ecb54bdfd92b5925bd8b</url>
  <id>9e95dbbb557f9020d3c3ecb54bdfd92b5925bd8b</id>
  <committed-date>2007-03-15T09:40:21-07:00</committed-date>
  <authored-date>2007-03-15T09:40:21-07:00</authored-date>
  <message>sort moving into columns</message>
  <tree>f1545a214b2d3291617b575d2a6d85c81ef45d03</tree>
  <committer>
    <name>stu</name>
    <email>stu@4f249914-c612-0410-8deb-f4485a9d85ab</email>
  </committer>
</commit>
