Remove HTML markup from locale file
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.
This commit is contained in:
parent
beaa85e21c
commit
ac081305f2
4 changed files with 15 additions and 19 deletions
|
@ -2,4 +2,13 @@ module NotifierHelper
|
|||
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
|
||||
|
|
|
@ -159,7 +159,6 @@ class Notifier < ActionMailer::Base
|
|||
@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
|
||||
|
|
|
@ -27,12 +27,12 @@
|
|||
<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 %>
|
||||
|
@ -48,7 +48,7 @@
|
|||
</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>
|
||||
|
@ -61,7 +61,7 @@
|
|||
<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>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue