Sprankelprachtig aan/afmeldsysteem

participant_mailer.rb 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. class ParticipantMailer < ApplicationMailer
  2. def attendance_reminder(person, activity)
  3. @person = person
  4. @activity = activity
  5. key = if activity.no_response_action # is true
  6. 'activities.emails.attendance_reminder.subject_present'
  7. else
  8. 'activities.emails.attendance_reminder.subject_absent'
  9. end
  10. subject = I18n.t(key, activity: @activity.name)
  11. mail(to: @person.email, subject: subject)
  12. end
  13. def subgroup_notification(person, activity, participant)
  14. @person = person
  15. @activity = activity
  16. @subgroup = participant.subgroup.name
  17. @others = participant
  18. .subgroup
  19. .participants
  20. .where.not(person: @person)
  21. .map { |pp| pp.person.full_name }
  22. .sort
  23. .join(', ')
  24. @subgroups = @activity
  25. .subgroups
  26. .order(name: :asc)
  27. @organizers = @activity
  28. .organizer_names
  29. .sort
  30. .join(', ')
  31. subject = I18n.t('activities.emails.subgroup_notification.subject', subgroup: @subgroup, activity: @activity.name)
  32. mail(to: @person.email, subject: subject)
  33. end
  34. end