Add mailer and emails for contributor invitations

This commit is contained in:
Andrew Brown 2017-10-01 12:51:03 +02:00
parent eba5096129
commit 38f04ed461
8 changed files with 76 additions and 0 deletions

View File

@ -0,0 +1,4 @@
class ApplicationMailer < ActionMailer::Base
default from: "from@example.com"
layout 'mailer'
end

View File

@ -0,0 +1,13 @@
class CollaborationMailer < ApplicationMailer
default from: "collaboration@notebook.ai"
def contributor_invitation(inviter:, invite_email:, universe:)
@inviter = inviter
@universe = universe
mail(
to: invite_email,
subject: "#{@inviter.name} requested your help collaborating on Notebook.ai."
)
end
end

View File

@ -0,0 +1,25 @@
<!DOCTYPE html>
<html>
<head>
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type' />
</head>
<body>
<h1>Hello!</h1>
<p>
<%= @inviter.name %> is creating their own universes on Notebook.ai and has invited you to collaborate on their <%= link_to @universe.name, @universe %> universe.
</p>
<p>
To get started, simply sign up or sign in to <%= link_to 'Notebook.ai', 'https://www.notebook.ai/users/sign_in' %> with this email address and look for "<%= @universe.name %>" under your Universes tab.
</p>
<p>
Happy worldbuilding!
</p>
<br /><br /><br />
<p style="font-size: 80%">
Please don't respond to this email as this email address is not watched. If you have any questions, comments, concerns, or want to unsubscribe to future collaboration invitations, please send an email directly to andrew@indentlabs.com. Thank you for your understanding.
</p>
</body>
</html>

View File

@ -0,0 +1,11 @@
Hello!
<%= @inviter.name %> is creating their own universes on Notebook.ai and has invited you to collaborate on their <%= @universe.name %> universe.
To get started, simply sign up or sign in to https://www.Notebook.ai/ with this email address and look for <%= @universe.name %> under your Universes tab. You can also navigate directly to the universe at https://www.notebook.ai<%= universe_path(@universe) %> and get started from there.
Happy worldbuilding!
-
Please don't respond to this email as the address is not watched. If you have any questions, comments, concerns, or want to unsubscribe to future collaboration invitations, please send an email directly to andrew@indentlabs.com. Thank you for your understanding.

View File

@ -0,0 +1,5 @@
<html>
<body>
<%= yield %>
</body>
</html>

View File

@ -0,0 +1 @@
<%= yield %>

View File

@ -0,0 +1,7 @@
require 'test_helper'
class CollaborationMailerTest < ActionMailer::TestCase
# test "the truth" do
# assert true
# end
end

View File

@ -0,0 +1,10 @@
# Preview all emails at http://localhost:3000/rails/mailers/collaboration_mailer
class CollaborationMailerPreview < ActionMailer::Preview
def contributor_invitation
CollaborationMailer.contributor_invitation(
inviter: User.first,
invite_email: 'andrew@indentlabs.com',
universe: Universe.first
)
end
end