<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -71,6 +71,7 @@ form.formtastic fieldset ol li p.inline-hints { color:#666; margin:0.5em 0 0 25%
 
 /* INLINE ERRORS
 --------------------------------------------------------------------------------------------------*/
+form.formtastic fieldset ol li p.inline-errors { color:red; margin:0.5em 0 0 25%; }
 form.formtastic fieldset ol li ul.errors { color:red; margin:0.5em 0 0 25%; list-style:square; }
 form.formtastic fieldset ol li ul.errors li { padding:0; border:none; display:list-item; }
 </diff>
      <filename>generators/formtastic_stylesheets/templates/formtastic.css</filename>
    </modified>
    <modified>
      <diff>@@ -71,8 +71,9 @@ module JustinFrench #:nodoc:
       @@all_fields_required_by_default = true
       @@required_string = %{&lt;abbr title=&quot;required&quot;&gt;*&lt;/abbr&gt;}
       @@optional_string = ''
+      @@inline_errors = :sentence
       
-      cattr_accessor :all_fields_required_by_default, :required_string, :optional_string
+      cattr_accessor :all_fields_required_by_default, :required_string, :optional_string, :inline_errors
       
       attr_accessor :template
       
@@ -619,15 +620,23 @@ module JustinFrench #:nodoc:
         )
       end
       
-      def inline_errors(method, options)  #:nodoc:
+      def inline_errors(method, options) #:nodoc:
         errors = @object.errors.on(method).to_a
-        list_elements = []
         unless errors.empty?
-          errors.each do |error|
-            list_elements &lt;&lt;  template.content_tag(:li, error)
-          end
+          send(&quot;error_#{@@inline_errors}&quot;, errors) if [:sentence, :list].include?(@@inline_errors)
+        end
+      end
+      
+      def error_sentence(errors) #:nodoc:
+        template.content_tag(:p, errors.to_sentence, :class =&gt; 'inline-errors')
+      end
+      
+      def error_list(errors) #:nodoc:
+        list_elements = []
+        errors.each do |error|
+          list_elements &lt;&lt;  template.content_tag(:li, error)
         end
-        list_elements.empty? ? '' : template.content_tag(:ul, list_elements.join(&quot;\n&quot;), :class =&gt; 'errors')
+        template.content_tag(:ul, list_elements.join(&quot;\n&quot;), :class =&gt; 'errors')
       end
       
       def inline_hints(method, options) #:nodoc:</diff>
      <filename>lib/justin_french/formtastic.rb</filename>
    </modified>
    <modified>
      <diff>@@ -485,24 +485,68 @@ describe 'Formtastic' do
             @errors = mock('errors')
             @errors.stub!(:on).with(:title).and_return(@title_errors)
             @new_post.stub!(:errors).and_return(@errors)
+          end
           
+          it 'should apply an errors class to the list item' do
             semantic_form_for(@new_post) do |builder| 
               concat(builder.input(:title))
             end
+            output_buffer.should have_tag('form li.error')
           end
           
-          it 'should apply an errors class to the list item' do
-            output_buffer.should have_tag('form li.error')
+          describe 'and the errors will be displayed as a sentence' do
+            
+            before do
+              JustinFrench::Formtastic::SemanticFormBuilder.inline_errors = :sentence
+              semantic_form_for(@new_post) do |builder| 
+                concat(builder.input(:title))
+              end
+            end
+            
+            it 'should render a paragraph with the errors joined into a sentence' do
+              output_buffer.should have_tag('form li.error p.inline-errors', @title_errors.to_sentence)
+            end
+            
           end
           
-          it 'should render an unordered list with the class errors' do
-            output_buffer.should have_tag('form li.error ul.errors')
+          describe 'and the errors will be displayed as a list' do
+            
+            before do
+              JustinFrench::Formtastic::SemanticFormBuilder.inline_errors = :list
+              semantic_form_for(@new_post) do |builder| 
+                concat(builder.input(:title))
+              end
+            end
+            
+            it 'should render an unordered list with the class errors' do
+              output_buffer.should have_tag('form li.error ul.errors')
+            end
+            
+            it 'should include a list element for each of the errors within the unordered list' do
+              @title_errors.each do |error|
+                output_buffer.should have_tag('form li.error ul.errors li', error)
+              end
+            end
+            
           end
           
-          it 'should include a list element for each of the errors within the unordered list' do
-            @title_errors.each do |error|
-              output_buffer.should have_tag('form li.error ul.errors li', error)
+          describe 'but the errors will not be shown' do
+            
+            before do
+              JustinFrench::Formtastic::SemanticFormBuilder.inline_errors = :none
+              semantic_form_for(@new_post) do |builder| 
+                concat(builder.input(:title))
+              end
             end
+            
+            it 'should not display an error sentence' do
+              output_buffer.should_not have_tag('form li.error p.inline-errors')
+            end
+            
+            it 'should not display an error list' do
+              output_buffer.should_not have_tag('form li.error ul.errors')
+            end
+            
           end
           
         end
@@ -519,7 +563,7 @@ describe 'Formtastic' do
             output_buffer.should_not have_tag('form li.error')
           end          
           
-          it 'should render a paragraph for the errors' do
+          it 'should not render a paragraph for the errors' do
             output_buffer.should_not have_tag('form li.error p.inline-errors')
           end
           </diff>
      <filename>spec/formtastic_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>4a63235bf54e719d8e8b062f65c4603c487a135a</id>
    </parent>
  </parents>
  <author>
    <name>Andy Pearson</name>
    <login>andypearson</login>
    <email>andy@andy-pearson.com</email>
  </author>
  <url>http://github.com/justinfrench/formtastic/commit/9b8aaa3a0143c5c33274092280be96677c675308</url>
  <id>9b8aaa3a0143c5c33274092280be96677c675308</id>
  <committed-date>2009-01-12T13:05:47-08:00</committed-date>
  <authored-date>2009-01-12T13:05:47-08:00</authored-date>
  <message>Adding a preference to show inline errors as a sentence or a list as well as hiding them altogether (JustinFrench::Formtastic::SemanticFormBuilder.inline_errors)</message>
  <tree>084bb1428ee490e9d3af6f98e53ddcda042821fd</tree>
  <committer>
    <name>Andy Pearson</name>
    <login>andypearson</login>
    <email>andy@andy-pearson.com</email>
  </committer>
</commit>
