add a plaintext layout for emails, and include a link to change your email settings in the emails
This commit is contained in:
parent
557b5393c2
commit
a036a8035f
7 changed files with 17 additions and 5 deletions
|
|
@ -1,6 +1,5 @@
|
||||||
class Notifier < ActionMailer::Base
|
class Notifier < ActionMailer::Base
|
||||||
helper :application
|
helper :application
|
||||||
|
|
||||||
default :from => AppConfig[:smtp_sender_address]
|
default :from => AppConfig[:smtp_sender_address]
|
||||||
|
|
||||||
ATTACHMENT = File.read("#{Rails.root}/public/images/logo_caps.png")
|
ATTACHMENT = File.read("#{Rails.root}/public/images/logo_caps.png")
|
||||||
|
|
@ -15,10 +14,10 @@ class Notifier < ActionMailer::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def single_admin(string, recipient)
|
def single_admin(string, recipient)
|
||||||
@recipient = recipient
|
@receiver = recipient
|
||||||
@string = string.html_safe
|
@string = string.html_safe
|
||||||
attachments.inline['logo_caps.png'] = ATTACHMENT
|
attachments.inline['logo_caps.png'] = ATTACHMENT
|
||||||
mail(:to => @recipient.email,
|
mail(:to => @receiver.email,
|
||||||
:subject => I18n.t('notifier.single_admin.subject'), :host => AppConfig[:pod_uri].host)
|
:subject => I18n.t('notifier.single_admin.subject'), :host => AppConfig[:pod_uri].host)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,3 +8,5 @@
|
||||||
= image_tag attachments['logo_caps.png'].url, :alt => "DIASPORA"
|
= image_tag attachments['logo_caps.png'].url, :alt => "DIASPORA"
|
||||||
#container
|
#container
|
||||||
= yield
|
= yield
|
||||||
|
%a{:href => "#{ AppConfig[:pod_uri].host}/users/#{@receiver.id}/edit"}
|
||||||
|
= t('notifier.manage_your_email_settings')
|
||||||
|
|
|
||||||
3
app/views/layouts/notifier.text.haml
Normal file
3
app/views/layouts/notifier.text.haml
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
!= yield
|
||||||
|
!= t('notifier.manage_your_email_settings')
|
||||||
|
!= "#{ AppConfig[:pod_uri].host}/users/#{@receiver.id}/edit"
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
%p
|
%p
|
||||||
= t('notifier.hello', :name => @recipient.username)
|
= t('notifier.hello', :name => @receiver.username)
|
||||||
%p
|
%p
|
||||||
= @string
|
= @string
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
!= t('notifier.hello', :name => @recipient.username)
|
!= t('notifier.hello', :name => @receiver.username)
|
||||||
|
|
||||||
!= @string
|
!= @string
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -300,6 +300,7 @@ en:
|
||||||
love: "love,"
|
love: "love,"
|
||||||
thanks: "Thanks,"
|
thanks: "Thanks,"
|
||||||
diaspora: "the diaspora email robot"
|
diaspora: "the diaspora email robot"
|
||||||
|
manage_your_email_settings: "manage your email settings"
|
||||||
single_admin:
|
single_admin:
|
||||||
subject: "A message about your Diaspora account:"
|
subject: "A message about your Diaspora account:"
|
||||||
admin: "Your Diaspora administrator"
|
admin: "Your Diaspora administrator"
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,13 @@ describe Notifier do
|
||||||
mail.body.encoded.should match /Welcome to bureaucracy!/
|
mail.body.encoded.should match /Welcome to bureaucracy!/
|
||||||
mail.body.encoded.should match /#{user.username}/
|
mail.body.encoded.should match /#{user.username}/
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'has the layout' do
|
||||||
|
|
||||||
|
mail = Notifier.single_admin("Welcome to bureaucracy!", user)
|
||||||
|
puts mail.body.encoded
|
||||||
|
mail.body.encoded.should match /manage your email settings/
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe ".new_request" do
|
describe ".new_request" do
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue