Changes moderation/comments to allow for different commentable_types

This commit is contained in:
kikito
2015-08-22 09:15:20 +02:00
parent 00b51bbc23
commit 4f0c49f921
4 changed files with 14 additions and 6 deletions

View File

@@ -30,6 +30,10 @@ class Comment < ActiveRecord::Base
commentable if commentable.class == Debate commentable if commentable.class == Debate
end end
def author_id
user_id
end
def author def author
user user
end end

View File

@@ -5,16 +5,18 @@
<table> <table>
<tr> <tr>
<th><%= t('moderation.comments.index.flags') %></th> <th><%= t('moderation.comments.index.flags') %></th>
<th><%= t('moderation.comments.index.debate') %></th>
<th><%= t('moderation.comments.index.comment') %></th>
<th><%= t('moderation.comments.index.updated_at') %></th> <th><%= t('moderation.comments.index.updated_at') %></th>
<th><%= t('moderation.comments.index.commentable_type') %></th>
<th><%= t('moderation.comments.index.commentable') %></th>
<th><%= t('moderation.comments.index.comment') %></th>
</tr> </tr>
<% @comments.each do |comment| %> <% @comments.each do |comment| %>
<tr id="comment_<%= comment.id %>"> <tr id="comment_<%= comment.id %>">
<td><%= comment.inappropiate_flags_count %></td> <td><%= comment.inappropiate_flags_count %></td>
<td><%= link_to(comment.debate.title, comment.debate) %></td>
<td><%= comment.body %></td>
<td><%= l comment.updated_at.to_date %></td> <td><%= l comment.updated_at.to_date %></td>
<td><%= comment.commentable_type.constantize.model_name.human %></td>
<td><%= link_to comment.commentable.title, comment.commentable %></td>
<td><%= comment.body %></td>
<td> <td>
<%= link_to t('moderation.comments.index.hide'), hide_in_moderation_screen_moderation_comment_path(comment), method: :put %> <%= link_to t('moderation.comments.index.hide'), hide_in_moderation_screen_moderation_comment_path(comment), method: :put %>
</td> </td>

View File

@@ -6,7 +6,8 @@ en:
comments: comments:
index: index:
title: Comments flagged as inappropiate title: Comments flagged as inappropiate
debate: Debate commentable_type: Type
commentable: Root
comment: Comment comment: Comment
updated_at: Date updated_at: Date
flags: Flags flags: Flags

View File

@@ -6,7 +6,8 @@ es:
comments: comments:
index: index:
title: Comentarios Denunciados como Inapropiados title: Comentarios Denunciados como Inapropiados
debate: Debate commentable_type: Tipo
commentable: Raíz
comment: Comentario comment: Comentario
updated_at: Fecha updated_at: Fecha
flags: Denuncias flags: Denuncias