This repository has been archived by the owner on Nov 21, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
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 #377 from 18F/feature/contact-email-template
Update email templates and move contact form to standard template.
- Loading branch information
Showing
13 changed files
with
107 additions
and
79 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 |
---|---|---|
|
@@ -137,8 +137,13 @@ $(document).ready(function () { | |
$('.contact-flash').removeClass('hidden'); | ||
btn.button('reset'); | ||
btn.prop('disabled', false); | ||
form[0].reset(); | ||
}).fail(function (error) { | ||
$('.contact-flash .message').text("Whoops! Something went wrong. We're really sorry. Try emailing us at <a href='mailto:[email protected]'>[email protected]</a>."); | ||
$('.contact-flash').removeClass('hidden'); | ||
btn.button('reset'); | ||
btn.prop('disabled', false); | ||
}); | ||
form[0].reset(); | ||
}); | ||
|
||
}); |
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,10 +1,13 @@ | ||
class ContactMailer < ActionMailer::Base | ||
layout 'mailers/notification_template' | ||
def contact_us(from, return_email, message) | ||
@from = from | ||
@message = message | ||
@return_email = return_email | ||
attachments.inline['logo.png'] = File.read('app/assets/images/myusa-logo.png') | ||
mail( | ||
reply_to: return_email, | ||
subject: t('email.contact_us.subject') | ||
reply_to: @return_email, | ||
subject: I18n.t('email.contact_us.subject', from: @from) | ||
) | ||
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 |
---|---|---|
@@ -1,13 +1,12 @@ | ||
class NotificationMailer < ActionMailer::Base | ||
layout 'mailers/notification_template' | ||
def notification_email(notification) | ||
@notification = notification | ||
@app = @notification.app | ||
@user = User.find @notification.user_id | ||
attachments.inline['logo.png'] = File.read('app/assets/images/myusa-logo.png') | ||
mail( | ||
to: @user.email, | ||
from: @notification.email_from_address, | ||
reply_to: '[email protected]', | ||
subject: @notification.subject | ||
) | ||
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 |
---|---|---|
@@ -1,12 +1,44 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type' /> | ||
</head> | ||
<body> | ||
<h1>New message from <%= @from %></h1> | ||
<p> | ||
<%= @message %> | ||
</p> | ||
</body> | ||
</html> | ||
<tr> | ||
<td align="center" valign="top"> | ||
<!-- BEGIN HEADER // --> | ||
<table border="0" cellpadding="0" cellspacing="0" width="100%" id="templateHeader"> | ||
<tr> | ||
<td valign="top" class="headerContent"> | ||
<h1 class="left-20" >New message from <%= @from %></h1> | ||
</td> | ||
<td valign="top" class="headerContent"></td> | ||
</tr> | ||
</table> | ||
<!-- // END HEADER --> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td align="center" valign="top"> | ||
<!-- BEGIN BODY // --> | ||
<table border="0" cellpadding="0" cellspacing="0" width="100%" id="templateBody"> | ||
<tr> | ||
<td valign="top" class="bodyContent" mc:edit="body_content"> | ||
<p> | ||
From: <%= @from %> | ||
<br/> | ||
Email: <%= @return_email %> | ||
</p> | ||
<p><%= @message %></p> | ||
</td> | ||
</tr> | ||
</table> | ||
<!-- // END BODY --> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td align="center" valign="top"> | ||
<!-- BEGIN FOOTER // --> | ||
<table border="0" cellpadding="0" cellspacing="0" width="100%" id="templateFooter"> | ||
<tr> | ||
<td valign="top" class="footerContent" style="padding-top:0; padding-bottom:40px;" mc:edit="footer_content02"> | ||
</td> | ||
</tr> | ||
</table> | ||
<!-- // END FOOTER --> | ||
</td> | ||
</tr> |
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,39 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | ||
<html xmlns="http://www.w3.org/1999/xhtml"> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | ||
<title>*|MC:SUBJECT|*</title> | ||
<%= stylesheet_link_tag "mailers" %> | ||
</head> | ||
<body leftmargin="0" marginwidth="0" topmargin="0" marginheight="0" offset="0"> | ||
<center> | ||
<table align="center" border="0" cellpadding="0" cellspacing="0" height="100%" width="100%" id="bodyTable"> | ||
<tr> | ||
<td align="center" valign="top" id="bodyCell"> | ||
<!-- BEGIN TEMPLATE // --> | ||
<table border="0" cellpadding="0" cellspacing="0" id="templateContainer"> | ||
<tr> | ||
<td align="center" valign="top"> | ||
<!-- BEGIN PREHEADER // --> | ||
<table border="0" cellpadding="0" cellspacing="0" width="100%" id="templatePreheader"> | ||
<tr> | ||
<td valign="top" class="preheaderContent" style="padding-top:10px; padding-right:20px; padding-bottom:10px; padding-left:20px;" mc:edit="preheader_content00"> | ||
<%= link_to image_tag(attachments['logo.png'].url, alt: 'Sent from MyUSA', height: '25', width: '88', alt: 'Sent from MyUSA'), root_url %> | ||
</td> | ||
<!-- *|IFNOT:ARCHIVE_PAGE|* --> | ||
<td valign="top" width="180" class="preheaderContent" style="padding-top:10px; padding-right:20px; padding-bottom:10px; padding-left:0;" mc:edit="preheader_content01"></td> | ||
<!-- *|END:IF|* --> | ||
</tr> | ||
</table> | ||
<!-- // END PREHEADER --> | ||
</td> | ||
</tr> | ||
<%= yield %> | ||
</table> | ||
<!-- // END TEMPLATE --> | ||
</td> | ||
</tr> | ||
</table> | ||
</center> | ||
</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
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 |
---|---|---|
|
@@ -17,7 +17,7 @@ | |
end | ||
|
||
subject { NotificationMailer.notification_email(notification) } | ||
its(:from) { should eql ['no-reply@example.com'] } | ||
its(:from) { should eql ['no-reply@' + ActionMailer::Base.default_url_options[:host]] } | ||
its(:subject) { should eql notification.subject } | ||
its(:reply_to) { should contain_exactly '[email protected]' } | ||
its('body.encoded') { should have_content notification.body } | ||
|