Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Attempt to fix the width problem in iOS and outlook by providing inline styles next to direct attributes. Further the content is centred in its own table

Henriette Dargee4b134e1363c
diff --git a/app/helpers/mail_notification_helper.rb b/app/helpers/mail_notification_helper.rb
index 02865a820b8..f032d466674 100644
--- a/app/helpers/mail_notification_helper.rb
+++ b/app/helpers/mail_notification_helper.rb
@@ -90,6 +90,6 @@ module MailNotificationHelper
"line-height:#{number}; max-width:0; min-width:0; height:#{number}; width:0; font-size:#{number}"
end
- content_tag('td', ' ', style: style).html_safe
+ content_tag('td', ' '.html_safe, style: style).html_safe
end
end
diff --git a/app/views/digest_mailer/work_packages.html.erb b/app/views/digest_mailer/work_packages.html.erb
index 17170c883a4..e2186c22906 100644
--- a/app/views/digest_mailer/work_packages.html.erb
+++ b/app/views/digest_mailer/work_packages.html.erb
@@ -1,81 +1,89 @@
-<%= render partial: 'mailer/notification_mailer_header',
- locals: {
- summary: "#{I18n.t(:'mail.digests.you_have')} #{digest_summary_text(@notification_ids.length, @mentioned_count)}"
- } %>
+<table <%= placeholder_table_styles(width:'100%',style: 'width:100%;max-width:700px;margin-left:auto;margin-right:auto') %>>
+ <tr>
+ <td>
+ <%= render partial: 'mailer/notification_mailer_header',
+ locals: {
+ summary: "#{I18n.t(:'mail.digests.you_have')} #{digest_summary_text(@notification_ids.length, @mentioned_count)}"
+ } %>
-<% @aggregated_notifications.first(DigestMailer::MAX_SHOWN_WORK_PACKAGES).each do | work_package, notifications_by_work_package| %>
- <%= render layout: 'mailer/notification_row',
- locals: {
- work_package: work_package,
- notifications_by_work_package: notifications_by_work_package
- } do %>
- <table <%= placeholder_table_styles %>>
- <% notifications_by_work_package.each do | notification | %>
- <% if notification.journal.notes.present? %>
- <tr>
- <td style="color: #878787; line-height: 24px; font-size: 14px;">
- <%= digest_comment_text(notification) %>
- <%= digest_notification_timestamp_text(notification) %>
- </td>
- </tr>
- <% end %>
- <% notification.journal.details.each do |detail| %>
- <tr>
- <td style="color: #878787; line-height: 24px; font-size: 14px;">
- <%= notification.journal.render_detail(detail, only_path: false) %>
- <%= digest_notification_timestamp_text(notification) %>
- </td>
- </tr>
+ <% @aggregated_notifications.first(DigestMailer::MAX_SHOWN_WORK_PACKAGES).each do | work_package, notifications_by_work_package| %>
+ <%= render layout: 'mailer/notification_row',
+ locals: {
+ work_package: work_package,
+ notifications_by_work_package: notifications_by_work_package
+ } do %>
+ <table <%= placeholder_table_styles %>>
+ <% notifications_by_work_package.each do | notification | %>
+ <% if notification.journal.notes.present? %>
+ <tr>
+ <td style="color: #878787; line-height: 24px; font-size: 14px; white-space: normal;">
+ <%= digest_comment_text(notification) %>
+ <%= digest_notification_timestamp_text(notification) %>
+ </td>
+ </tr>
+ <% end %>
+ <% notification.journal.details.each do |detail| %>
+ <tr>
+ <td style="color: #878787; line-height: 24px; font-size: 14px; white-space: normal;">
+ <%= notification.journal.render_detail(detail, only_path: false) %>
+ <%= digest_notification_timestamp_text(notification) %>
+ </td>
+ </tr>
+ <% end %>
+ <% end %>
+ </table>
<% end %>
<% end %>
- </table>
- <% end %>
-<% end %>
-<table <%= placeholder_table_styles(style: 'font-size:14px;') %>>
- <tr>
- <td>
- <table <%= placeholder_table_styles(style: 'width:100%;') %>>
+ <table <%= placeholder_table_styles(style: 'font-size:14px;') %>>
<tr>
<td>
- <table>
+ <table <%= placeholder_table_styles(width:'100%',style: 'width:100%;') %>>
<tr>
<td>
- <span>
+ <table>
+ <tr>
+ <td>
+ <span style="font-size:14px;">
<% number_of_overflowing_work_packages = @aggregated_notifications.length - DigestMailer::MAX_SHOWN_WORK_PACKAGES %>
- <% count = number_of_overflowing_work_packages === 1 ? 'one' : 'other' %>
- <%= I18n.t(:"mail.digests.work_packages.more_to_see.#{count}", count: number_of_overflowing_work_packages) %>
+ <% count = number_of_overflowing_work_packages === 1 ? 'one' : 'other' %>
+ <%= I18n.t(:"mail.digests.work_packages.more_to_see.#{count}", count: number_of_overflowing_work_packages) %>
</span>
- </td>
- <%= placeholder_cell('10px', true) %>
- <td>
- <a
- target="_blank"
- style="background-color: #D1E5F5;
- padding: 8px 12px;
- color: #1A67A3;
- border: 1px solid #1A67A3;
- border-radius: 16px;
- text-decoration: none;
- white-space: nowrap;">
- <%= I18n.t(:'mail.digests.work_packages.see_all') %>
- </a>
+ </td>
+ <%= placeholder_cell('10px', true) %>
+ <td>
+ <a
+ target="_blank"
+ style="background-color: #D1E5F5;
+ padding: 8px 12px;
+ color: #1A67A3;
+ border: 1px solid #1A67A3;
+ border-radius: 16px;
+ text-decoration: none;
+ font-size:14px;
+ white-space: nowrap;">
+ <%= I18n.t(:'mail.digests.work_packages.see_all') %>
+ </a>
+ </td>
+ </tr>
+ </table>
</td>
</tr>
</table>
</td>
+ <%= placeholder_cell('10px', true) %>
+ <td>
+ <%= render partial: 'mailer/notification_settings_button' %>
+ </td>
+ </tr>
+ </table>
+
+ <table>
+ <tr>
+ <%= placeholder_cell('20px') %>
</tr>
</table>
- </td>
- <%= placeholder_cell('10px', true) %>
- <td>
- <%= render partial: 'mailer/notification_settings_button' %>
</td>
</tr>
</table>
-<table>
- <tr>
- <%= placeholder_cell('20px') %>
- </tr>
-</table>
\ No newline at end of file
diff --git a/app/views/layouts/mailer.html.erb b/app/views/layouts/mailer.html.erb
index f5793ab5d84..20ac8ad8361 100644
--- a/app/views/layouts/mailer.html.erb
+++ b/app/views/layouts/mailer.html.erb
@@ -77,8 +77,11 @@ See COPYRIGHT and LICENSE files for more details.
color: #878787;
}
</style>
+
+ <meta name="x-apple-disable-message-reformatting">
+ <meta name="viewport" content="initial-scale=1.0">
</head>
- <body>
+ <body style="padding: 0">
<span class="header"><%= OpenProject::TextFormatting::Renderer.format_text(Setting.localized_emails_header) %></span>
<%= call_hook(:view_layouts_mailer_html_before_content, self.assigns) %>
<%= yield %>
diff --git a/app/views/mailer/_notification_mailer_header.html.erb b/app/views/mailer/_notification_mailer_header.html.erb
index b0c06a67fd3..9bb952ed7cc 100644
--- a/app/views/mailer/_notification_mailer_header.html.erb
+++ b/app/views/mailer/_notification_mailer_header.html.erb
@@ -1,11 +1,11 @@
-<table <%= placeholder_table_styles(style: "width:100%;min-width:100%") %>>
+<table <%= placeholder_table_styles(width:'100%',style: "width:100%;min-width:100%") %>>
<tr>
<td>
<table <%= placeholder_table_styles %>>
<tr>
<%= placeholder_cell('12px', true) %>
<td>
- <table <%= placeholder_table_styles(style: "width:100%") %>>
+ <table <%= placeholder_table_styles(width:'100%',style: "width:100%") %>>
<tr>
<td>
<span style="font-size: 24px; color: #333333;">
@@ -45,7 +45,7 @@
<table <%= placeholder_table_styles %>>
<tr>
<td style="width: 96px; height: 96px; vertical-align: top;">
- <%= logo_tag({ alt: "#{Setting.app_title} #{I18n.t(:'mail.logo_alt_text')}", style: "height: 96px;"}) %>
+ <%= logo_tag({ alt: "#{Setting.app_title} #{I18n.t(:'mail.logo_alt_text')}", style: "height: 96px;max-width: 240px;"}) %>
</td>
</tr>
</table>
diff --git a/app/views/mailer/_notification_row.html.erb b/app/views/mailer/_notification_row.html.erb
index df956b9c881..c39849d3897 100644
--- a/app/views/mailer/_notification_row.html.erb
+++ b/app/views/mailer/_notification_row.html.erb
@@ -1,10 +1,10 @@
-<table <%= placeholder_table_styles(style: "width:100%;border-width:1px;border-color:#E0E0E0;border-style:solid;border-radius:10px") %>>
+<table <%= placeholder_table_styles(width:'100%',style: "width:100%;border-width:1px;border-color:#E0E0E0;border-style:solid;border-radius:10px") %>>
<tr>
<%= placeholder_cell('12px') %>
</tr>
<tr>
<td>
- <table <%= placeholder_table_styles(style: 'width:100%;font-size:14px;') %>>
+ <table <%= placeholder_table_styles(width:'100%',style: 'width:100%;font-size:14px;') %>>
<tr>
<%= placeholder_cell('12px', true) %>
<td>