diff --git a/app/mailers/mailer.rb b/app/mailers/mailer.rb index fa53c7c1a..04160022e 100644 --- a/app/mailers/mailer.rb +++ b/app/mailers/mailer.rb @@ -10,7 +10,8 @@ class Mailer < ApplicationMailer @reply = reply @debate = @reply.debate parent = Comment.find(@reply.parent_id) - mail(to: parent.author.email, subject: t('mailer.reply.subject')) + @recipient = parent.author + mail(to: @recipient.email, subject: t('mailer.reply.subject')) end end diff --git a/app/views/mailer/comment.html.erb b/app/views/mailer/comment.html.erb index f469d50b8..eb95c8031 100644 --- a/app/views/mailer/comment.html.erb +++ b/app/views/mailer/comment.html.erb @@ -1,7 +1,6 @@ -Hello, +<%= t('mailers.comment.hi', recipient: @debate.author.name) %> -
<%= @comment.author.name %>
+
<%= link_to @debate.title, debate_url(@debate) %>
+
<%= t('mailers.comment.new_comment_by', commenter: @comment.author.name) %>
<%= @comment.body %>
- -
<%= link_to @debate.title, debate_url(@debate) %>
\ No newline at end of file diff --git a/app/views/mailer/reply.html.erb b/app/views/mailer/reply.html.erb index 7714d7c28..21cfeba1e 100644 --- a/app/views/mailer/reply.html.erb +++ b/app/views/mailer/reply.html.erb @@ -1,7 +1,6 @@ -Hello, +<%= t('mailers.reply.hi', recipient: @recipient.name) %> -
<%= @reply.author.name %>
+
<%= link_to @debate.title, debate_url(@debate) %>
+
<%= t('mailers.reply.new_reply_by', commenter: @reply.author.name) %>
<%= @reply.body %>
- -
<%= link_to @debate.title, debate_url(@debate) %>
\ No newline at end of file diff --git a/config/i18n-tasks.yml b/config/i18n-tasks.yml index cb06a3360..dd5b7f0c4 100644 --- a/config/i18n-tasks.yml +++ b/config/i18n-tasks.yml @@ -24,6 +24,7 @@ data: - config/locales/%{locale}.yml - config/locales/admin.%{locale}.yml - config/locales/moderation.%{locale}.yml + - config/locales/mailers.%{locale}.yml - config/locales/devise_views.%{locale}.yml - config/locales/responders.%{locale}.yml - config/locales/kaminari.%{locale}.yml diff --git a/config/locales/mailers.en.yml b/config/locales/mailers.en.yml new file mode 100644 index 000000000..cbc6c5bd6 --- /dev/null +++ b/config/locales/mailers.en.yml @@ -0,0 +1,8 @@ +en: + mailers: + comment: + hi: "Hello, %{recipient}" + new_comment_by: "There'is a new comment by %{commenter}" + reply: + hi: "Hello, %{recipient}" + new_reply_by: "There'is a new reply by %{commenter} to your comment" \ No newline at end of file diff --git a/config/locales/mailers.es.yml b/config/locales/mailers.es.yml new file mode 100644 index 000000000..e595967c4 --- /dev/null +++ b/config/locales/mailers.es.yml @@ -0,0 +1,8 @@ +es: + mailers: + comment: + hi: "Hola, %{recipient}" + new_comment_by: "Hay un nuevo comentario de %{commenter}" + reply: + hi: "Hola, %{recipient}" + new_reply_by: "Hay una nueva respuesta de %{commenter} a tu comentario" \ No newline at end of file