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