def link_to_user(display_name)
link_to(
- display_name,
+ content_tag(
+ "strong",
+ display_name,
+ # NB we need "text-decoration: none" twice: GMail only honours it on
+ # the <a> but Outlook only on the <strong>
+ :style => "text-decoration: none"
+ ),
user_url(display_name, :host => SERVER_URL),
:target => "_blank",
- :style => "text-decoration: none; color: #222; font-weight: bold"
+ :style => "text-decoration: none; color: #222"
)
end
end
def style_message(html)
- html.gsub /<p>/, '<p style="color: black; margin: 0.75em 0">'
+ # Because we can't use stylesheets in HTML emails, we need to inline the
+ # styles. Rather than copy-paste the same string of CSS into every message,
+ # we apply it once here, after the message has been composed.
+ html.gsub /<p>/, '<p style="color: black; margin: 0.75em 0; font-family: \'Helvetica Neue\', Arial, Sans-Serif">'
end
end
<body style="padding: 0; margin: 0; font-size: 14px; font-family: 'Helvetica Neue', Arial, sans-serif; color: #222">
<table style="background-color: #eee; width: 100%">
<tr>
- <td style="text-align: center">
- <table style="width: 600px; color: #222; margin-left: auto; margin-right: auto">
+ <%# having width=100% on the table and then only a fixed width on the middle cell gives us a max-width that works in Outlook %>
+ <td rowspan="2"></td>
+ <td width="600" style="text-align: center; padding: 0px 7px">
+ <table style="width: 100%; color: #222; margin-left: auto; margin-right: auto">
<tr>
<td style="width: 30px; padding: 10px 10px 10px 0px">
<a href="<%= @root_url %>" target="_blank">
- <%= image_tag attachments["logo.png"].url, alt: "OpenStreetMap logo", title: "OpenStreetMap", height: "30", width: "30", border: "0" %>
+ <%= image_tag attachments["logo.png"].url, alt: "OpenStreetMap", title: "OpenStreetMap", height: "30", width: "30", border: "0" %>
</a>
</td>
- <td style="padding: 10px 0px">
+ <%# the "width: 100%" here looks wrong, but I couldn't find a better way of making Outlook give this cell full width %>
+ <td style="width: 100%; padding: 0px; text-align: left">
+ <%# NB we need "text-decoration: none" twice: GMail only honours it on the <a> but Outlook only on the <strong> %>
<a href="<%= @root_url %>" target="_blank" style="text-decoration: none; color: #000">
- <h1 style="font-size: 18px; font-weight: 600; margin: 0; text-align: left">OpenStreetMap</h1>
+ <strong style="text-decoration: none; font-size: 18px; font-weight: 600; margin: 0; text-align: left; font-family: 'Helvetica Neue', Arial, sans-serif">OpenStreetMap</strong>
</a>
</td>
</tr>
</tr>
</table>
</td>
+ <td rowspan="2"></td>
</tr>
<tr>
- <td style="text-align: center; font-size: 11px">
+ <td style="text-align: center; font-size: 11px; font-family: 'Helvetica Neue', Arial, sans-serif">
<%= yield :footer %>
<p style="margin-bottom: 10px">
<a href="<%= @root_url %>" target="_blank" style="color: #222">OpenStreetMap</a>
-<table style="font-size: 15px; font-style: italic; margin: 15px 0px; background-color: #eee; width: 520px">
+<table style="font-size: 15px; margin: 15px 0px; background-color: #eee; width: 100%">
<tr>
- <td style="width: 50px; vertical-align: top; padding: 15px">
+ <td style="width: 50px; min-width: 50px; vertical-align: top; padding: 15px">
<%= link_to(
image_tag(
attachments["avatar.png"].url,
:target => "_blank"
) %>
</td>
- <td style="text-align: left; vertical-align: top; padding-right: 10px">
+ <td style="text-align: left; vertical-align: top; padding-right: 10px; width: 100%">
<%= body %>
</td>
</tr>
<% end %>
<p>
- <%= raw t 'notifier.changeset_comment_notification.details', :url => link_to(@changeset_url, @changeset_url, :style => "white-space: nowrap") %>
+ <%= raw t 'notifier.changeset_comment_notification.details', :url => link_to(@changeset_url, @changeset_url) %>
</p>
<% content_for :footer do %>
<p>
- <%= raw t 'notifier.changeset_comment_notification.unsubscribe', :url => link_to(@changeset_url, @changeset_url, :style => "color: #222; white-space: nowrap") %>
+ <%= raw t 'notifier.changeset_comment_notification.unsubscribe', :url => link_to(@changeset_url, @changeset_url, :style => "color: #222") %>
</p>
<% end %>
<p><%= t 'notifier.email_confirm_html.click_the_link' %></p>
-<p><a href="<%= @url %>" style="white-space: nowrap"><%= @url %></a></p>
+<p><a href="<%= @url %>"><%= @url %></a></p>
<p><%= t("notifier.signup_confirm.confirm") %></p>
-<p><%= link_to @url, @url, :style => "white-space: nowrap" %></p>
+<p><%= link_to @url, @url %></p>
<p><%= t("notifier.signup_confirm.welcome") %></p>