2015-07-25 18:32:27 +02:00
|
|
|
# Send mails to check on organisations life cycle
|
|
|
|
class OrgaMailer < ApplicationMailer
|
2015-12-26 23:32:04 +01:00
|
|
|
helper :events
|
|
|
|
|
2015-07-25 18:32:27 +02:00
|
|
|
def create(orga)
|
|
|
|
@orga = orga
|
|
|
|
|
|
|
|
mail 'Message-ID' =>
|
|
|
|
"<orga-#{orga.id}@#{ActionMailer::Base.default_url_options[:host]}>",
|
|
|
|
to: orga.submitter,
|
2016-11-07 22:30:44 +01:00
|
|
|
subject: subject(orga)
|
2015-07-25 18:32:27 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def update(orga)
|
|
|
|
@orga = orga
|
2016-07-02 16:48:47 +02:00
|
|
|
@current_user = User.find_by id: orga.paper_trail.originator
|
2015-07-25 18:32:27 +02:00
|
|
|
|
|
|
|
mail 'Message-ID' =>
|
|
|
|
"<orga-#{orga.id}@#{ActionMailer::Base.default_url_options[:host]}>",
|
|
|
|
to: orga.submitter,
|
2016-11-07 22:30:44 +01:00
|
|
|
subject: subject(orga)
|
2015-07-25 18:32:27 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def accept(orga)
|
|
|
|
@orga = orga
|
2016-07-02 16:48:47 +02:00
|
|
|
@current_user = User.find_by id: orga.paper_trail.originator
|
2015-07-25 18:32:27 +02:00
|
|
|
|
|
|
|
mail 'In-Reply-To' =>
|
|
|
|
"<orga-#{orga.id}@#{ActionMailer::Base.default_url_options[:host]}>",
|
|
|
|
to: orga.submitter,
|
2016-11-07 22:30:44 +01:00
|
|
|
subject: subject(orga)
|
2015-07-25 18:32:27 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def destroy(orga, reason = '')
|
|
|
|
@orga = orga
|
2016-07-02 16:48:47 +02:00
|
|
|
@current_user = User.find_by id: orga.paper_trail.originator
|
2015-07-25 18:32:27 +02:00
|
|
|
@reason = reason
|
|
|
|
|
|
|
|
mail 'In-Reply-To' =>
|
|
|
|
"<orga-#{orga.id}@#{ActionMailer::Base.default_url_options[:host]}>",
|
|
|
|
to: orga.submitter,
|
2016-11-07 22:30:44 +01:00
|
|
|
subject: subject(orga)
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def subject(orga)
|
|
|
|
t('mail_prefix') +
|
|
|
|
t("#{mailer_name}.#{action_name}.subject", subject: orga.name)
|
2015-07-25 18:32:27 +02:00
|
|
|
end
|
|
|
|
end
|