From: Tom Hughes Date: Wed, 24 Jun 2015 23:12:12 +0000 (+0100) Subject: Add HTML version of friend notification email X-Git-Tag: live~4096 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/a22c3525e48872e7f7f083ba6589ca659a13234b?hp=12e22c5de32d287f43ccdc428a2fb13406f0fefb Add HTML version of friend notification email Fixes #995 --- diff --git a/app/models/notifier.rb b/app/models/notifier.rb index bc018cbe8..ff3349e28 100644 --- a/app/models/notifier.rb +++ b/app/models/notifier.rb @@ -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 index 000000000..181b2b825 --- /dev/null +++ b/app/views/notifier/friend_notification.html.erb @@ -0,0 +1,7 @@ +

<%= t 'notifier.friend_notification.had_added_you', :user => @friend.befriender.display_name %>

+ +

<%= raw t 'notifier.friend_notification.see_their_profile', :userurl => link_to(@viewurl, @viewurl) %>

+ +<% unless @friend.befriendee.is_friends_with?(@friend.befriender) -%> +

<%= raw t 'notifier.friend_notification.befriend_them', :befriendurl => link_to(@friendurl, @friendurl) %>

+<% end -%> diff --git a/app/views/notifier/friend_notification.text.erb b/app/views/notifier/friend_notification.text.erb index ca7754757..ae89a4136 100644 --- a/app/views/notifier/friend_notification.text.erb +++ b/app/views/notifier/friend_notification.text.erb @@ -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 -%>