diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb new file mode 100644 index 000000000..77464e00b --- /dev/null +++ b/app/helpers/users_helper.rb @@ -0,0 +1,27 @@ +module UsersHelper + + def comment_commentable_title(comment) + commentable = comment.commentable + if commentable.nil? + deleted_commentable_text(comment) + elsif commentable.hidden? + "".html_safe + + commentable.title + + "".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 \ No newline at end of file diff --git a/app/views/users/_comments.html.erb b/app/views/users/_comments.html.erb index 2a8c9d66b..4a2ca5da7 100644 --- a/app/views/users/_comments.html.erb +++ b/app/views/users/_comments.html.erb @@ -2,7 +2,7 @@ <% @comments.each do |comment| %> - <%= comment.commentable.hidden? ? comment.commentable.title : link_to(comment.commentable.title, comment.commentable) %> + <%= comment_commentable_title(comment) %>
<%= comment.body %> diff --git a/config/locales/en.yml b/config/locales/en.yml index cb22de6fd..0089fded9 100755 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -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: diff --git a/config/locales/es.yml b/config/locales/es.yml index eda14968c..9bc0fe644 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -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: