diff --git a/app/helpers/notifier_helper.rb b/app/helpers/notifier_helper.rb index 3f841fdb5..71784a324 100644 --- a/app/helpers/notifier_helper.rb +++ b/app/helpers/notifier_helper.rb @@ -23,4 +23,13 @@ module NotifierHelper 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 diff --git a/app/views/devise/mailer/_inviter.erb b/app/views/devise/mailer/_inviter.erb new file mode 100644 index 000000000..cc058942b --- /dev/null +++ b/app/views/devise/mailer/_inviter.erb @@ -0,0 +1,18 @@ + + + + + + + +
+ + + <%= t('.has_invited_you', :name => invite.sender.name + " (#{invite.sender.diaspora_handle})") %>
+ + <% unless invite.message.blank? %> + "<%= invite.message %>" + <% end %> + +
+ diff --git a/app/views/devise/mailer/_inviters.haml b/app/views/devise/mailer/_inviters.haml deleted file mode 100644 index b4c1f12d9..000000000 --- a/app/views/devise/mailer/_inviters.haml +++ /dev/null @@ -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}\"" diff --git a/app/views/devise/mailer/invitation_instructions.erb b/app/views/devise/mailer/invitation_instructions.erb index 598ad585a..502cced49 100644 --- a/app/views/devise/mailer/invitation_instructions.erb +++ b/app/views/devise/mailer/invitation_instructions.erb @@ -1,5 +1,7 @@ + +<% @invites = Invitation.includes(:sender =>{:person => :profile}).where(:admin => false)%> - Accept Your Diaspora* Invite! + <%=invite_email_title %>

Email not displaying correctly? View it in your browser

@@ -19,7 +21,6 @@ - Finally - it's here.
@@ -33,15 +34,6 @@ - <% if @resource.invitations_to_me.any?{|x| !x.admin?} %> - <% @invs = @resource.invitations_to_me %> - - - <%= render :partial => 'devise/mailer/inviters' %> - - - <% end %> - @@ -52,6 +44,46 @@ Sign up now → + + <% unless @invites.blank? %> + <% @invites_with_message, @invites_without_message = @invites.partition{|x| !x.message.blank?} %> + <% unless @invites_with_message.empty? %> + + +
+ What your friends are saying...
+ + + + <% @invites_with_message.each do |i| %> + + <%= render(:partial => 'devise/mailer/inviter', :locals => {:invite => i}) %> + + <% end %> + <% end %> + + <% unless @invites_without_message.empty? %> + + + +
+ Even more people are excited to see you!
+ + + + <% @invites_without_message.each do |i| %> + + <%= render(:partial => 'devise/mailer/inviter', :locals => {:invite => i}) %> + + <% end %> + + <% end %> + <% end %> + + + + + 1. Get Connected @@ -150,5 +182,3 @@ - - diff --git a/config/locales/devise/devise.en.yml b/config/locales/devise/devise.en.yml index c920bf1de..fcca12c35 100644 --- a/config/locales/devise/devise.en.yml +++ b/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: