diff --git a/app/controllers/budgets/investments_controller.rb b/app/controllers/budgets/investments_controller.rb index 235163f2e..704ff8d83 100644 --- a/app/controllers/budgets/investments_controller.rb +++ b/app/controllers/budgets/investments_controller.rb @@ -46,6 +46,7 @@ module Budgets @investment.author = current_user if @investment.save + Mailer.budget_investment_created(@investment).deliver_later redirect_to budget_investment_path(@budget, @investment), notice: t('flash.actions.create.budget_investment') else diff --git a/app/mailers/mailer.rb b/app/mailers/mailer.rb index 25c019857..c5c4ae603 100644 --- a/app/mailers/mailer.rb +++ b/app/mailers/mailer.rb @@ -74,6 +74,14 @@ class Mailer < ApplicationMailer end end + def budget_investment_created(investment) + @investment = investment + + with_user(@investment.author) do + mail(to: @investment.author.email, subject: t('mailers.budget_investment_created.subject')) + end + end + private def with_user(user, &block) diff --git a/app/views/mailer/budget_investment_created.html.erb b/app/views/mailer/budget_investment_created.html.erb new file mode 100644 index 000000000..ba3674d0d --- /dev/null +++ b/app/views/mailer/budget_investment_created.html.erb @@ -0,0 +1,16 @@ +Hola <%= @investment.author.name %> + +Muchas gracias por crear tu proyecto <%= @investment.title %> para los Presupuestos Participativos de <%= @investment.budget.name %> de Madrid. + +Te informaremos de cómo avanza el proceso, que también puedes seguir en +<%= link_to budgets_url, budgets_url %> + +Atentamente, + +Área de Participación Ciudadana, Transparencia +y Gobierno Abierto del Ayuntamiento de Madrid + +
+ <%= social_share_button_tag("#{@investment.title} #{setting['twitter_hashtag']}", + url: budget_investment_url(@investment.budget, @investment)) %> +
\ No newline at end of file diff --git a/config/locales/mailers.en.yml b/config/locales/mailers.en.yml index 3fa63f9ec..0b103b5ea 100755 --- a/config/locales/mailers.en.yml +++ b/config/locales/mailers.en.yml @@ -52,4 +52,6 @@ en: thanks: "Thank you very much." title: "Welcome to %{org}" button: Complete registration - subject: "Invitation to %{org_name}" \ No newline at end of file + subject: "Invitation to %{org_name}" + budget_investment_created: + subject: "Thank you for creating a proposal!" \ No newline at end of file diff --git a/config/locales/mailers.es.yml b/config/locales/mailers.es.yml index 49e3e0796..f35085de0 100644 --- a/config/locales/mailers.es.yml +++ b/config/locales/mailers.es.yml @@ -52,4 +52,6 @@ es: thanks: "Muchas gracias." title: "Bienvenido a %{org}" button: Completar registro - subject: "Invitación a %{org_name}" \ No newline at end of file + subject: "Invitación a %{org_name}" + budget_investment_created: + subject: "¡Gracias por crear una propuesta!" \ No newline at end of file