Skip to content

Commit

Permalink
Some work on workshop proposal, refactor email tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alepbloyd committed Nov 23, 2024
1 parent 2d76ddb commit 8adbc0b
Show file tree
Hide file tree
Showing 22 changed files with 3,153 additions and 837 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,5 @@ group :test do
# Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
gem 'selenium-webdriver'
gem 'webdrivers'
gem 'rspec-sidekiq'
end
9 changes: 9 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ GEM
net-smtp (0.5.0)
net-protocol
nio4r (2.7.4)
nokogiri (1.15.6-arm64-darwin)
racc (~> 1.4)
nokogiri (1.15.6-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.15.6-x86_64-linux)
Expand Down Expand Up @@ -286,6 +288,11 @@ GEM
rspec-expectations (~> 3.13)
rspec-mocks (~> 3.13)
rspec-support (~> 3.13)
rspec-sidekiq (5.0.0)
rspec-core (~> 3.0)
rspec-expectations (~> 3.0)
rspec-mocks (~> 3.0)
sidekiq (>= 5, < 8)
rspec-support (3.13.1)
rubyzip (2.3.2)
securerandom (0.3.1)
Expand Down Expand Up @@ -369,6 +376,7 @@ GEM
zeitwerk (2.6.18)

PLATFORMS
arm64-darwin-23
x86_64-darwin-21
x86_64-linux

Expand All @@ -395,6 +403,7 @@ DEPENDENCIES
recaptcha
redis (>= 4.0.1)
rspec-rails
rspec-sidekiq
selenium-webdriver
shoulda-matchers
sidekiq (~> 7.3)
Expand Down
18 changes: 18 additions & 0 deletions app/mailers/workshop_participant_mailer.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
class WorkshopParticipantMailer < ApplicationMailer
# Subject can be set in your I18n file at config/locales/en.yml
# with the following lookup:
#
# en.workshop_participant_mailer.workshop_registration_email.subject
#
def workshop_registration_email(workshop, participant)
@workshop = workshop
@participant = participant

@greeting = 'Hi'

mail(
to: @participant.email,
subject: "You've registered for #{@workshop.title}"
)
end
end
1 change: 1 addition & 0 deletions app/models/workshop.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class Workshop < ApplicationRecord
registration_required: 1,
application_required: 2
}
enum :proposal_status, { pending: 0, approved: 1, rejected: 2 }, default: 0

has_many :track_workshops, dependent: :destroy
has_many :tracks, through: :track_workshops
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<h1>WorkshopParticipant#workshop_registration_email</h1>

<p>
<%= @greeting %>, find me in app/views/workshop_participant_mailer/workshop_registration_email.html.erb
</p>

<%= link_to @workshop %>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
WorkshopParticipant#workshop_registration_email

<%= @greeting %>, find me in app/views/workshop_participant_mailer/workshop_registration_email.text.erb
4 changes: 1 addition & 3 deletions app/views/workshops/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

<h2>Upcoming Workshops</h2>

<%= month_calendar(events: @workshops) do |date, workshops| %>
<%= month_calendar(events: @workshops.where(proposal_status: "approved")) do |date, workshops| %>
<%= date %>

<% workshops.each do |workshop| %>
<% if workshop.finalized %>
<div>
<%= link_to workshop.title, workshop_path(workshop.id) %>
<br>
Expand All @@ -28,6 +27,5 @@
<div> Registration Required </div>
<% end %>
</div>
<% end %>
<% end %>
<% end %>
2 changes: 1 addition & 1 deletion db/migrate/20241101162052_create_workshops.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ def change
create_table :workshops do |t|
t.string :title
t.string :description
t.integer :proposal_status
t.integer :attendance_modality
t.integer :presentation_modality
t.integer :registration_modality
Expand All @@ -12,7 +13,6 @@ def change
t.string :in_person_location
t.datetime :start_time
t.datetime :end_time
t.boolean :finalized, default: true # for development, switch to false for prod

t.timestamps
end
Expand Down
2 changes: 1 addition & 1 deletion db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 8adbc0b

Please sign in to comment.