diff --git a/.travis.yml b/.travis.yml index 4e6985a3..b35784c6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 - diff --git a/Gemfile b/Gemfile index 97bf9ba6..87a01972 100644 --- a/Gemfile +++ b/Gemfile @@ -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 diff --git a/README.md b/README.md index 71f3ac37..1a549b45 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/app/assets/stylesheets/mailbot.css b/app/assets/stylesheets/mailbot.css new file mode 100644 index 00000000..870eb7ef --- /dev/null +++ b/app/assets/stylesheets/mailbot.css @@ -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; + } + \ No newline at end of file diff --git a/app/helpers/conference_helper.rb b/app/helpers/conference_helper.rb index 14253b23..417a8d55 100644 --- a/app/helpers/conference_helper.rb +++ b/app/helpers/conference_helper.rb @@ -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| diff --git a/app/mailers/mailbot.rb b/app/mailers/mailbot.rb index c055ec84..07249862 100644 --- a/app/mailers/mailbot.rb +++ b/app/mailers/mailbot.rb @@ -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 diff --git a/app/serializers/event_serializer.rb b/app/serializers/event_serializer.rb index 9bf196f2..8c30b1a1 100644 --- a/app/serializers/event_serializer.rb +++ b/app/serializers/event_serializer.rb @@ -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) diff --git a/app/views/layouts/_mailbot_footer.html.erb b/app/views/layouts/_mailbot_footer.html.erb new file mode 100644 index 00000000..3cc8b3c3 --- /dev/null +++ b/app/views/layouts/_mailbot_footer.html.erb @@ -0,0 +1,12 @@ + + + + + + + <%= stylesheet_link_tag "mailbot" %> + + +
+ + \ No newline at end of file diff --git a/app/views/layouts/_mailbot_header.html.erb b/app/views/layouts/_mailbot_header.html.erb new file mode 100644 index 00000000..12f9d4a5 --- /dev/null +++ b/app/views/layouts/_mailbot_header.html.erb @@ -0,0 +1,25 @@ + + + + + + <%= 'Email' %> + + + + <%= stylesheet_link_tag "mailbot" %> + + +
+
+
+ <% if @conference.present? %> + <%= image_tag(conference_logo_url(@conference), style: "display:block;height:70px;width:auto;", alt: @conference.title + ' logo') %> + <% end %> +
+
+
+ + + + \ No newline at end of file diff --git a/app/views/mailbot/comment_template.html.erb b/app/views/mailbot/comment_template.html.erb new file mode 100644 index 00000000..b9e9cce0 --- /dev/null +++ b/app/views/mailbot/comment_template.html.erb @@ -0,0 +1,16 @@ +<%= render partial: "layouts/mailbot_header" %> +
+ + 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 + +
+<%= render partial: "layouts/mailbot_footer" %> \ No newline at end of file diff --git a/app/views/mailbot/comment_template.text.erb b/app/views/mailbot/comment_template.text.erb deleted file mode 100644 index d162d710..00000000 --- a/app/views/mailbot/comment_template.text.erb +++ /dev/null @@ -1,83 +0,0 @@ - - - - - - - - - - - - - - Email - - -
-
- -
-
-

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

-
- - diff --git a/app/views/mailbot/email_template.erb b/app/views/mailbot/email_template.erb deleted file mode 100644 index 429553be..00000000 --- a/app/views/mailbot/email_template.erb +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - - - - - - - - - Email - - -
-
- -
- <% if !@logo.nil? %> - <%= image_tag(@logo, style: "display:block") %> - <% end %> -
-

-
-
-
- - <%= @email_body %> - -
-
-

