Merge branch 'master' of https://github.com/CactusPuppy/snapcon into 176895124-happening-now-json-api-endpoint

This commit is contained in:
Jimmy 2021-03-19 17:23:47 +08:00
commit 1ab580e7e6
27 changed files with 356 additions and 467 deletions

View file

@ -0,0 +1,40 @@
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;
}

View file

@ -1,5 +1,8 @@
# frozen_string_literal: true
DEFAULT_LOGO = 'snapcon_logo.png'
DEFAULT_COLOR = '#0B3559'
module ConferenceHelper
# Return true if only call_for_papers or call_for_tracks or call_for_booths is open
def one_call_open(*calls)
@ -28,6 +31,24 @@ module ConferenceHelper
markdown(ticket.description.split("\n").first&.strip)
end
def conference_logo_url(conference)
if conference.picture.present?
conference.picture.thumb.url
elsif conference.organization.picture.present?
conference.organization.picture.thumb.url
else
DEFAULT_LOGO
end
end
def conference_color(conference)
if conference.color.present?
conference.color
else
DEFAULT_COLOR
end
end
# adds events to icalendar for proposals in a conference
def icalendar_proposals(calendar, proposals, conference)
proposals.each do |proposal|

View file

@ -5,21 +5,25 @@ 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
helper ConferenceHelper
mail(to: user.email,
bcc: SNAPCON_BCC_ADDRESS,
from: conference.contact.email,
subject: conference.email_settings.registration_subject,
template_name: EMAIL_TEMPLATE)
default bcc: -> { SNAPCON_BCC_ADDRESS },
template_name: -> { EMAIL_TEMPLATE },
to: -> { @user.email },
from: -> { @conference.contact.email }
def registration_mail(conference, user)
@user = user
@conference = conference
@email_body = @conference.email_settings.generate_email_on_conf_updates(@conference, @user, @conference.email_settings.registration_body)
mail(subject: @conference.email_settings.registration_subject)
end
def ticket_confirmation_mail(ticket_purchase)
@ticket_purchase = ticket_purchase
@conference = ticket_purchase.conference
@user = ticket_purchase.user
@conference = ticket_purchase.conference
PhysicalTicket.last(ticket_purchase.quantity).each do |physical_ticket|
pdf = TicketPdf.new(@conference, @user, physical_ticket, @conference.ticket_layout.to_sym, "ticket_for_#{@conference.short_title}_#{physical_ticket.id}")
@ -31,138 +35,100 @@ class Mailbot < ActionMailer::Base
template_name = 'young_thinkers_ticket_confirmation_template'
end
mail(to: @user.email,
bcc: SNAPCON_BCC_ADDRESS,
from: @conference.contact.email,
template_name: template_name,
subject: "#{@conference.title} | Ticket Confirmation and PDF!")
mail(subject: "#{@conference.title} | Ticket Confirmation and PDF!",
template_name: template_name)
end
def acceptance_mail(event)
conference = event.program.conference
@user = event.submitter
@conference = event.program.conference
@email_body = @conference.email_settings.generate_event_mail(event, @conference.email_settings.accepted_body)
@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,
template_name: EMAIL_TEMPLATE)
mail(subject: @conference.email_settings.accepted_subject)
end
def submitted_proposal_mail(event)
conference = event.program.conference
@user = event.submitter
@conference = event.program.conference
@email_body = @conference.email_settings.generate_event_mail(event, @conference.email_settings.submitted_proposal_body)
@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,
template_name: EMAIL_TEMPLATE)
mail(subject: @conference.email_settings.submitted_proposal_subject)
end
def rejection_mail(event)
conference = event.program.conference
@user = event.submitter
@conference = event.program.conference
@email_body = @conference.email_settings.generate_event_mail(event, @conference.email_settings.rejected_body)
@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,
template_name: EMAIL_TEMPLATE)
mail(subject: @conference.email_settings.rejected_subject)
end
def confirm_reminder_mail(event)
conference = event.program.conference
@user = event.submitter
@conference = event.program.conference
@email_body = @conference.email_settings.generate_event_mail(event, @conference.email_settings.confirmed_without_registration_body)
@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,
template_name: EMAIL_TEMPLATE)
mail(subject: @conference.email_settings.confirmed_without_registration_subject)
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)
@user = user
@conference = conference
@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,
template_name: EMAIL_TEMPLATE)
mail(subject: @conference.email_settings.conference_dates_updated_subject)
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)
@user = user
@conference = conference
@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,
template_name: EMAIL_TEMPLATE)
mail(subject: @conference.email_settings.conference_registration_dates_updated_subject)
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)
@user = user
@conference = conference
@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,
template_name: EMAIL_TEMPLATE)
mail(subject: @conference.email_settings.venue_updated_subject)
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)
@user = user
@conference = conference
@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,
template_name: EMAIL_TEMPLATE)
mail(bcc: nil,
subject: @conference.email_settings.program_schedule_public_subject)
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)
@user = user
@conference = conference
@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,
template_name: EMAIL_TEMPLATE)
mail(bcc: nil,
subject: @conference.email_settings.cfp_dates_updated_subject)
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)
@user = booth.submitter
@conference = booth.conference
@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,
template_name: EMAIL_TEMPLATE)
mail(bcc: nil,
subject: @conference.email_settings.booths_acceptance_subject)
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)
@user = booth.submitter
@conference = booth.conference
@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,
template_name: EMAIL_TEMPLATE)
mail(bcc: nil,
subject: @conference.email_settings.booths_rejection_subject)
end
def event_comment_mail(comment, user)
@ -171,8 +137,7 @@ class Mailbot < ActionMailer::Base
@conference = @event.program.conference
@user = user
mail(to: @user.email,
from: @conference.contact.email,
mail(bcc: nil,
template_name: 'comment_template',
subject: "New comment has been posted for #{@event.title}")
end

View file

@ -7,7 +7,6 @@
# id :bigint not null, primary key
# abstract :text
# comments_count :integer default(0), not null
# committee_review :text
# description :text
# guid :string not null
# is_highlight :boolean default(FALSE)

View file

@ -0,0 +1,12 @@
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta content="width=device-width, initial-scale=1" name="viewport"/>
<meta content="Snap!Con -- A conference all about Snap!, a programing language from UC Berkeley." name="description"/>
<meta content="Michael Ball, Brian Harvey, Jens Moenig, Bernat Romagosa, Dan Garcia, Lauren Mock" name="author"/>
<%= stylesheet_link_tag "mailbot" %>
</head>
<body>
<div id="border" style="background-color: <%= conference_color(@conference) %>"></div>
</body>
</html>

View file

@ -0,0 +1,25 @@
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta content="width=device-width, initial-scale=1" name="viewport"/>
<title>
<%= 'Email' %>
</title>
<meta content="Snap!Con -- A conference all about Snap!, a programing language from UC Berkeley." name="description"/>
<meta content="Michael Ball, Brian Harvey, Jens Moenig, Bernat Romagosa, Dan Garcia, Lauren Mock" name="author"/>
<%= stylesheet_link_tag "mailbot" %>
</head>
<body>
<div id="border" style="background-color: <%= conference_color(@conference) %>">
<div class="row">
<div class="col-md-2">
<% if @conference.present? %>
<%= image_tag(conference_logo_url(@conference), style: "display:block;height:70px;width:auto;", alt: @conference.title + ' logo') %>
<% end %>
</div>
</div>
</div>
</body>

View file

@ -0,0 +1,16 @@
<%= render partial: "layouts/mailbot_header" %>
<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 %> .
"<%= @comment.body %>"
To reply to this comment, please go to <%= h(admin_conference_program_event_url(@conference.short_title, @event, only_path: false)) %>
Best wishes,
<%= @conference.title %> Team
</span>
</div>
<%= render partial: "layouts/mailbot_footer" %>

View file

@ -1,83 +0,0 @@
<!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 %> .
"<%= @comment.body %>"
To reply to this comment, please go to <%= h(admin_conference_program_event_url(@conference.short_title, @event, only_path: false)) %>
Best wishes,
<%= @conference.title %> Team
</span>
</div>
<div id="border">
<h1></h1>
</div>
</body>
</html>

View file

@ -1,77 +0,0 @@
<!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

@ -0,0 +1,7 @@
<%= render partial: "layouts/mailbot_header" %>
<div id="content">
<span style="white-space: pre-line">
<%= @email_body %>
</span>
</div>
<%= render partial: "layouts/mailbot_footer" %>

View file

@ -0,0 +1,14 @@
<%= render partial: "layouts/mailbot_header" %>
<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 %>.
Please, find the ticket(s) pdf attached.
Best wishes,
<%= @conference.title %> Team
</span>
</div>
<%= render partial: "layouts/mailbot_footer" %>

View file

@ -1,81 +0,0 @@
<!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 %>.
Please, find the ticket(s) pdf attached.
Best wishes,
<%= @conference.title %> Team
</span>
</div>
<div id="border">
<h1></h1>
</div>
</body>
</html>

View file

@ -0,0 +1,16 @@
<%= render partial: "layouts/mailbot_header" %>
<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 %>.
Please, find the ticket(s) pdf attached.
The SAP Young Thinkers team will reach out to you with information on how to participate in the event soon. In the meantime, you can check the event page (https://events.sap.com/yt-learning-festival-at-snapcon-2020/en/home) or send an email with your questions to youngthinkers@sap.com.
Best wishes,
<%= @conference.title %> Team
</span>
</div>
<%= render partial: "layouts/mailbot_footer" %>

View file

@ -1,83 +0,0 @@
<!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 %>.
Please, find the ticket(s) pdf attached.
The SAP Young Thinkers team will reach out to you with information on how to participate in the event soon. In the meantime, you can check the event page (https://events.sap.com/yt-learning-festival-at-snapcon-2020/en/home) or send an email with your questions to youngthinkers@sap.com.
Best wishes,
<%= @conference.title %> Team
</span>
</div>
<div id="border">
<h1></h1>
</div>
</body>
</html>