Add HTML version of friend notification email
authorTom Hughes <tom@compton.nu>
Wed, 24 Jun 2015 23:12:12 +0000 (00:12 +0100)
committerTom Hughes <tom@compton.nu>
Wed, 24 Jun 2015 23:16:15 +0000 (00:16 +0100)
Fixes #995

app/models/notifier.rb
app/views/notifier/friend_notification.html.erb [new file with mode: 0644]
app/views/notifier/friend_notification.text.erb

index bc018cbe83c2ae81c8c7d464930e982fa87bc697..ff3349e28b8e8c854c982f921056e4728fb3bd51 100644 (file)
@@ -116,6 +116,12 @@ class Notifier < ActionMailer::Base
   def friend_notification(friend)
     with_recipient_locale friend.befriendee do
       @friend = friend
+      @viewurl = url_for(:host => SERVER_URL,
+                         :controller => "user", :action => "view",
+                         :display_name => @friend.befriender.display_name)
+      @friendurl = url_for(:host => SERVER_URL,
+                           :controller => "user", :action => "make_friend",
+                           :display_name => @friend.befriender.display_name)
 
       mail :to => friend.befriendee.email,
            :subject => I18n.t("notifier.friend_notification.subject", :user => friend.befriender.display_name)
diff --git a/app/views/notifier/friend_notification.html.erb b/app/views/notifier/friend_notification.html.erb
new file mode 100644 (file)
index 0000000..181b2b8
--- /dev/null
@@ -0,0 +1,7 @@
+<p><%= t 'notifier.friend_notification.had_added_you', :user => @friend.befriender.display_name %></p>
+
+<p><%= raw t 'notifier.friend_notification.see_their_profile', :userurl => link_to(@viewurl, @viewurl) %></p>
+
+<% unless @friend.befriendee.is_friends_with?(@friend.befriender) -%>
+<p><%= raw t 'notifier.friend_notification.befriend_them', :befriendurl => link_to(@friendurl, @friendurl) %></p>
+<% end -%>
index ca77547570a6f543f4e7694ba7c7a0fb1da12b3f..ae89a41365d96037450da9006892ac6674163391 100644 (file)
@@ -1,20 +1,7 @@
-<%=
-  t 'notifier.friend_notification.had_added_you',
-     :user => @friend.befriender.display_name
-%>
+<%= t 'notifier.friend_notification.had_added_you', :user => @friend.befriender.display_name %>
 
-<%=
-  t 'notifier.friend_notification.see_their_profile',
-     :userurl => url_for(:host => SERVER_URL,
-                         :controller => "user", :action => "view",
-                         :display_name => @friend.befriender.display_name)
-%>
+<%= t 'notifier.friend_notification.see_their_profile', :userurl => @viewurl %>
 
-<%=
-  unless @friend.befriendee.is_friends_with?(@friend.befriender)
-    t 'notifier.friend_notification.befriend_them',
-       :befriendurl => url_for(:host => SERVER_URL,
-                               :controller => "user", :action => "make_friend",
-                               :display_name => @friend.befriender.display_name)
-  end
-%>
+<% unless @friend.befriendee.is_friends_with?(@friend.befriender) -%>
+<%= t 'notifier.friend_notification.befriend_them', :befriendurl => @friendurl %>
+<% end -%>