Refactoring notifier and adding locale translation.
This commit is contained in:
parent
1bd14eadfa
commit
72d1fe4572
|
@ -1,21 +1,28 @@
|
|||
class Notifier < ::ActionMailer::Base
|
||||
cattr_accessor :sender
|
||||
|
||||
# Deliver confirmation instructions when the user is created or confirmation
|
||||
# is manually requested
|
||||
#
|
||||
def confirmation_instructions(record)
|
||||
from self.class.sender
|
||||
recipients record.email
|
||||
subject I18n.t(:confirmation_instructions, :scope => [:devise, :notifier], :default => 'Confirmation instructions')
|
||||
sent_on Time.now
|
||||
content_type 'text/html'
|
||||
body record.class.name.downcase.to_sym => record
|
||||
subject I18n.t(:confirmation_instructions, :scope => [:devise, :notifier], :default => 'Confirmation instructions')
|
||||
setup_mail(record)
|
||||
end
|
||||
|
||||
# Deliver reset password instructions when manually requested
|
||||
#
|
||||
def reset_password_instructions(record)
|
||||
from self.class.sender
|
||||
recipients record.email
|
||||
subject I18n.t(:reset_password_instructions, :scope => [:devise, :notifier], :default => 'Reset password instructions')
|
||||
sent_on Time.now
|
||||
content_type 'text/html'
|
||||
body record.class.name.downcase.to_sym => record
|
||||
subject I18n.t(:reset_password_instructions, :scope => [:devise, :notifier], :default => 'Reset password instructions')
|
||||
setup_mail(record)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def setup_mail(record)
|
||||
from self.class.sender
|
||||
recipients record.email
|
||||
sent_on Time.now
|
||||
content_type 'text/html'
|
||||
body record.class.name.downcase.to_sym => record
|
||||
end
|
||||
end
|
||||
|
|
|
@ -8,4 +8,7 @@ en:
|
|||
confirmation:
|
||||
send_instructions: 'You will receive an email with instructions about how to confirm your account in a few minutes.'
|
||||
confirm: 'Your account was successfully confirmed!'
|
||||
notifier:
|
||||
confirmation_instructions: 'Confirmation instructions'
|
||||
reset_password_instructions: 'Reset password instructions'
|
||||
|
||||
|
|
Loading…
Reference in New Issue