Refactor mail views, add a spec to make sure CSS is rendered

This commit is contained in:
Raphael 2010-11-12 11:47:59 -08:00
parent 0e8b1efefd
commit ae9f4ab969
6 changed files with 77 additions and 118 deletions

View 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

View 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;
}

View file

@ -1,59 +1,12 @@
!!!
%html
%head
%meta{"http-equiv"=>"Content-Type", :content=>"text/html; charset=utf-8"}/
: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;
}
%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')
%p
= t('notifier.hello', :name => @receiver.email)
%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')

View file

@ -1,59 +1,12 @@
!!!
%html
%head
%meta{"http-equiv"=>"Content-Type", :content=>"text/html; charset=utf-8"}/
: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;
}
%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')
%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
= t('notifier.love')
%br
= t('notifier.diaspora')
%br
= t('notifier.love')
%br
= t('notifier.diaspora')

View file

@ -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})"
= t('notifier.request_accepted.accepted')
= "#{@aspect.name} #{t('notifier.request_accepted.aspect')}\n"

View file

@ -23,6 +23,10 @@ describe Notifier do
it 'has the name of person sending the request' do
request_mail.body.encoded.include?(person.real_name).should be true
end
it 'has the css' do
request_mail.body.encoded.include?("<style type='text/css'>")
end
end
describe "#request_accpeted" do