<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,3 +1,5 @@
+06/23/08 - added Sandro's patch for help text below edit fields [Matthew Bass]
+
 06/16/08 - fixed partial rendering calls that had been missed during RC3 refactoring [Matthew Bass]
 
 05/07/08 - added quick_show_button option for hiding the show button on the list view [Matthew Bass]</diff>
      <filename>CHANGELOG</filename>
    </modified>
    <modified>
      <diff>@@ -12,6 +12,7 @@ body        { margin: 0; font-family: &quot;Lucida Grande&quot;, Verdana, Arial;}
 #ft         { background-color: #7594A1; margin-top: -16px; }
 .clear      { clear:  both;   overflow:  hidden;  width:  1px;   height:  1px;  margin:   0  -1px  -1px  0;   border:  0;  padding:   0;  font-size:  0;  line-height:   0;  }
 #streamlined_breadcrumb { font-size: 80%; font-weight: bold; margin-top: 5px; margin-bottom: 5px;}
+.streamlined_help { font-size: 80%; }
 
 /*----------------------------------*/
 </diff>
      <filename>files/public/stylesheets/streamlined.css</filename>
    </modified>
    <modified>
      <diff>@@ -104,7 +104,7 @@ class Streamlined::Column::ActiveRecord &lt; Streamlined::Column::Base
       options = custom_value ? html_options.merge(:value =&gt; custom_value) : html_options
       result = view.input(model_underscore, name, options)
     end
-    wrap(result)
+    append_help(result)
   end
   alias :render_td_new :render_td_edit
   </diff>
      <filename>lib/streamlined/column/active_record.rb</filename>
    </modified>
    <modified>
      <diff>@@ -133,7 +133,7 @@ class Streamlined::Column::Association &lt; Streamlined::Column::Base
       result = view.select(model_underscore, name_as_id, choices, { :selected =&gt; selected_choice }, html_options)
       result += render_quick_add(view) if should_render_quick_add?(view)
     end
-    wrap(result)
+    append_help(result)
   end 
   alias :render_td_new :render_td_edit
   </diff>
      <filename>lib/streamlined/column/association.rb</filename>
    </modified>
    <modified>
      <diff>@@ -6,7 +6,7 @@ class Streamlined::Column::Base
   include ERB::Util
   
   attr_accessor :human_name, :link_to, :popup, :parent_model, :wrapper, :additional_column_pairs,
-                :additional_includes, :filter_column
+                :additional_includes, :filter_column, :help
   
   attr_with_default :human_name_explicitly_set, 'false'
   attr_with_default :read_only, 'false'
@@ -112,10 +112,11 @@ class Streamlined::Column::Base
   
   def render_td(view, item)
     if read_only
-      render_td_show(view, item)
+      result = render_td_show(view, item)
     else
