Added button to discard a reply to a comment. #55

Closed
wants to merge 1 commit into
from
View
3 app/views/comments/_form.html.erb
@@ -72,6 +72,9 @@ puts "code block"
<% end %>
<div class="actions">
<%= f.submit(@comment.new_record? ? "Post Comment" : "Update Comment") %>
+ <% if params[:controller] == "comments" %>
+ <%= link_to "Discard", "#", :class => "remove_comment" %>
+ <% end %>
</div>
<% end %>
</div>
View
7 public/javascripts/application.js
@@ -60,5 +60,12 @@ $(function() {
$(this).children(".clippy_label").text("copied");
}
});
+
+ // Remove reply-to-comment field
+ $(".nested_comments").delegate(".remove_comment", "click", function() {
+ $(this).closest("div#new_comment").remove();
+
+ return false;
+ });
}
});