Permalink
Browse files

Destroying comments.

  • Loading branch information...
1 parent c18b1c9 commit 69359448fa4c33108407bc39ab133d2c83ea2d2b @tute committed Apr 30, 2012
View
@@ -16,3 +16,7 @@
* By default it calls to_s on commenter name. You may want to alias it to name
for example, so it doesn't show the Ruby "ugly" object.
+
+# To-do
+
+* How to reopen parrot's subclasses from parent applications?
@@ -24,6 +24,13 @@ def create
respond_with @comment, :location => commentable
end
+ # FIXME: Do ACL
+ def destroy
+ @comment = Comment.find params[:id]
+ @comment.destroy
+ respond_with @comment, :location => commentable
+ end
+
# Following methods should belong to ApplicationController
def commentable_fk
commentable_fk = params.select{|k,v| k =~ /_id/ }.keys.first
@@ -2,9 +2,9 @@
<h5>
<%= t('date.formats.on') %>
<%= parse_date(comment.created_at, t('date.formats.datetime')) %>
- <% if current_user.present? && current_user == comment.user %>
+ <% if current_user.present? && current_user == comment.author %>
<%= t('orders.show.you_wrote').html_safe %>:
- <%= button_to t('buttons.destroy'), comment, confirm: t('messages.are_you_sure'), method: :delete, class: 'btn info' %>
+ <%= button_to t('buttons.destroy'), [comment.commentable, comment], confirm: t('messages.are_you_sure'), method: :delete, class: 'btn btn-danger' %>
<% else %>
<strong><%= comment.author %></strong> <%= t('orders.show.wrote') %>:
<% end %>
@@ -17,6 +17,6 @@
<%= f.text_area :body %>
</div>
<div class="actions">
- <%= f.submit %>
+ <%= f.submit class: 'btn btn-success' %>
</div>
<% end %>

0 comments on commit 6935944

Please sign in to comment.