Rather than including HTML markup in the locale file (which also has the inconvenience of requiring both a plain-text and an HTML duplicate of the same string), move the markup to the template. Also added a helper to reduce clutter in the template slightly.
def fp(text)
format_paragraph(text, 72, 0)
end
+
+ def link_to_user(display_name)
+ link_to(
+ display_name,
+ user_url(display_name, :host => SERVER_URL),
+ :target => "_blank",
+ :style => "text-decoration: none; color: #222; font-weight: bold"
+ )
+ end
end
@comment = comment.body
@owner = recipient == comment.changeset.user
@commenter = comment.author.display_name
- @commenter_url = user_url(comment.author.display_name, :host => SERVER_URL)
@changeset_comment = comment.changeset.tags["comment"].presence
@time = comment.created_at
@changeset_author = comment.changeset.user.display_name
<td style="text-align: left; padding: 15px 15px 5px 15px">
<p style="margin: 0">
<% if @owner %>
- <%= t "notifier.changeset_comment_notification.commented.your_changeset_html", :commenter => @commenter, :commenter_url => @commenter_url, :time => @time %>
+ <%= raw t "notifier.changeset_comment_notification.commented.your_changeset", :commenter => link_to_user(@commenter), :time => @time %>
<% else %>
- <%= t "notifier.changeset_comment_notification.commented.commented_changeset_html", :commenter => @commenter, :commenter_url => @commenter_url, :time => @time, :changeset_author => @changeset_author %>
+ <%= raw t "notifier.changeset_comment_notification.commented.commented_changeset", :commenter => link_to_user(@commenter), :time => @time, :changeset_author => @changeset_author %>
<% end %>
<% if @changeset_comment %>
- <%= t "notifier.changeset_comment_notification.commented.partial_changeset_with_comment_html", :changeset_comment => @changeset_comment %>
+ <%= raw t "notifier.changeset_comment_notification.commented.partial_changeset_with_comment", :changeset_comment => content_tag("em", @changeset_comment) %>
<% else %>
<%= t "notifier.changeset_comment_notification.commented.partial_changeset_without_comment" %>
<% end %>
</tr>
</table>
<p>
- <%= raw t 'notifier.changeset_comment_notification.details_html', :url => link_to(@changeset_url, @changeset_url) %>
+ <%= raw t 'notifier.changeset_comment_notification.details', :url => content_tag("nobr", link_to(@changeset_url, @changeset_url)) %>
</p>
</td>
</tr>
<tr>
<td style="text-align: center; font-size: 11px">
<p>
- <%= t 'notifier.changeset_comment_notification.unsubscribe_html', :url => @changeset_url %>
+ <%= raw t 'notifier.changeset_comment_notification.unsubscribe', :url => content_tag("nobr", link_to(@changeset_url, @changeset_url, :style => "color: #222")) %>
</p>
<p style="margin-bottom: 10px">
<a href="<%= @root_url %>" target="_blank" style="color: #222">OpenStreetMap</a>
subject_own: "[OpenStreetMap] %{commenter} has commented on one of your changesets"
subject_other: "[OpenStreetMap] %{commenter} has commented on a changeset you are interested in"
your_changeset: "%{commenter} has left a comment on one of your changesets created at %{time}"
- your_changeset_html: '<a href="%{commenter_url}" target="_blank" style="text-decoration: none; color: #222"><strong>%{commenter}</strong></a>
- has left a comment on one of your changesets
- created at %{time}'
commented_changeset: "%{commenter} has left a comment on a map changeset you are watching created by %{changeset_author} at %{time}"
- commented_changeset_html: '<a href="%{commenter_url}" target="_blank" style="text-decoration: none; color: #222"><strong>%{commenter}</strong></a>
- has left a comment on a map changeset you are watching created by
- %{changeset_author}
- at %{time}'
partial_changeset_with_comment: "with comment '%{changeset_comment}'"
- partial_changeset_with_comment_html: 'with comment <em>%{changeset_comment}</em>'
partial_changeset_without_comment: "without comment"
details: "More details about the changeset can be found at %{url}."
- details_html: 'More details about the changeset can be found at
- <nobr>%{url}</nobr>.'
- unsubscribe_html: 'To unsubscribe from updates to this changeset,
- visit <nobr><a style="color: #222" href="%{url}">%{url}</a></nobr>
- and click "Unsubscribe".'
+ unsubscribe: 'To unsubscribe from updates to this changeset, visit %{url} and click "Unsubscribe".'
message:
inbox:
title: "Inbox"