<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>app/views/comments/show.js.rjs</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -33,7 +33,12 @@ class CommentsController &lt; ApplicationController
   before_filter :ensure_parent_exists, :only =&gt; :create
 
   def show
-    redirect_to &quot;#{post_path(current_object.post)}#comment_#{params[:id]}&quot;
+    respond_to do |format|
+      format.html do
+        redirect_to &quot;#{post_path(current_object.post)}#comment_#{params[:id]}&quot;
+      end
+      format.js
+    end
   end
 
   def index</diff>
      <filename>app/controllers/comments_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -7,6 +7,12 @@ module CommentsHelper
       :failure =&gt; &quot;$('comment_#{@comment.id}_content').update(#{failure_html('Save Failed').to_json})&quot;
   end
 
+  def comment_edit_cancel_action
+    remote_function :url =&gt; object_path + '.js', :method =&gt; :get,
+      :loading =&gt; &quot;$('comment_#{@comment.id}_content').spin()&quot;,
+      :failure =&gt; &quot;$('comment_#{@comment.id}_content').update(#{failure_html('Failed').to_json})&quot;
+  end
+
   def atom_title(comment)
     h((params[:post_id] ? '' : &quot;#{comment.post.title} : &quot;) +
       truncate(comment.content.gsub(/\s+/, ' '), 50))</diff>
      <filename>app/helpers/comments_helper.rb</filename>
    </modified>
    <modified>
      <diff>@@ -4,4 +4,5 @@
   = f.hidden_field :user_id
   = preview_button new_object_path, &quot;comment_#{@comment.id}_preview&quot;
   = comment_edit_save_button
+  %input.button{:type =&gt; 'button', :value =&gt; 'Cancel', :name =&gt; 'submit', :onclick =&gt; comment_edit_cancel_action}
 .content{:style =&gt; 'display: none', :id =&gt; &quot;comment_#{@comment.id}_preview&quot;}</diff>
      <filename>app/views/comments/edit.html.haml</filename>
    </modified>
    <modified>
      <diff>@@ -263,3 +263,27 @@ describe CommentsController, &quot;#edit&quot; do
     response.should render_template('edit')
   end
 end
+
+describe CommentsController, '#show' do
+  include ResourcefulController
+  include ApplicationSpecHelpers
+
+  before(:each) do
+    @parent_model = Post
+    stub_show
+
+    @comment.stubs(:post).returns(@post)
+    @post.stubs(:to_param).returns(17)
+    @post.stubs(:slug).returns('foo-bar-baz')
+  end
+
+  it &quot;should redirect to the post path on an HTML request&quot; do
+    get :show, :id =&gt; 12
+    response.should redirect_to('/posts/17-foo-bar-baz#comment_12')
+  end
+
+  it &quot;should render the comment-updating JS on a JS request&quot; do
+    get :show, :id =&gt; 12, :format =&gt; 'js'
+    response.should render_template('show')
+  end
+end</diff>
      <filename>spec/controllers/comments_controller_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>34ec495b2a47c2da8ec3f74237d50d7d6775be8d</id>
    </parent>
  </parents>
  <author>
    <name>Nathan Weizenbaum</name>
    <email>nex342@gmail.com</email>
  </author>
  <url>http://github.com/nex3/nex3-s-blog-engine/commit/589aa4ce34bcd337652dd9d9cb035188ef428461</url>
  <id>589aa4ce34bcd337652dd9d9cb035188ef428461</id>
  <committed-date>2008-04-29T00:28:37-07:00</committed-date>
  <authored-date>2008-04-29T00:28:37-07:00</authored-date>
  <message>Add a Cancel button for the comment edit form.</message>
  <tree>db417653ea0a3bd4950ad1509d88140756bbf43c</tree>
  <committer>
    <name>Nathan Weizenbaum</name>
    <email>nex342@gmail.com</email>
  </committer>
</commit>
