Merge pull request #7 from CactusPuppy/176917559-add-brand-elements-to-email

Add brand elements to email
This commit is contained in:
kingdish 2021-02-25 00:08:32 -08:00 committed by GitHub
commit 56d93fa381
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 405 additions and 87 deletions

View file

@ -1,17 +1,19 @@
# frozen_string_literal: true
SNAPCON_BCC_ADDRESS = 'messages@snap.berkeley.edu'
EMAIL_TEMPLATE = 'email_template'
YTLF_TICKET_ID = 50
class Mailbot < ActionMailer::Base
def registration_mail(conference, user)
@email_body = conference.email_settings.generate_email_on_conf_updates(conference, user, conference.email_settings.registration_body)
@logo = conference.picture.thumb.url
mail(to: user.email,
bcc: SNAPCON_BCC_ADDRESS,
from: conference.contact.email,
subject: conference.email_settings.registration_subject,
body: conference.email_settings.generate_email_on_conf_updates(conference,
user,
conference.email_settings.registration_body))
template_name: EMAIL_TEMPLATE)
end
def ticket_confirmation_mail(ticket_purchase)
@ -39,108 +41,128 @@ class Mailbot < ActionMailer::Base
def acceptance_mail(event)
conference = event.program.conference
@logo = conference.picture.thumb.url
@email_body = conference.email_settings.generate_event_mail(event, conference.email_settings.accepted_body)
mail(to: event.submitter.email,
bcc: SNAPCON_BCC_ADDRESS,
from: conference.contact.email,
subject: conference.email_settings.accepted_subject,
body: conference.email_settings.generate_event_mail(event, conference.email_settings.accepted_body))
template_name: EMAIL_TEMPLATE)
end
def submitted_proposal_mail(event)
conference = event.program.conference
@logo = conference.picture.thumb.url
@email_body = conference.email_settings.generate_event_mail(event, conference.email_settings.submitted_proposal_body)
mail(to: event.submitter.email,
bcc: SNAPCON_BCC_ADDRESS,
from: conference.contact.email,
subject: conference.email_settings.submitted_proposal_subject,
body: conference.email_settings.generate_event_mail(event, conference.email_settings.submitted_proposal_body))
template_name: EMAIL_TEMPLATE)
end
def rejection_mail(event)
conference = event.program.conference
@logo = conference.picture.thumb.url
@email_body = conference.email_settings.generate_event_mail(event, conference.email_settings.rejected_body)
mail(to: event.submitter.email,
bcc: SNAPCON_BCC_ADDRESS,
from: conference.contact.email,
subject: conference.email_settings.rejected_subject,
body: conference.email_settings.generate_event_mail(event, conference.email_settings.rejected_body))
template_name: EMAIL_TEMPLATE)
end
def confirm_reminder_mail(event)
conference = event.program.conference
@logo = conference.picture.thumb.url
@email_body = conference.email_settings.generate_event_mail(event, conference.email_settings.confirmed_without_registration_body)
mail(to: event.submitter.email,
bcc: SNAPCON_BCC_ADDRESS,
from: conference.contact.email,
subject: conference.email_settings.confirmed_without_registration_subject,
body: conference.email_settings.generate_event_mail(event,
conference.email_settings.confirmed_without_registration_body))
template_name: EMAIL_TEMPLATE)
end
def conference_date_update_mail(conference, user)
@logo = conference.picture.thumb.url
@email_body = conference.email_settings.generate_email_on_conf_updates(conference, user, conference.email_settings.conference_dates_updated_body)
mail(to: user.email,
bcc: SNAPCON_BCC_ADDRESS,
from: conference.contact.email,
subject: conference.email_settings.conference_dates_updated_subject,
body: conference.email_settings.generate_email_on_conf_updates(conference,
user,
conference.email_settings.conference_dates_updated_body))
template_name: EMAIL_TEMPLATE)
end
def conference_registration_date_update_mail(conference, user)
@logo = conference.picture.thumb.url
@email_body = conference.email_settings.generate_email_on_conf_updates(conference, user, conference.email_settings.conference_registration_dates_updated_body)
mail(to: user.email,
bcc: SNAPCON_BCC_ADDRESS,
from: conference.contact.email,
subject: conference.email_settings.conference_registration_dates_updated_subject,
body: conference.email_settings.generate_email_on_conf_updates(conference,
user,
conference.email_settings.conference_registration_dates_updated_body))
template_name: EMAIL_TEMPLATE)
end
def conference_venue_update_mail(conference, user)
@logo = conference.picture.thumb.url
@email_body = conference.email_settings.generate_email_on_conf_updates(conference, user, conference.email_settings.venue_updated_body)
mail(to: user.email,
bcc: SNAPCON_BCC_ADDRESS,
from: conference.contact.email,
subject: conference.email_settings.venue_updated_subject,
body: conference.email_settings.generate_email_on_conf_updates(conference,
user,
conference.email_settings.venue_updated_body))
template_name: EMAIL_TEMPLATE)
end
def conference_schedule_update_mail(conference, user)
@logo = conference.picture.thumb.url
@email_body = conference.email_settings.generate_email_on_conf_updates(conference, user, conference.email_settings.program_schedule_public_body)
mail(to: user.email,
from: conference.contact.email,
subject: conference.email_settings.program_schedule_public_subject,
body: conference.email_settings.generate_email_on_conf_updates(conference,
user,
conference.email_settings.program_schedule_public_body))
template_name: EMAIL_TEMPLATE)
end
def conference_cfp_update_mail(conference, user)
@logo = conference.picture.thumb.url
@email_body = conference.email_settings.generate_email_on_conf_updates(conference, user, conference.email_settings.cfp_dates_updated_body)
mail(to: user.email,
from: conference.contact.email,
subject: conference.email_settings.cfp_dates_updated_subject,
body: conference.email_settings.generate_email_on_conf_updates(conference,
user,
conference.email_settings.cfp_dates_updated_body))
template_name: EMAIL_TEMPLATE)
end
def conference_booths_acceptance_mail(booth)
conference = booth.conference
@logo = conference.picture.thumb.url
@email_body = conference.email_settings.generate_booth_mail(booth, conference.email_settings.booths_acceptance_body)
mail(to: booth.submitter.email,
from: conference.contact.email,
subject: conference.email_settings.booths_acceptance_subject,
body: conference.email_settings.generate_booth_mail(booth, conference.email_settings.booths_acceptance_body))
template_name: EMAIL_TEMPLATE)
end
def conference_booths_rejection_mail(booth)
conference = booth.conference
@logo = conference.picture.thumb.url
@email_body = conference.email_settings.generate_booth_mail(booth, conference.email_settings.booths_rejection_body)
mail(to: booth.submitter.email,
from: conference.contact.email,
subject: conference.email_settings.booths_rejection_subject,
body: conference.email_settings.generate_booth_mail(booth, conference.email_settings.booths_rejection_body))
template_name: EMAIL_TEMPLATE)
end
def event_comment_mail(comment, user)