-      send &quot;render_td_#{view.crud_context}&quot;, view, item
+      result = send(&quot;render_td_#{view.crud_context}&quot;, view, item)
     end
+    wrap(result)
   end
   
   [:show, :edit, :list, :new].each do |meth|
@@ -194,6 +195,12 @@ class Streamlined::Column::Base
     end
   end
   
+  def append_help(html)
+    x = Builder::XmlMarkup.new
+    x.div(:class =&gt; &quot;streamlined_help&quot;) { x &lt;&lt; help } unless help.blank?
+    html &lt;&lt; x.target!
+  end
+  
   def is_displayable_in_context?(view, item)
     # TODO: extract this nastiness into a class?  Only if we see one more need for objectified crud contexts!!!!!!
     column_answer = case view.crud_context</diff>
      <filename>lib/streamlined/column/base.rb</filename>
    </modified>
    <modified>
      <diff>@@ -88,25 +88,6 @@ describe &quot;AssociationFunctional&quot; do
     end                                       
     assert_people_quick_add_link(html)                          
   end
-
-  it &quot;render td edit with wrapper set&quot; do
-    stock_controller_and_view              
-    @association = Association.new(Poem.reflect_on_association(:poet), Poem, :inset_table, :count) 
-    @association.wrapper = Proc.new { |c| &quot;&lt;div id='wrapper'&gt;#{c}&lt;/div&gt;&quot; }
-    html = @association.render_td_edit(@view, poems(:limerick))
-    assert_select root_node(html), &quot;div&quot; do 
-      assert_select &quot;select[id=poem_poet_id]&quot; do
-        assert_select &quot;option[value=]&quot;, &quot;Unassigned&quot;
-        assert_select &quot;option[value=1]&quot;, &quot;1&quot;
-        assert_select &quot;option[value=2][selected=selected]&quot;, &quot;2&quot;
-      end                                       
-      assert_select &quot;a&quot; do
-        assert_select &quot;[href=?]&quot;, %r{/people/quick_add\?.*}  
-        assert_select &quot;[href=?]&quot;, %r{.*select_id=poem_poet_id.*}
-        assert_select &quot;[href=?]&quot;, %r{.*model_class_name=Poet.*}
-      end                
-    end
-  end 
   
   it &quot;render td edit with options for select&quot; do
     stock_controller_and_view</diff>
      <filename>test/functional/association_functional_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -89,7 +89,7 @@ describe &quot;Streamlined::Column::ActiveRecord&quot; do
   end
   
   it &quot;render td edit&quot; do
-    (view = flexmock).should_receive(:input).with('model', 'column', {}).once
+    (view = mock).expects(:input).with('model', 'column', {}).returns('input').once
     @ar.render_td_edit(view, 'item')
   end
   
@@ -101,14 +101,15 @@ describe &quot;Streamlined::Column::ActiveRecord&quot; do
   
   it &quot;render td edit with checkbox&quot; do
     @ar.check_box = true
-    (view = flexmock).should_receive(:check_box).with('model', 'column', {}).once
+    (view = mock).expects(:check_box).with('model', 'column', {}).returns('input').once
     @ar.render_td_edit(view, 'item')
   end
   
-  it &quot;render td edit with wrapper&quot; do
-    @ar.wrapper = Proc.new { |c| &quot;&lt;&lt;&lt;#{c}&gt;&gt;&gt;&quot; }
-    (view = flexmock).should_receive(:input).with('model', 'column', {}).and_return('result').once
-    assert_equal '&lt;&lt;&lt;result&gt;&gt;&gt;', @ar.render_td_edit(view, 'item')
+  it &quot;render td edit with help&quot; do
+    view = stub(:input =&gt; &quot;content&quot;)
+    @ar.help = &quot;This is an optional field&quot;
+    expected = &quot;content&lt;div class=\&quot;streamlined_help\&quot;&gt;This is an optional field&lt;/div&gt;&quot;
+    @ar.render_td_edit(view, 'item').should == expected
   end
   
   it &quot;render td edit with html options&quot; do</diff>
      <filename>test/unit/streamlined/column/active_record_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -156,6 +156,14 @@ describe &quot;Streamlined::Column::Association&quot; do
     assert_equal &quot;select&quot;, @association.render_td_edit(view, item)
   end
   
+  it &quot;render td edit with help&quot; do
+    flexmock(SomeClass).stubs(:custom_options).returns([:foo])
+    @association.options_for_select = :custom_options
+    @association.help = &quot;This is an optional field&quot;
+    expected = &quot;select&lt;div class=\&quot;streamlined_help\&quot;&gt;This is an optional field&lt;/div&gt;&quot;
+    @association.render_td_edit(*view_and_item_mocks_for_render_td_edit).should == expected
+  end
+  
   private
   def view_and_item_mocks(view_attrs={})
     view = flexmock(:render =&gt; 'render', :controller_path =&gt; 'controller_path', :link_to_function =&gt; 'link')
@@ -164,9 +172,9 @@ describe &quot;Streamlined::Column::Association&quot; do
   end
 
   def view_and_item_mocks_for_render_td_edit(options={:unassigned_value =&gt; 'Unassigned'})
-    item = flexmock(:respond_to? =&gt; true, :some_name =&gt; nil)
-    (view = flexmock).should_receive(:select).with('model', 'some_name_id', [[options[:unassigned_value], nil], :foo], { :selected =&gt; nil }, {}).and_return(&quot;select&quot;).once
-    flexmock(@association) do |mock|
+    item = flexmock(&quot;item&quot;, :respond_to? =&gt; true, :some_name =&gt; nil)
+    (view = flexmock(&quot;view&quot;)).should_receive(:select).with('model', 'some_name_id', [[options[:unassigned_value], nil], :foo], { :selected =&gt; nil }, {}).and_return(&quot;select&quot;).once
+    flexmock(&quot;association&quot;, @association) do |mock|
       mock.should_receive(:column_can_be_unassigned?).with(@model, &quot;some_name&quot;).and_return(true).once
       mock.should_receive(:has_many? =&gt; false).once
       mock.should_receive(:belongs_to? =&gt; true).once</diff>
      <filename>test/unit/streamlined/column/association_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -74,6 +74,13 @@ describe &quot;Streamlined::Column::Base&quot; do
                       &quot;The set of render_ methods has changed. Make sure the semantics of renderer= are correct, then fix this test to pass again.&quot;
   end
   
+  it &quot;render td with wrapper&quot; do
+    view = stub(:crud_context =&gt; :edit)
+    item = stub(:send =&gt; &quot;content&quot;)
+    @addition.wrapper = Proc.new { |c| &quot;&lt;&lt;&lt;#{c}&gt;&gt;&gt;&quot; }
+    assert_equal '&lt;&lt;&lt;content&gt;&gt;&gt;', @addition.render_td(view, item)
+  end
+  
   it &quot;renderer block that does not yield&quot; do
     @addition.render_wrapper = Proc.new {|old_meth, *args| &quot;#{old_meth.name} rendered!&quot;}
     @addition.renderers.each do |renderer|</diff>
      <filename>test/unit/streamlined/column/base_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>4217493fa76901f5febce33d059224ff4938e437</id>
    </parent>
  </parents>
  <author>
    <name>matthew</name>
    <email>matthew@4f249914-c612-0410-8deb-f4485a9d85ab</email>
  </author>
  <url>http://github.com/relevance/streamlined/commit/7ae37c7f0a0e5783b893b981109f9eca1391fa55</url>
  <id>7ae37c7f0a0e5783b893b981109f9eca1391fa55</id>
  <committed-date>2008-06-23T18:03:26-07:00</committed-date>
  <authored-date>2008-06-23T18:03:26-07:00</authored-date>
  <message>moved wrapper call into column base, added help attr that prints below edit fields</message>
  <tree>0cc41820f8b0800891f6a408c0b5ee35973dac0f</tree>
  <committer>
    <name>matthew</name>
    <email>matthew@4f249914-c612-0410-8deb-f4485a9d85ab</email>
  </committer>
</commit>
