From 7ef57b2fe858689370dea6852b196d2213dacefa Mon Sep 17 00:00:00 2001 From: Herve Saint-Amand Date: Thu, 12 Jan 2017 23:02:57 +0000 Subject: [PATCH] Dressed up note comment messages --- app/models/notifier.rb | 7 ++++-- .../note_comment_notification.html.erb | 22 ++++++++++--------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/app/models/notifier.rb b/app/models/notifier.rb index d7fa66c4a..73cbbad54 100644 --- a/app/models/notifier.rb +++ b/app/models/notifier.rb @@ -151,6 +151,9 @@ class Notifier < ActionMailer::Base I18n.t("notifier.note_comment_notification.anonymous") end + @user_message_author = @commenter + attach_user_avatar(comment.author) + subject = if @owner I18n.t("notifier.note_comment_notification.#{@event}.subject_own", :commenter => @commenter) else @@ -202,8 +205,8 @@ class Notifier < ActionMailer::Base end def user_avatar_file_path(user) - image = user.image - if image.file? + image = user && user.image + if image && image.file? return image.path(:small) else return "#{Rails.root}/app/assets/images/users/images/small.png" diff --git a/app/views/notifier/note_comment_notification.html.erb b/app/views/notifier/note_comment_notification.html.erb index d82723bbb..ab4378fa2 100644 --- a/app/views/notifier/note_comment_notification.html.erb +++ b/app/views/notifier/note_comment_notification.html.erb @@ -1,13 +1,15 @@ -

<%= t 'notifier.note_comment_notification.greeting' %>

+<% content_for :body do %> +

<%= t 'notifier.note_comment_notification.greeting' %>

-<% if @owner %> -

<%= t "notifier.note_comment_notification.#{@event}.your_note", :commenter => @commenter, :place => @place %>

-<% else %> -

<%= t "notifier.note_comment_notification.#{@event}.commented_note", :commenter => @commenter, :place => @place %>

-<% end %> + <% if @owner %> +

<%= raw t "notifier.note_comment_notification.#{@event}.your_note", :commenter => link_to_user(@commenter), :place => @place %>

+ <% else %> +

<%= raw t "notifier.note_comment_notification.#{@event}.commented_note", :commenter => link_to_user(@commenter), :place => @place %>

+ <% end %> -== -<%= @comment.to_html %> -== + <%= render "notifier/user_message_table", :captured => capture { %> + <%= @comment.to_html %> + <% } %> -

<%= raw t 'notifier.note_comment_notification.details', :url => link_to(@noteurl, @noteurl) %>

+

<%= raw t 'notifier.note_comment_notification.details', :url => link_to(@noteurl, @noteurl) %>

+<% end %> -- 2.43.2