adds info about deleted items on comments activity

This commit is contained in:
Juanjo Bazán
2015-11-09 13:12:44 +01:00
parent dc3ecf5fab
commit 0614629d35
4 changed files with 34 additions and 1 deletions

View File

@@ -0,0 +1,27 @@
module UsersHelper
def comment_commentable_title(comment)
commentable = comment.commentable
if commentable.nil?
deleted_commentable_text(comment)
elsif commentable.hidden?
"<abbr title='#{deleted_commentable_text(comment)}'>".html_safe +
commentable.title +
"</abbr>".html_safe
else
link_to(commentable.title, commentable)
end
end
def deleted_commentable_text(comment)
case comment.commentable_type
when "Proposal"
t("users.show.deleted_proposal")
when "Debate"
t("users.show.deleted_debate")
else
t("users.show.deleted")
end
end
end

View File

@@ -2,7 +2,7 @@
<% @comments.each do |comment| %>
<tr id="debate_<%= comment.id %>">
<td>
<%= comment.commentable.hidden? ? comment.commentable.title : link_to(comment.commentable.title, comment.commentable) %>
<%= comment_commentable_title(comment) %>
<br>
<%= comment.body %>
</td>

View File

@@ -340,6 +340,9 @@ en:
other: "%{count} Comments"
no_activity: "User has no public activity"
private_activity: "This user decided to keep the activity list private"
deleted: "Deleted"
deleted_debate: "This debate has been deleted"
deleted_proposal: "This proposal has been deleted"
unauthorized:
default: "You do not have permission to access this page."
manage:

View File

@@ -340,6 +340,9 @@ es:
other: "%{count} Comentarios"
no_activity: "Usuario sin actividad pública"
private_activity: "Este usuario ha decidido mantener en privado su lista de actividades"
deleted: "Eliminado"
deleted_debate: "Este debate ha sido eliminado"
deleted_proposal: "Este propuesta ha sido eliminada"
unauthorized:
default: "No tienes permiso para acceder a esta página."
manage: