2014-08-06 14:47:47 +02:00
|
|
|
# Sending mails related to events life cycle
|
2014-05-25 23:59:03 +02:00
|
|
|
class EventMailer < ActionMailer::Base
|
2014-08-16 17:39:24 +02:00
|
|
|
helper :events
|
|
|
|
|
2014-05-25 23:59:03 +02:00
|
|
|
def create(event)
|
|
|
|
@event = event
|
2014-06-29 13:37:08 +02:00
|
|
|
|
2014-08-06 14:47:47 +02:00
|
|
|
mail 'Message-ID' =>
|
|
|
|
"<event-#{event.id}@#{ActionMailer::Base.default_url_options[:host]}>",
|
|
|
|
to: event.submitter,
|
2014-09-20 17:20:40 +02:00
|
|
|
subject: "#{t 'mail_prefix'}#{t 'event_mailer.create.subject',
|
|
|
|
subject: event.title}"
|
2014-05-25 23:59:03 +02:00
|
|
|
end
|
2014-07-01 21:55:38 +02:00
|
|
|
|
2014-07-01 22:17:57 +02:00
|
|
|
def accept(event, current_user)
|
2014-07-01 21:55:38 +02:00
|
|
|
@event = event
|
2014-07-01 22:17:57 +02:00
|
|
|
@current_user = current_user
|
2014-07-01 21:55:38 +02:00
|
|
|
|
2014-08-06 14:47:47 +02:00
|
|
|
mail 'In-Reply-To' =>
|
|
|
|
"<event-#{event.id}@#{ActionMailer::Base.default_url_options[:host]}>",
|
|
|
|
to: event.submitter,
|
2014-09-20 17:20:40 +02:00
|
|
|
subject: "#{t 'mail_prefix'}#{t 'event_mailer.accept.subject',
|
|
|
|
subject: event.title}"
|
2014-07-01 21:55:38 +02:00
|
|
|
end
|
2014-07-07 13:14:17 +02:00
|
|
|
|
|
|
|
def destroy(event, current_user, reason)
|
|
|
|
@event = event
|
|
|
|
@current_user = current_user
|
|
|
|
@reason = reason
|
|
|
|
|
2014-08-06 14:47:47 +02:00
|
|
|
mail 'In-Reply-To' =>
|
|
|
|
"<event-#{event.id}@#{ActionMailer::Base.default_url_options[:host]}>",
|
|
|
|
to: event.submitter,
|
2014-09-20 17:20:40 +02:00
|
|
|
subject: "#{t 'mail_prefix'}#{t 'event_mailer.destroy.subject',
|
|
|
|
subject: event.title}"
|
2014-07-07 13:14:17 +02:00
|
|
|
end
|
2014-05-25 23:59:03 +02:00
|
|
|
end
|