Permalink
Browse files

combine invitation emails

  • Loading branch information...
1 parent 6f20e11 commit fe78a69161897efdb555142f18ae8751cf694e0d @maxwell maxwell committed Aug 19, 2011
View
9 app/helpers/notifier_helper.rb
@@ -23,4 +23,13 @@ def comment_message(comment, opts={})
text = process_newlines(text) if opts[:process_newlines]
text
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
View
18 app/views/devise/mailer/_inviter.erb
@@ -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
9 app/views/devise/mailer/_inviters.haml
@@ -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
56 app/views/devise/mailer/invitation_instructions.erb
@@ -1,5 +1,7 @@
+
+<% @invites = Invitation.includes(:sender =>{:person => :profile}).where(:admin => false)%>
<head>
- <title> Accept Your Diaspora* Invite!</title>
+ <title><%=invite_email_title %></title>
</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>
@@ -19,7 +21,6 @@
-
<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);">
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>
</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);">
1. Get Connected</td></tr>
<tr><td>
@@ -150,5 +182,3 @@
</tr>
</tbody>
</table>
-
-
View
4 config/locales/devise/devise.en.yml
@@ -77,8 +77,8 @@ en:
accept: "Accept invitation"
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."
- inviters:
- has_invited_you: "%{name} has invited you to join Diaspora"
+ inviter:
+ has_invited_you: "%{name}"
have_invited_you: "%{names} have invited you to join Diaspora"
accept_at: "at %{url}, you can accept it through the link below."
shared:

0 comments on commit fe78a69

Please sign in to comment.