Refactor mail views, add a spec to make sure CSS is rendered
This commit is contained in:
parent
0e8b1efefd
commit
ae9f4ab969
6 changed files with 77 additions and 118 deletions
10
app/views/layouts/notifier.html.haml
Normal file
10
app/views/layouts/notifier.html.haml
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
!!!
|
||||||
|
%html
|
||||||
|
%head
|
||||||
|
%meta{"http-equiv"=>"Content-Type", :content=>"text/html; charset=utf-8"}/
|
||||||
|
= render :partial => 'notifier_css'
|
||||||
|
%body
|
||||||
|
%header
|
||||||
|
= image_tag attachments['diaspora_white_on_grey.png'].url, :alt => "DIASPORA"
|
||||||
|
#container
|
||||||
|
= yield
|
||||||
39
app/views/notifier/_notifier_css.haml
Normal file
39
app/views/notifier/_notifier_css.haml
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
:css
|
||||||
|
body{
|
||||||
|
width:600px;
|
||||||
|
font-family:'Arial','Helvetica',sans-serif;
|
||||||
|
font-size:14px;
|
||||||
|
color:#333;
|
||||||
|
}
|
||||||
|
#container{
|
||||||
|
margin-bottom:25px
|
||||||
|
min-height:400px;
|
||||||
|
padding-left:15px;
|
||||||
|
}
|
||||||
|
header{
|
||||||
|
background-color:#333;
|
||||||
|
padding: 15px;
|
||||||
|
margin-bottom: 25px;
|
||||||
|
}
|
||||||
|
p{
|
||||||
|
padding:5px;
|
||||||
|
}
|
||||||
|
p.small{
|
||||||
|
font-size:smaller;
|
||||||
|
color:#999;
|
||||||
|
font-style:italic;
|
||||||
|
}
|
||||||
|
a{
|
||||||
|
color:#107FC9;
|
||||||
|
font-weight:bold;
|
||||||
|
}
|
||||||
|
a:hover{
|
||||||
|
color: #22AAE0;
|
||||||
|
}
|
||||||
|
a:active{
|
||||||
|
color: #005D9C;
|
||||||
|
}
|
||||||
|
.large_text{
|
||||||
|
font-size:21px;
|
||||||
|
font-family:"Helvetica Neue",Arial,Helvetica,sans-serif;
|
||||||
|
}
|
||||||
|
|
@ -1,59 +1,12 @@
|
||||||
!!!
|
%p
|
||||||
%html
|
= t('notifier.hello', :name => @receiver.email)
|
||||||
%head
|
%p
|
||||||
%meta{"http-equiv"=>"Content-Type", :content=>"text/html; charset=utf-8"}/
|
= "#{@sender.real_name} (#{@sender.diaspora_handle})"
|
||||||
:css
|
= t('.just_sent_you')
|
||||||
body{
|
= t('.try_it_out')
|
||||||
width:600px;
|
%br
|
||||||
font-family:'Arial','Helvetica',sans-serif;
|
= link_to t('.sign_in'), new_user_session_url
|
||||||
font-size:14px;
|
%br
|
||||||
color:#333;
|
= t('notifier.love')
|
||||||
}
|
%br
|
||||||
#container{
|
= t('notifier.diaspora')
|
||||||
margin-bottom:25px
|
|
||||||
min-height:400px;
|
|
||||||
padding-left:15px;
|
|
||||||
}
|
|
||||||
header{
|
|
||||||
background-color:#333;
|
|
||||||
padding: 15px;
|
|
||||||
margin-bottom: 25px;
|
|
||||||
}
|
|
||||||
p{
|
|
||||||
padding:5px;
|
|
||||||
}
|
|
||||||
p.small{
|
|
||||||
font-size:smaller;
|
|
||||||
color:#999;
|
|
||||||
font-style:italic;
|
|
||||||
}
|
|
||||||
a{
|
|
||||||
color:#107FC9;
|
|
||||||
font-weight:bold;
|
|
||||||
}
|
|
||||||
a:hover{
|
|
||||||
color: #22AAE0;
|
|
||||||
}
|
|
||||||
a:active{
|
|
||||||
color: #005D9C;
|
|
||||||
}
|
|
||||||
.large_text{
|
|
||||||
font-size:21px;
|
|
||||||
font-family:"Helvetica Neue",Arial,Helvetica,sans-serif;
|
|
||||||
}
|
|
||||||
%body
|
|
||||||
%header
|
|
||||||
= image_tag attachments['diaspora_white_on_grey.png'].url, :alt => "DIASPORA"
|
|
||||||
#container
|
|
||||||
%p
|
|
||||||
= t('notifier.hello', => :name)
|
|
||||||
%p
|
|
||||||
= "#{@sender.real_name} (#{@sender.diaspora_handle})"
|
|
||||||
= t('.just_sent_you')
|
|
||||||
= t('.try_it_out')
|
|
||||||
%br
|
|
||||||
= link_to t('.sign_in'), new_user_session_url
|
|
||||||
%br
|
|
||||||
= t('notifier.love'),
|
|
||||||
%br
|
|
||||||
= t('notifier.diaspora')
|
|
||||||
|
|
|
||||||
|
|
@ -1,59 +1,12 @@
|
||||||
!!!
|
%p
|
||||||
%html
|
= t('notifier.hello', :name => @receiver.profile.first_name)
|
||||||
%head
|
%p
|
||||||
%meta{"http-equiv"=>"Content-Type", :content=>"text/html; charset=utf-8"}/
|
= "#{@sender.real_name} (#{@sender.diaspora_handle})"
|
||||||
:css
|
= t('.accepted')
|
||||||
body{
|
= link_to @aspect.name, aspect_url(@aspect)
|
||||||
width:600px;
|
= t('.aspect')
|
||||||
font-family:'Arial','Helvetica',sans-serif;
|
|
||||||
font-size:14px;
|
|
||||||
color:#333;
|
|
||||||
}
|
|
||||||
#container{
|
|
||||||
margin-bottom:25px
|
|
||||||
min-height:400px;
|
|
||||||
padding-left:15px;
|
|
||||||
}
|
|
||||||
header{
|
|
||||||
background-color:#333;
|
|
||||||
padding: 15px;
|
|
||||||
margin-bottom: 25px;
|
|
||||||
}
|
|
||||||
p{
|
|
||||||
padding:5px;
|
|
||||||
}
|
|
||||||
p.small{
|
|
||||||
font-size:smaller;
|
|
||||||
color:#999;
|
|
||||||
font-style:italic;
|
|
||||||
}
|
|
||||||
a{
|
|
||||||
color:#107FC9;
|
|
||||||
font-weight:bold;
|
|
||||||
}
|
|
||||||
a:hover{
|
|
||||||
color: #22AAE0;
|
|
||||||
}
|
|
||||||
a:active{
|
|
||||||
color: #005D9C;
|
|
||||||
}
|
|
||||||
.large_text{
|
|
||||||
font-size:21px;
|
|
||||||
font-family:"Helvetica Neue",Arial,Helvetica,sans-serif;
|
|
||||||
}
|
|
||||||
%body
|
|
||||||
%header
|
|
||||||
= image_tag attachments['diaspora_white_on_grey.png'].url, :alt => "DIASPORA"
|
|
||||||
#container
|
|
||||||
%p
|
|
||||||
= t('notifier.hello', :name => @receiver.profile.first_name
|
|
||||||
%p
|
|
||||||
= "#{@sender.real_name} (#{@sender.diaspora_handle})"
|
|
||||||
= t('.accepted')
|
|
||||||
= link_to @aspect.name, aspect_url(@aspect)
|
|
||||||
= t('.aspect')
|
|
||||||
|
|
||||||
%br
|
%br
|
||||||
= t('notifier.love')
|
= t('notifier.love')
|
||||||
%br
|
%br
|
||||||
= t('notifier.diaspora')
|
= t('notifier.diaspora')
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
= t('notifier.hello', :name => @receiver.profile.first_name
|
= t('notifier.hello', :name => @receiver.profile.first_name)
|
||||||
= "#{@sender.real_name} (#{@sender.diaspora_handle})"
|
= "#{@sender.real_name} (#{@sender.diaspora_handle})"
|
||||||
= t('notifier.request_accepted.accepted')
|
= t('notifier.request_accepted.accepted')
|
||||||
= "#{@aspect.name} #{t('notifier.request_accepted.aspect')}\n"
|
= "#{@aspect.name} #{t('notifier.request_accepted.aspect')}\n"
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,10 @@ describe Notifier do
|
||||||
it 'has the name of person sending the request' do
|
it 'has the name of person sending the request' do
|
||||||
request_mail.body.encoded.include?(person.real_name).should be true
|
request_mail.body.encoded.include?(person.real_name).should be true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'has the css' do
|
||||||
|
request_mail.body.encoded.include?("<style type='text/css'>")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "#request_accpeted" do
|
describe "#request_accpeted" do
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue