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

@ -1,23 +1,8 @@
language: ruby
cache: bundler
rvm:
- 2.6.6
os: linux
dist: bionic
addons:
apt:
packages:
- chromium-browser
services:
- postgresql
branches:
except:
- /^depfu/.*$/
before_install:
- "echo 'gem: --no-ri --no-rdoc' > ~/.gemrc"
- gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true
- gem install bundler -v $(tail -n 1 Gemfile.lock)
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > $CCTR
- chmod +x $CCTR
notifications:
email:
on_success: change
@ -27,19 +12,9 @@ notifications:
- "chat.freenode.net#osem"
on_success: change
on_failure: change
before_script:
- RAILS_ENV=test bundle exec rake db:bootstrap --trace
- RAILS_ENV=test bundle exec bin/rails webdrivers:chromedriver:update
- $CCTR before-build
script:
- "bin/travis_script.sh $TEST_SUITE"
# TODO Get this working.
after_script:
# combine coverage from all suites, and upload3 to CodeClimate
- $CCTR format-coverage -t simplecov --output coverage/codeclimate.$TEST_SUITE.json
- $CCTR sum-coverage coverage/codeclimate.*.json
- if [[ "$TRAVIS_TEST_RESULT" == 0 ]]; then $CCTR upload-coverage; fi
stages:
- test
- finalize
env:
global:
- OSEM_DB_ADAPTER=sqlite3
@ -48,11 +23,90 @@ env:
- OSEM_DB_NAME='osem_test'
- CC_TEST_REPORTER_ID=$CC_TEST_REPORTER
- CCTR=./cc-test-reporter
matrix:
- TEST_SUITE=ability
- TEST_SUITE=features
- TEST_SUITE=models
- TEST_SUITE=controllers
- TEST_SUITE=rest
matrix:
fast_finish: false
- TOTAL_TEST_SUITES=5
jobs:
include:
- &tests
language: ruby
cache: bundler
rvm:
- 2.6.6
addons:
apt:
packages:
- chromium-browser
services:
- postgresql
before_install:
- "echo 'gem: --no-ri --no-rdoc' > ~/.gemrc"
- gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true
- gem install bundler -v $(tail -n 1 Gemfile.lock)
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > $CCTR
- chmod +x $CCTR
before_script:
- RAILS_ENV=test bundle exec rake db:bootstrap --trace
- RAILS_ENV=test bundle exec bin/rails webdrivers:chromedriver:update
- $CCTR before-build
script:
- "bin/travis_script.sh $TEST_SUITE && $CCTR format-coverage -t cobertura -o ./coverage/codeclimate.1.json ./coverage/coverage.xml"
env:
- TEST_SUITE=ability
workspaces:
create:
name: ws1
paths:
- coverage/codeclimate.1.json
- <<: *tests
env:
- TEST_SUITE=features
script:
- "bin/travis_script.sh $TEST_SUITE && $CCTR format-coverage -t cobertura -o ./coverage/codeclimate.2.json ./coverage/coverage.xml"
workspaces:
create:
name: ws2
paths:
- coverage/codeclimate.2.json
- <<: *tests
env:
- TEST_SUITE=models
script:
- "bin/travis_script.sh $TEST_SUITE && $CCTR format-coverage -t cobertura -o ./coverage/codeclimate.3.json ./coverage/coverage.xml"
workspaces:
create:
name: ws3
paths:
- coverage/codeclimate.3.json
- <<: *tests
env:
- TEST_SUITE=controllers
script:
- "bin/travis_script.sh $TEST_SUITE && $CCTR format-coverage -t cobertura -o ./coverage/codeclimate.4.json ./coverage/coverage.xml"
workspaces:
create:
name: ws4
paths:
- coverage/codeclimate.4.json
- <<: *tests
env:
- TEST_SUITE=rest
script:
- "bin/travis_script.sh $TEST_SUITE && $CCTR format-coverage -t cobertura -o ./coverage/codeclimate.5.json ./coverage/coverage.xml"
workspaces:
create:
name: ws5
paths:
- coverage/codeclimate.5.json
- stage: finalize
if: branch = master
language: minimal
before_install:
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > $CCTR
- chmod +x $CCTR
workspaces:
use:
- ws1
- ws2
- ws3
- ws4
- ws5
script: $CCTR sum-coverage --output - --parts $TOTAL_TEST_SUITES coverage/codeclimate.*.json | $CCTR upload-coverage --input -

View file

@ -280,6 +280,9 @@ group :development, :test, :linters do
gem 'rubocop-rspec', require: false
gem 'haml-lint', require: false
end
group :development, :test do
# as development/test database
gem 'sqlite3'
end

View file

@ -1,7 +1,7 @@
### Spring 2021 Student Project
[![Build Status](https://travis-ci.com/CactusPuppy/snapcon.svg?branch=master)](https://travis-ci.com/CactusPuppy/snapcon)
[![Maintainability](https://api.codeclimate.com/v1/badges/6c7fc446b3b10866ba71/maintainability)](https://codeclimate.com/github/CactusPuppy/snapcon/maintainability)
[![codecov](https://codecov.io/gh/CactusPuppy/snapcon/branch/master/graph/badge.svg?token=y4aEAtw6KJ)](https://codecov.io/gh/CactusPuppy/snapcon)
[![Test Coverage](https://api.codeclimate.com/v1/badges/6c7fc446b3b10866ba71/test_coverage)](https://codeclimate.com/github/CactusPuppy/snapcon/test_coverage)
[![Security Status](https://hakiri.io/github/CactusPuppy/snapcon/master.svg)](https://hakiri.io/github/CactusPuppy/snapcon/master)
[![Depfu](https://badges.depfu.com/badges/16eb1ffb3a9f1a36c4e595a5ae2a1dca/overview.svg)](https://depfu.com/github/CactusPuppy/snapcon?project_id=22682)
[![Bluejay Dashboard](https://img.shields.io/badge/Bluejay-Dashboard_5-blue.svg)](http://dashboard.bluejay.governify.io/dashboard/script/dashboardLoader.js?dashboardURL=https://reporter.bluejay.governify.io/api/v4/dashboards/tpa-CS169L-GH-CactusPuppy_snapcon/main)

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>

View file

@ -113,5 +113,7 @@ Osem::Application.configure do
devise_config.ichain_test_mode = true
end
end
config.assets.precompile += ['mailbot.css']
config.active_record.verbose_query_logs = true
end

View file

@ -26,7 +26,7 @@ Osem::Application.configure do
config.assets.digest = true
config.assets.css_compressor = :sass
config.assets.js_compressor = :uglifier
config.assets.js_compressor = Uglifier.new(harmony: true)
config.assets.gzip = true
# Defaults to nil and saved in location specified by config.assets.prefix

View file

@ -52,4 +52,5 @@ Osem::Application.configure do
ActiveSupport::Deprecation.silenced = true
end
config.assets.precompile += ['mailbot.css']
end

View file

@ -49,6 +49,7 @@ FactoryBot.define do
ticket_layout { 'portrait' }
description { Faker::Hipster.paragraph }
organization
color { '#FFFFFF' }
after(:create) do |conference|
Role.where(name: 'organizer', resource: conference).first_or_create(description: 'For the organizers of the conference (who shall have full access)')
Role.where(name: 'cfp', resource: conference).first_or_create(description: 'For the members of the CfP team')

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

@ -67,4 +67,36 @@ describe ConferenceHelper, type: :helper do
expect(sponsorship_mailto(conference)).to match conference.short_title
end
end
describe '#conference_logo_url' do
let(:organization) { create(:organization) }
let(:conference2) { create(:conference, organization: organization) }
it 'gives the correct logo url' do
expect(conference_logo_url(conference2)).to eq('snapcon_logo.png')
File.open('spec/support/logos/1.png') do |file|
organization.picture = file
end
expect(conference_logo_url(conference2)).to include('1.png')
File.open('spec/support/logos/2.png') do |file|
conference2.picture = file
end
expect(conference_logo_url(conference2)).to include('2.png')
end
end
describe '#conference_color' do
let(:conference2) { create(:conference, color: '#000000') }
it 'gives the correct conference color' do
expect(conference_color(conference2)).to eq('#000000')
conference2.color = ''
expect(conference_color(conference2)).to eq('#0B3559')
end
end
end

View file

@ -26,6 +26,14 @@ describe Mailbot do
expect(mail.body).to include 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit'
end
it 'assigns the email body with the correct color' do
expect(mail.body).to include('background-color: ' + conference.color)
end
it 'assigns the email body with the correct logo' do
expect(mail.body).to include 'snapcon_logo'
end
it 'delivers the email' do
expect(ActionMailer::Base.deliveries).to include(mail)
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

@ -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

@ -3,7 +3,7 @@
# This file is copied to spec/ when you run 'rails generate rspec:install'
require 'simplecov'
if ENV['GITHUB_ACTIONS']
if ENV['GITHUB_ACTIONS'] || ENV['TRAVIS']
require 'simplecov-cobertura'
SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter
end