Skip to content

Commit

Permalink
Add more placeholders to event_mailer concern
Browse files Browse the repository at this point in the history
  • Loading branch information
hunchr committed Sep 25, 2024
1 parent e464fc6 commit 1bc10d9
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 44 deletions.
14 changes: 13 additions & 1 deletion app/mailers/concerns/event_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,19 @@ module EventMailer
private

def placeholder_recipient_name
@course.contact.greeting_name
@person.greeting_name
end

def placeholder_person_url
link_to(group_person_url(@course.group_ids.first, @person))
end

def placeholder_application_url
link_to(group_event_participation_url(
group_id: @course.group_ids.first,
event_id: @course.id,
id: @participation.id
))
end

def placeholder_application_opening_at
Expand Down
1 change: 1 addition & 0 deletions app/mailers/event/application_closed_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class Event::ApplicationClosedMailer < ApplicationMailer

def notice(course)
@course = course
@person = course.contact
locales = course.language.split("_")

compose_multilingual(course.groups.first.course_admin_email, NOTICE, locales)
Expand Down
19 changes: 2 additions & 17 deletions app/mailers/event/application_confirmation_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,16 @@ class Event::ApplicationConfirmationMailer < ApplicationMailer

def confirmation(participation, content_key)
@participation = participation
@person = participation.person
@course = participation.event
headers[:bcc] = @course.groups.first.course_admin_email
locales = @course.language.split("_")

compose_multilingual(@participation.person, content_key, locales)
compose_multilingual(@person, content_key, locales)
end

private

def placeholder_recipient_name
@participation.person.greeting_name
end

def placeholder_person_url
link_to(person_url(@participation.person))
end

def placeholder_application_url
link_to(group_event_participation_url(
group_id: @course.groups.first.id,
event_id: @course.id,
id: @participation.id
))
end

def placeholder_missing_information
missing = [nil, "", "nein", "non", "no"]
missing_questions = join_lines(Event::Question.admin.joins(:answers)
Expand Down
1 change: 1 addition & 0 deletions app/mailers/event/application_paused_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class Event::ApplicationPausedMailer < ApplicationMailer

def notice(course)
@course = course
@person = course.contact
locales = course.language.split("_")

compose_multilingual(course.groups.first.course_admin_email, NOTICE, locales)
Expand Down
8 changes: 1 addition & 7 deletions app/mailers/event/leader_reminder_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,10 @@ class Event::LeaderReminderMailer < ApplicationMailer

def reminder(course, content_key, leader)
@course = course
@leader = leader
@person = leader
headers[:bcc] = course.groups.first.course_admin_email
locales = course.language.split("_")

compose_multilingual(leader, content_key, locales)
end

private

def placeholder_recipient_name
@leader.greeting_name
end
end
9 changes: 1 addition & 8 deletions app/mailers/event/published_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,14 @@ class Event::PublishedMailer < ApplicationMailer
include EventMailer
include MultilingualMailer

EVENT_LEADER_ROLES = [Event::Role::Leader, Event::Role::AssistantLeader].map(&:sti_name)
NOTICE = "event_published_notice"

def notice(course, leader)
@course = course
@leader = leader
@person = leader
headers[:bcc] = course.groups.first.course_admin_email
locales = course.language.split("_")

compose_multilingual(leader, NOTICE, locales)
end

private

def placeholder_recipient_name
@leader.greeting_name
end
end
13 changes: 2 additions & 11 deletions app/mailers/sac_cas/event/participation_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
# https://github.com/hitobito/hitobito_sac_cas.

module SacCas::Event::ParticipationMailer
extend ActiveSupport::Concern
include EventMailer
include MultilingualMailer

Expand All @@ -25,8 +24,8 @@ def summon(participation)

def compose_email(participation, content_key)
@participation = participation
@course = @participation.event
@person = @participation.person
@course = participation.event
@person = participation.person
headers[:bcc] = @course.groups.first.course_admin_email
locales = @course.language.split("_")

Expand All @@ -40,15 +39,7 @@ def compose_email(participation, content_key)

private

def placeholder_person_url
link_to(group_person_url(@course.group_ids.first, @participation.person))
end

def placeholder_book_discount_code
@course.book_discount_code.to_s
end

def placeholder_recipient_name
@person.greeting_name
end
end

0 comments on commit 1bc10d9

Please sign in to comment.