-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
37e95ea
commit 4dfb528
Showing
10 changed files
with
85 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
class ApplicationMailer < ActionMailer::Base | ||
default from: "from@example.com" | ||
layout 'mailer' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
class EventMailer < ApplicationMailer | ||
|
||
def cancel(event) | ||
user = event.user | ||
@reasons = event.reasons | ||
@canceled_at = l event.canceled_at, format: :short | ||
@event_title = event.title | ||
@name = user.full_name | ||
subject = t('mailers.cancel_event.subject', title: @event_title) | ||
mail(to: user.email, subject: subject) | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<td style="padding-bottom: 20px; padding-left: 10px;"> | ||
<h1 style="font-family: 'Open Sans','Helvetica Neue',arial,sans-serif;"> | ||
<%= t('mailers.cancel_event.welcome', name: @name) %> | ||
</h1> | ||
|
||
<p style="font-family: 'Open Sans','Helvetica Neue',arial,sans-serif;font-size: 14px;font-weight: normal;line-height: 24px;"> | ||
<%= t('mailers.cancel_event.text1', title: @event_title) %> | ||
</p> | ||
|
||
<p style="font-family: 'Open Sans','Helvetica Neue',arial,sans-serif;font-size: 14px;font-weight: normal;line-height: 24px;"> | ||
<%= t('mailers.cancel_event.text2') %> | ||
</p> | ||
|
||
<p style="font-family: 'Open Sans','Helvetica Neue',arial,sans-serif;font-size: 14px;font-weight: normal;line-height: 24px;"> | ||
<%= raw @reasons %> | ||
</p> | ||
|
||
<p style="font-family: 'Open Sans','Helvetica Neue',arial,sans-serif;font-size: 14px;font-weight: normal;line-height: 24px;"> | ||
<%= t('mailers.cancel_event.canceled_at', canceled_at: @canceled_at) %> | ||
</p> | ||
|
||
<p style="font-family: 'Open Sans','Helvetica Neue',arial,sans-serif;font-size: 14px;font-weight: normal;line-height: 24px;"> | ||
<%= t('mailers.cancel_event.thanks') %> | ||
</p> | ||
</td> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<html> | ||
<body> | ||
<%= yield %> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<%= yield %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
en: | ||
mailers: | ||
cancel_event: | ||
subject: "Cancelled event: %{title}" | ||
welcome: "Hello %{name}" | ||
text1: "The event: %{title}" | ||
text2: "Has been cancelled for the following reason:" | ||
canceled_at: "On %{canceled_at}" | ||
thanks: "Regards" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
es: | ||
mailers: | ||
cancel_event: | ||
subject: "Cancelado evento: %{title}" | ||
welcome: "Hola %{name}" | ||
text1: "El evento: %{title}" | ||
text2: "Ha sido cancelado por la siguiente razón:" | ||
canceled_at: "A día %{canceled_at}" | ||
thanks: "Un saludo" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
require "rails_helper" | ||
|
||
RSpec.describe EventMailer, type: :mailer do | ||
pending "add some examples to (or delete) #{__FILE__}" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Preview all emails at http://localhost:3000/rails/mailers/event_mailer | ||
class EventMailerPreview < ActionMailer::Preview | ||
|
||
def cancel | ||
event = Event.second | ||
EventMailer.cancel(event) | ||
end | ||
|
||
end |