View file

@ -1,3 +1,69 @@
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- CSS -->
<link rel="stylesheet" href="main.css">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css?family=Montserrat:100,200,300,400,500,600,700,800" rel="stylesheet">
<style>
html {
scroll-behavior: smooth;
}
body {
background: #fff;
box-shadow: 0 0 2px rgba(0, 0, 0, 0.06);
color: #000;
font-family: 'Montserrat', sans-serif;
font-size: 16px;
line-height: 1.5;
margin: 0 auto;
}
h1,
h3,
h4,
h5,
h6 {
font-weight: 400;
line-height: 1.3;
}
p {
color: #0B3559;
font-weight: 400;
line-height: 2;
}
#border {
background-color: #0B3559;
padding: 25px;
color:#fff;
}
#content {
background-color: #fff;
padding: 100px;
color: #0B3559;
}
</style>
<!-- Page Title -->
<title>Email</title>
</head>
<body>
<div id="border">
<div class="row">
<!-- Uncomment below to get logo -->
<div class="col-md-2">
</div>
<div class="col-md-10"><h1></h1></div>
</div>
</div>
<div id="content">
<span style="white-space: pre-line">
Dear <%= @user.name %>,
User <%= @comment.user.name %> posted a new comment for event <%= @event.title %> of <%= @conference.short_title %> .
@ -8,3 +74,10 @@ To reply to this comment, please go to <%= h(admin_conference_program_event_url
Best wishes,
<%= @conference.title %> Team
</span>
</div>
<div id="border">
<h1></h1>
</div>
</body>
</html>

View file

@ -0,0 +1,77 @@
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- CSS -->
<link rel="stylesheet" href="main.css">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css?family=Montserrat:100,200,300,400,500,600,700,800" rel="stylesheet">
<style>
html {
scroll-behavior: smooth;
}
body {
background: #fff;
box-shadow: 0 0 2px rgba(0, 0, 0, 0.06);
color: #000;
font-family: 'Montserrat', sans-serif;
font-size: 16px;
line-height: 1.5;
margin: 0 auto;
}
h1,
h3,
h4,
h5,
h6 {
font-weight: 400;
line-height: 1.3;
}
p {
color: #0B3559;
font-weight: 400;
line-height: 2;
}
#border {
background-color: #0B3559;
padding: 25px;
color:#fff;
}
#content {
background-color: #fff;
padding: 100px;
color: #0B3559;
}
</style>
<!-- Page Title -->
<title>Email</title>
</head>
<body>
<div id="border">
<div class="row">
<!-- Uncomment below to get logo -->
<div class="col-md-2">
<% if !@logo.nil? %>
<%= image_tag(@logo, style: "display:block") %>
<% end %>
</div>
<div class="col-md-10"><h1></h1></div>
</div>
</div>
<div id="content">
<span style="white-space: pre-line">
<%= @email_body %>
</span>
</div>
<div id="border">
<h1></h1>
</div>
</body>
</html>

