Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #79 from mrharshp/invitation
email invitation
- Loading branch information
Showing
16 changed files
with
110 additions
and
3 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
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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
class ApplicationMailer < ActionMailer::Base | ||
default from: 'from@example.com' | ||
default from: 'hello@haze.global' | ||
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,17 @@ | ||
class UserMailer < ApplicationMailer | ||
# Subject can be set in your I18n file at config/locales/en.yml | ||
# with the following lookup: | ||
# | ||
# en.user_mailer.welcome.subject | ||
def welcome | ||
@user = params[:user] # Instance variable => available in view | ||
mail(to: @user.email, subject: 'Welcome to Haze') | ||
# This will render a view in `app/views/user_mailer`! | ||
end | ||
|
||
def invite | ||
@sender_name = params[:sender_name] | ||
@group_name = Group.find(params[:group_id]).name | ||
mail(to: params[:friend_email], subject: "Start Planning Your Trip @HAZE!") | ||
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
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,6 @@ | ||
<p>Hi <%= params[:friend_email] %>,</p> | ||
|
||
<p><strong><%= @sender_name %></strong> has invited you to join the <strong><%= @group_name %></strong> trip. </p> | ||
<p><a href="https://www.haze.global ">Click here to sign up </a></strong> and start planning for your trip!</p> | ||
|
||
|
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,7 @@ | ||
<p>Hi <%= params[:email] %></p> | ||
|
||
<p>Start planning your next trip @HAZE!</p> | ||
|
||
<a href="https://www.haze.global %>">Click here to sign up!</a> | ||
|
||
|
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 @@ | ||
<h1>User#welcome</h1> | ||
|
||
<p> | ||
<%= @greeting %>, find me in app/views/user_mailer/welcome.html.erb | ||
</p> |
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,3 @@ | ||
User#welcome | ||
|
||
<%= @greeting %>, find me in app/views/user_mailer/welcome.text.erb |
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
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,9 @@ | ||
# Preview all emails at http://localhost:3000/rails/mailers/user_mailer | ||
class UserMailerPreview < ActionMailer::Preview | ||
|
||
# Preview this email at http://localhost:3000/rails/mailers/user_mailer/welcome | ||
def welcome | ||
UserMailer.welcome | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
require 'test_helper' | ||
|
||
class UserMailerTest < ActionMailer::TestCase | ||
test "welcome" do | ||
mail = UserMailer.welcome | ||
assert_equal "Welcome", mail.subject | ||
assert_equal ["to@example.org"], mail.to | ||
assert_equal ["from@example.com"], mail.from | ||
assert_match "Hi", mail.body.encoded | ||
end | ||
|
||
end |