combine invitation emails

This commit is contained in:
Maxwell Salzberg 2011-08-19 12:15:04 -07:00
parent 6f20e11a67
commit fe78a69161
5 changed files with 72 additions and 24 deletions

View file

@ -23,4 +23,13 @@ module NotifierHelper
text = process_newlines(text) if opts[:process_newlines] text = process_newlines(text) if opts[:process_newlines]
text text
end end
def invite_email_title
names = @invites.collect{|x| x.sender.person.name}.uniq
if @invites.empty? && names.empty?
"Accept Your Diaspora* invite!"
else
"#{names.to_sentence} invited you to Diaspora*"
end
end
end end

View file

@ -0,0 +1,18 @@
<table style="padding: 20px 20px; background: rgb(255, 255, 255) none repeat scroll 0%; font-size: 16px; color: rgb(51, 51, 51); -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;" align="center" border="0" cellpadding="0" cellspacing="0" width="600">
<tbody><tr>
<td width='100px'></td>
<td width="70px">
<a href="<%= accept_invitation_url(@resource, :invitation_token => @resource.invitation_token)%>" target="_blank"><img style="border: 0pt none ; padding: 0pt 5px; display: block;" src="<%=invite.sender.person.profile.image_url(:thumb_medium) %>" height="75" ></a>
</td>
<td style="line-height: 20px; width: 360px;">
<%= t('.has_invited_you', :name => invite.sender.name + " (#{invite.sender.diaspora_handle})") %> <br/>
<% unless invite.message.blank? %>
<strong> "<%= invite.message %>"</strong>
<% end %>
</td>
<td width='100px'></td>
</tr>
</tbody></table>

View file

@ -1,9 +0,0 @@
- if @invs.count == 1
= person_image_link(@invs.first.sender.person, :size => :thumb_small)
= t('.has_invited_you', :name => @invs.first.sender.name + " (#{@invs.first.sender.diaspora_handle})")
- else
= t('.have_invited_you', :names => (@invs.map{|inv| inv.sender.name + " (#{inv.sender.diaspora_handle})"}.to_sentence))
- @invs.each do |inv|
- unless inv.message.blank?
= "#{inv.sender.name}:"
= "\"#{inv.message}\""

View file

@ -1,5 +1,7 @@
<% @invites = Invitation.includes(:sender =>{:person => :profile}).where(:admin => false)%>
<head> <head>
<title> Accept Your Diaspora* Invite!</title> <title><%=invite_email_title %></title>
</head> </head>
<p style="background-color: rgb(255, 255, 255); text-align: center; font-size: 11px;">Email not displaying correctly? <a href="<%=invite_email_url(:invitation_token => @resource.invitation_token) %>" style="color: #3F8FBA; text-decoration: none;">View it</a> in your browser</p> <p style="background-color: rgb(255, 255, 255); text-align: center; font-size: 11px;">Email not displaying correctly? <a href="<%=invite_email_url(:invitation_token => @resource.invitation_token) %>" style="color: #3F8FBA; text-decoration: none;">View it</a> in your browser</p>
@ -19,7 +21,6 @@
<tr> <tr>
<td style="padding: 10px 0pt 0px 20px; background: rgb(255, 255, 255) none repeat scroll 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-size: 44px; font-weight: bold; color: rgb(0, 0, 0);"> <td style="padding: 10px 0pt 0px 20px; background: rgb(255, 255, 255) none repeat scroll 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-size: 44px; font-weight: bold; color: rgb(0, 0, 0);">
Finally - it's here.<br> Finally - it's here.<br>
@ -33,15 +34,6 @@
<% if @resource.invitations_to_me.any?{|x| !x.admin?} %>
<% @invs = @resource.invitations_to_me %>
<tr>
<td style="padding: 10px 0pt 0px 20px; background: rgb(255, 255, 255) none repeat scroll 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-size: 20px; font-weight: bold; color: rgb(0, 0, 0);">
<%= render :partial => 'devise/mailer/inviters' %>
</td>
</tr>
<% end %>
@ -52,6 +44,46 @@
<a style="color: #3F8FBA; text-decoration: underline; font-weight: bold; font-size: 20px;" href="<%= accept_invitation_url(@resource, :invitation_token => @resource.invitation_token)%>" target="_blank">Sign up now &rarr;</a> <a style="color: #3F8FBA; text-decoration: underline; font-weight: bold; font-size: 20px;" href="<%= accept_invitation_url(@resource, :invitation_token => @resource.invitation_token)%>" target="_blank">Sign up now &rarr;</a>
</td></tr> </td></tr>
<% unless @invites.blank? %>
<% @invites_with_message, @invites_without_message = @invites.partition{|x| !x.message.blank?} %>
<% unless @invites_with_message.empty? %>
<tr>
<td style="padding: 10px 0pt 0px 20px; background: rgb(255, 255, 255) none repeat scroll 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-size: 24px; font-weight: bold; color: rgb(0, 0, 0);">
<br>
What your friends are saying...<br>
</td>
</tr>
<% @invites_with_message.each do |i| %>
<tr><td>
<%= render(:partial => 'devise/mailer/inviter', :locals => {:invite => i}) %>
</td></tr>
<% end %>
<% end %>
<% unless @invites_without_message.empty? %>
<tr>
<td style="padding: 10px 0pt 0px 20px; background: rgb(255, 255, 255) none repeat scroll 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-size: 24px; font-weight: bold; color: rgb(0, 0, 0);">
<br>
Even more people are excited to see you!<br>
</td>
</tr>
<% @invites_without_message.each do |i| %>
<tr><td>
<%= render(:partial => 'devise/mailer/inviter', :locals => {:invite => i}) %>
</td></tr>
<% end %>
<% end %>
<% end %>
<tr><td style="padding: 20px 20px 0px; background: rgb(255, 255, 255) none repeat scroll 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-size: 44px; font-weight: bold; color: rgb(0, 0, 0);"> <tr><td style="padding: 20px 20px 0px; background: rgb(255, 255, 255) none repeat scroll 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-size: 44px; font-weight: bold; color: rgb(0, 0, 0);">
1. Get Connected</td></tr> 1. Get Connected</td></tr>
<tr><td> <tr><td>
@ -150,5 +182,3 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>

View file

@ -77,8 +77,8 @@ en:
accept: "Accept invitation" accept: "Accept invitation"
ignore: "If you don't want to accept the invitation, please ignore this email." ignore: "If you don't want to accept the invitation, please ignore this email."
no_account_till: "Your account won't be created until you access the link above and sign up." no_account_till: "Your account won't be created until you access the link above and sign up."
inviters: inviter:
has_invited_you: "%{name} has invited you to join Diaspora" has_invited_you: "%{name}"
have_invited_you: "%{names} have invited you to join Diaspora" have_invited_you: "%{names} have invited you to join Diaspora"
accept_at: "at %{url}, you can accept it through the link below." accept_at: "at %{url}, you can accept it through the link below."
shared: shared: