<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -14,13 +14,18 @@ class CategoriesController &lt; ResourceController::Base
       end
       format.html do
         # updating from submission of #batch_edit form
-        params[:existing_categories].each do |id, category_attrs|
+        @categories = []
+        all_saved = params[:existing_categories].all? do |id, category_attrs|
           category = Category.find_by_id(id)
+          @categories &lt;&lt; category
           category.update_attributes(category_attrs)
         end
-        
-        # TODO: update all categories
-        redirect_to categories_path
+        if all_saved
+          # no failures
+          redirect_to categories_path
+        else
+          render :action =&gt; 'batch_edit'
+        end
       end
     end
   end</diff>
      <filename>app/controllers/categories_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,5 @@
 class Category &lt; ActiveRecord::Base
-  DISALLOWED_PERMALINKS = %w{public admin categories posts users tags}
+  DISALLOWED_PERMALINKS = %w{public admin categories posts users tags batch_edit batch_update}
   validates_exclusion_of :permalink, :in =&gt; DISALLOWED_PERMALINKS
   
   validates_presence_of   :name</diff>
      <filename>app/models/category.rb</filename>
    </modified>
    <modified>
      <diff>@@ -10,4 +10,6 @@ class Post &lt; ActiveRecord::Base
   
   belongs_to :category
   validates_presence_of :category
+  
+  validates_presence_of :body
 end</diff>
      <filename>app/models/post.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,15 +1,16 @@
 - form_for @category do |f|
   = f.error_messages
   
-  .required
-    = f.label :name
-    = f.text_field :name
-  - unless @category.new_record?
-    .optional.unlockable
-      = f.label :permalink
-      = f.text_field :permalink, :disabled =&gt; true
-  .optional
-    = f.label :include_in_header, 'Include in header?'
-    = f.check_box :include_in_header
-  %p
+  %fieldset
+    .required
+      = f.label :name
+      = f.text_field :name
+    - unless @category.new_record?
+      .optional.unlockable
+        = f.label :permalink
+        = f.text_field :permalink, :disabled =&gt; true
+    .optional
+      = f.label :include_in_header, 'Include in header?'
+      = f.check_box :include_in_header
+  %fieldset.buttons
     = f.submit 'Create'
\ No newline at end of file</diff>
      <filename>app/views/categories/_form.html.haml</filename>
    </modified>
    <modified>
      <diff>@@ -10,5 +10,10 @@
     .optional
       = f.label :permalink
       = f.text_field :permalink, :disabled =&gt; true
+  %fieldset
+    %legend Main information
+    .required
+      = f.label :body
+      = f.text_area :body
   %fieldset.buttons
-    = f.submit 'Create'
\ No newline at end of file
+    = f.submit @post.new_record? ? 'Create' : 'Update'
\ No newline at end of file</diff>
      <filename>app/views/posts/_form.html.haml</filename>
    </modified>
    <modified>
      <diff>@@ -4,6 +4,8 @@ class CreatePosts &lt; ActiveRecord::Migration
       t.belongs_to :category
       t.string :title
       t.string :permalink