-
- - diff --git a/app/views/mailbot/email_template.html.erb b/app/views/mailbot/email_template.html.erb new file mode 100644 index 00000000..6176cf08 --- /dev/null +++ b/app/views/mailbot/email_template.html.erb @@ -0,0 +1,7 @@ +<%= render partial: "layouts/mailbot_header" %> +
+ + <%= @email_body %> + +
+<%= render partial: "layouts/mailbot_footer" %> \ No newline at end of file diff --git a/app/views/mailbot/ticket_confirmation_template.html.erb b/app/views/mailbot/ticket_confirmation_template.html.erb new file mode 100644 index 00000000..f92284d7 --- /dev/null +++ b/app/views/mailbot/ticket_confirmation_template.html.erb @@ -0,0 +1,14 @@ +<%= render partial: "layouts/mailbot_header" %> +
+ + 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 + +
+<%= render partial: "layouts/mailbot_footer" %> \ No newline at end of file diff --git a/app/views/mailbot/ticket_confirmation_template.text.erb b/app/views/mailbot/ticket_confirmation_template.text.erb deleted file mode 100644 index 0e4e54f8..00000000 --- a/app/views/mailbot/ticket_confirmation_template.text.erb +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - - - - - - - - Email - - -
-
- -
-
-

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

-
- - diff --git a/app/views/mailbot/young_thinkers_ticket_confirmation_template.html.erb b/app/views/mailbot/young_thinkers_ticket_confirmation_template.html.erb new file mode 100644 index 00000000..d35d8a1f --- /dev/null +++ b/app/views/mailbot/young_thinkers_ticket_confirmation_template.html.erb @@ -0,0 +1,16 @@ +<%= render partial: "layouts/mailbot_header" %> +
+ + 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 + +
+<%= render partial: "layouts/mailbot_footer" %> \ No newline at end of file diff --git a/app/views/mailbot/young_thinkers_ticket_confirmation_template.text.erb b/app/views/mailbot/young_thinkers_ticket_confirmation_template.text.erb deleted file mode 100644 index 6a4c7fb5..00000000 --- a/app/views/mailbot/young_thinkers_ticket_confirmation_template.text.erb +++ /dev/null @@ -1,83 +0,0 @@ - - - - - - - - - - - - - - Email - - -
-
- -
-
-

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

-
- - diff --git a/config/environments/development.rb b/config/environments/development.rb index d99d92f0..5b6263e3 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -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 diff --git a/config/environments/production.rb b/config/environments/production.rb index 536a8aef..d41774af 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -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 diff --git a/config/environments/test.rb b/config/environments/test.rb index 225ae26f..1a9d4d7b 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -52,4 +52,5 @@ Osem::Application.configure do ActiveSupport::Deprecation.silenced = true end + config.assets.precompile += ['mailbot.css'] end diff --git a/spec/factories/conferences.rb b/spec/factories/conferences.rb index d1ac5032..1968e54e 100644 --- a/spec/factories/conferences.rb +++ b/spec/factories/conferences.rb @@ -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') diff --git a/spec/factories/events.rb b/spec/factories/events.rb index 2f68c311..c8360449 100644 --- a/spec/factories/events.rb +++ b/spec/factories/events.rb @@ -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) diff --git a/spec/helpers/conference_helper_spec.rb b/spec/helpers/conference_helper_spec.rb index 101d083a..4ea48496 100644 --- a/spec/helpers/conference_helper_spec.rb +++ b/spec/helpers/conference_helper_spec.rb @@ -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 diff --git a/spec/mailers/mailbot_spec.rb b/spec/mailers/mailbot_spec.rb index 1f739997..4c4bd699 100644 --- a/spec/mailers/mailbot_spec.rb +++ b/spec/mailers/mailbot_spec.rb @@ -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 diff --git a/spec/models/event_spec.rb b/spec/models/event_spec.rb index 030ad382..2beb3a20 100644 --- a/spec/models/event_spec.rb +++ b/spec/models/event_spec.rb @@ -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) diff --git a/spec/serializers/event_serializer_spec.rb b/spec/serializers/event_serializer_spec.rb index 3ad68cad..506134cf 100644 --- a/spec/serializers/event_serializer_spec.rb +++ b/spec/serializers/event_serializer_spec.rb @@ -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) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index d3e17427..2d680fb2 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -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