diff --git a/app/helpers/user_helper.rb b/app/helpers/user_helper.rb deleted file mode 100644 index 9fe2a801d..000000000 --- a/app/helpers/user_helper.rb +++ /dev/null @@ -1,12 +0,0 @@ -module UserHelper - def humanize_document_type(document_type) - case document_type - when "1" - t "verification.residence.new.document_type.spanish_id" - when "2" - t "verification.residence.new.document_type.passport" - when "3" - t "verification.residence.new.document_type.residence_card" - end - end -end diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb new file mode 100644 index 000000000..cbd635a28 --- /dev/null +++ b/app/helpers/users_helper.rb @@ -0,0 +1,38 @@ +module UsersHelper + + def humanize_document_type(document_type) + case document_type + when "1" + t "verification.residence.new.document_type.spanish_id" + when "2" + t "verification.residence.new.document_type.passport" + when "3" + t "verification.residence.new.document_type.residence_card" + end + end + + 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/mailers/mailer.rb b/app/mailers/mailer.rb index bf646019a..33b52d170 100644 --- a/app/mailers/mailer.rb +++ b/app/mailers/mailer.rb @@ -1,7 +1,7 @@ class Mailer < ApplicationMailer helper :text_with_links helper :mailer - helper :user + helper :users def comment(comment) @comment = comment 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| %>