sends budget investment created email

This commit is contained in:
rgarcia
2017-01-13 17:38:04 +01:00
parent d17a07b096
commit 82322ee233
5 changed files with 31 additions and 2 deletions

View File

@@ -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

View File

@@ -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)

View File

@@ -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
<div class="social-share-full">
<%= social_share_button_tag("#{@investment.title} #{setting['twitter_hashtag']}",
url: budget_investment_url(@investment.budget, @investment)) %>
</div>

View File

@@ -53,3 +53,5 @@ en:
title: "Welcome to %{org}"
button: Complete registration
subject: "Invitation to %{org_name}"
budget_investment_created:
subject: "Thank you for creating a proposal!"

View File

@@ -53,3 +53,5 @@ es:
title: "Bienvenido a %{org}"
button: Completar registro
subject: "Invitación a %{org_name}"
budget_investment_created:
subject: "¡Gracias por crear una propuesta!"