View file

@ -1,3 +1,69 @@
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- CSS -->
<link rel="stylesheet" href="main.css">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css?family=Montserrat:100,200,300,400,500,600,700,800" rel="stylesheet">
<style>
html {
scroll-behavior: smooth;
}
body {
background: #fff;
box-shadow: 0 0 2px rgba(0, 0, 0, 0.06);
color: #000;
font-family: 'Montserrat', sans-serif;
font-size: 16px;
line-height: 1.5;
margin: 0 auto;
}
h1,
h3,
h4,
h5,
h6 {
font-weight: 400;
line-height: 1.3;
}
p {
color: #0B3559;
font-weight: 400;
line-height: 2;
}
#border {
background-color: #0B3559;
padding: 25px;
color:#fff;
}
#content {
background-color: #fff;
padding: 100px;
color: #0B3559;
}
</style>
<!-- Page Title -->
<title>Email</title>
</head>
<body>
<div id="border">
<div class="row">
<!-- Uncomment below to get logo -->
<div class="col-md-2">
</div>
<div class="col-md-10"><h1></h1></div>
</div>
</div>
<div id="content">
<span style="white-space: pre-line">
Dear <%= @user.name %>,
Thanks! You have successfully booked <%= @ticket_purchase.quantity %> <%= @ticket_purchase.ticket.title %> ticket(s) for the event <%= @conference.title %>. Your transaction id is <%= @ticket_purchase.id %>.
@ -6,3 +72,10 @@ Please, find the ticket(s) pdf attached.
Best wishes,
<%= @conference.title %> Team
</span>
</div>
<div id="border">
<h1></h1>
</div>
</body>
</html>

View file

@ -1,3 +1,69 @@
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- CSS -->
<link rel="stylesheet" href="main.css">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css?family=Montserrat:100,200,300,400,500,600,700,800" rel="stylesheet">
<style>
html {
scroll-behavior: smooth;
}
body {
background: #fff;
box-shadow: 0 0 2px rgba(0, 0, 0, 0.06);
color: #000;
font-family: 'Montserrat', sans-serif;
font-size: 16px;
line-height: 1.5;
margin: 0 auto;
}
h1,
h3,
h4,
h5,
h6 {
font-weight: 400;
line-height: 1.3;
}
p {
color: #0B3559;
font-weight: 400;
line-height: 2;
}
#border {
background-color: #0B3559;
padding: 25px;
color:#fff;
}
#content {
background-color: #fff;
padding: 100px;
color: #0B3559;
}
</style>
<!-- Page Title -->
<title>Email</title>
</head>
<body>
<div id="border">
<div class="row">
<!-- Uncomment below to get logo -->
<div class="col-md-2">
</div>
<div class="col-md-10"><h1></h1></div>
</div>
</div>
<div id="content">
<span style="white-space: pre-line">
Dear <%= @user.name %>,
Thanks! You have successfully booked <%= @ticket_purchase.quantity %> <%= @ticket_purchase.ticket.title %> ticket(s) for the event <%= @conference.title %>. Your transaction id is <%= @ticket_purchase.id %>.
@ -8,3 +74,10 @@ The SAP Young Thinkers team will reach out to you with information on how to par
Best wishes,
<%= @conference.title %> Team
</span>
</div>
<div id="border">
<h1></h1>
</div>
</body>
</html>

View file

@ -23,7 +23,7 @@ describe Mailbot do
end
it 'assigns the email body' do
expect(mail.body).to eq 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit'
expect(mail.body).to include 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit'
end
it 'delivers the email' do