+      
+      t.text :body
 
       t.timestamps
       </diff>
      <filename>db/migrate/20080722141106_create_posts.rb</filename>
    </modified>
    <modified>
      <diff>@@ -80,3 +80,37 @@ a.unlock_button {
   text-indent: -9999px; }
   a.unlock_button:hover {
     background-color: #ccc; }
+
+/* FORMS */
+form fieldset {
+  border-top: 1px solid #000;
+  padding: 1em; }
+  form fieldset legend {
+    font-weight: bold;
+    margin: 0 1em;
+    padding: 0 1em; }
+  form fieldset label {
+    display: block;
+    float: left;
+    clear: left;
+    width: 6em;
+    text-align: right;
+    margin-right: 1em;
+    padding: 0.25em;
+    border: 1px solid #fff; }
+  form fieldset .optional, form fieldset .required {
+    clear: both;
+    padding: 0.25em 0;
+    border-bottom: 1px solid #ccc; }
+  form fieldset .required label {
+    font-weight: bold; }
+    form fieldset .required label:after {
+      content: '*';
+      color: red; }
+  form fieldset input, form fieldset select, form fieldset textarea {
+    padding: 0.25em;
+    border: 1px solid #333; }
+  form fieldset input, form fieldset textarea {
+    width: 30em; }
+  form fieldset.buttons input {
+    width: auto; }</diff>
      <filename>public/stylesheets/application.css</filename>
    </modified>
    <modified>
      <diff>@@ -106,4 +106,42 @@ a.unlock_button
   :text-indent -9999px
   &amp;:hover
     :background-color #ccc
-  
\ No newline at end of file
+
+
+/* FORMS
+
+form
+  fieldset
+    :border-top 1px solid #000
+    :padding 1em
+    legend
+      :font-weight bold
+      :margin 0 1em
+      :padding 0 1em
+    label
+      :display block
+      :float left
+      :clear left
+      :width 6em
+      :text-align right
+      :margin-right 1em
+      :padding 0.25em
+      :border 1px solid #fff
+    .optional, .required
+      :clear both
+      :padding 0.25em 0
+      :border-bottom 1px solid #ccc
+    .required
+      label
+        :font-weight bold
+        &amp;:after
+          :content '*'
+          :color red
+    input, select, textarea
+      :padding 0.25em
+      :border 1px solid #333
+    input, textarea
+      :width 30em
+    &amp;.buttons
+      input
+        :width auto
\ No newline at end of file</diff>
      <filename>public/stylesheets/sass/application.sass</filename>
    </modified>
    <modified>
      <diff>@@ -402,7 +402,15 @@ describe CategoriesController do
     end
     
     describe 'with failed save' do
-      it &quot;should re-render the batch_edit form&quot; 
+      before(:each) do
+        @category_98.stub!(:update_attributes).and_return(false)
+      end
+      
+      it &quot;should re-render the batch_edit form&quot; do
+        @category_98.should_receive(:update_attributes).and_return(false)
+        do_put_batch_update_with_html
+        response.should render_template('batch_edit')
+      end
     end
   end
 end</diff>
      <filename>spec/controllers/categories_controller_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -28,4 +28,8 @@ describe Post do
   it &quot;should require a category&quot; do
     @post.should validate_presence_of(:category)
   end
+  
+  it &quot;should require a body&quot; do
+    @post.should validate_presence_of(:body)
+  end
 end</diff>
      <filename>spec/models/post_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -4,11 +4,12 @@ describe &quot;/posts/new.html.haml&quot; do
   include PostsHelper
   
   before(:each) do
-    @post = mock_model(Post)
-    @post.stub!(:category_id).and_return(1)
-    @post.stub!(:new_record?).and_return(true)
-    @post.stub!(:title).and_return(&quot;MyString&quot;)
-    @post.stub!(:permalink).and_return(&quot;MyString&quot;)
+    @post = mock_model(Post,
+      :category_id =&gt; 1,
+      :new_record? =&gt; true,
+      :title =&gt; &quot;MyTitle&quot;,
+      :permalink =&gt; &quot;my-permalink&quot;,
+      :body =&gt; 'My body text')
 
     @category = mock_model(Category, :name =&gt; 'MyCategory')
     Category.stub!(:find).and_return([@category])
@@ -22,9 +23,11 @@ describe &quot;/posts/new.html.haml&quot; do
     
     response.should have_tag(&quot;form[action=?][method=post]&quot;, posts_path) do
       with_tag(&quot;input#post_title[name=?]&quot;, &quot;post[title]&quot;)
-      with_tag(&quot;input#post_permalink[name=?]&quot;, &quot;post[permalink]&quot;)
+      with_tag(&quot;input#post_permalink[name=?][disabled=disabled]&quot;, &quot;post[permalink]&quot;)
+      with_tag('textarea#post_body[name=?]', 'post[body]')
     end
   end
+  
 end
 
 </diff>
      <filename>spec/views/posts/new.html.haml_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>app/views/posts/edit.html.erb</filename>
    </removed>
    <removed>
      <filename>app/views/posts/show.html.erb</filename>
    </removed>
    <removed>
      <filename>spec/views/posts/edit.html.erb_spec.rb</filename>
    </removed>
    <removed>
      <filename>spec/views/posts/show.html.erb_spec.rb</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>7fa817ede458bb5e4a0fade251d28705f44678ce</id>
    </parent>
  </parents>
  <author>
    <name>Scott Matthewman</name>
    <email>scott@matthewman.net</email>
  </author>
  <url>http://github.com/scottmatthewman/breakr/commit/d1295d36ca604803aa709ecc6f6f51c7e7ad121b</url>
  <id>d1295d36ca604803aa709ecc6f6f51c7e7ad121b</id>
  <committed-date>2008-08-05T05:09:02-07:00</committed-date>
  <authored-date>2008-08-05T05:09:02-07:00</authored-date>
  <message>Added body text to post</message>
  <tree>20715eb8664af9549d75fd52bf66a585fe4f3ab9</tree>
  <committer>
    <name>Scott Matthewman</name>
    <email>scott@matthewman.net</email>
  </committer>
</commit>
