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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Apply hard table layout for notification mail header to be more stable when it comes to different clients
Henriette Dargea6b2eeab45c3
diff --git a/app/helpers/mail_notification_helper.rb b/app/helpers/mail_notification_helper.rbindex b1c8c8b26c0..c3f3a187d91 100644--- a/app/helpers/mail_notification_helper.rb+++ b/app/helpers/mail_notification_helper.rb@@ -72,4 +72,24 @@ module MailNotificationHelpercolor_id = selected_color(status)Color.find(color_id).color_styles.map { |k, v| "#{k}:#{v};" }.join(' ') if color_idend++ def placeholder_table_styles(options = {})+ default_options = {+ style: 'table-layout:fixed;border-collapse:separate;border-spacing:0;' << (options[:style].present? ? options.delete(:style) : ''),+ cellspacing: "0",+ cellpadding: "0"+ }++ default_options.merge(options).map { |k, v| "#{k}=#{v}" }.join(' ')+ end++ def placeholder_cell(number, is_horizontal = true)+ style = if is_horizontal+ "line-height:#{number}; max-width:0; min-width:0; height:#{number}; width:0; font-size:#{number}"+ else+ "max-width:#{number}; min-width:#{number}; width:#{number}"+ end++ content_tag('td', ' ', style: style).html_safe+ endenddiff --git a/app/views/mailer/_notification_mailer_header.html.erb b/app/views/mailer/_notification_mailer_header.html.erbindex b8aec4f2627..42c114fd243 100644--- a/app/views/mailer/_notification_mailer_header.html.erb+++ b/app/views/mailer/_notification_mailer_header.html.erb@@ -1,30 +1,57 @@-<table width="100%" border="0" cellpadding="2px" cellspacing="0" style="border-bottom: 1px solid #cccccc; margin-bottom: 32px;">+<table <%= placeholder_table_styles(style: "width:100%;min-width:100%") %>><tr>- <td width="100%" style="padding-top: 8px; padding-left: 12px;">- <table>+ <td>+ <table <%= placeholder_table_styles %>><tr>- <td style="font-size: 24px; color: #333333; padding-bottom: 5px;">- <%= I18n.t(:'mail.salutation', user: @user.firstname) %>+ <%= placeholder_cell('12px', false) %>+ <td>+ <table <%= placeholder_table_styles(style: "width:100%") %>>+ <tr>+ <td>+ <span style="font-size: 24px; color: #333333;">+ <%= I18n.t(:'mail.salutation', user: @user.firstname) %>+ </span>+ </td>+ </tr>+ <tr>+ <%= placeholder_cell('8px') %>+ </tr>+ <tr>+ <td>+ <span style="font-size:16px; color: #1A67A3; font-weight: bold;">+ <%= summary %>+ </span>+ </td>+ </tr>+ <tr>+ <%= placeholder_cell('24px') %>+ </tr>+ <tr>+ <td>+ <a href="<%= notifications_center_url %>"+ target="_blank"+ style="background: #D1E5F5; padding: 8px 12px; color: #1A67A3; border: 1px solid #1A67A3; border-radius: 16px; text-decoration: none;">+ <%= I18n.t(:'mail.notification.center') %>+ </a>+ </td>+ </tr>+ <tr>+ <%= placeholder_cell('40px') %>+ </tr>+ </table></td>- </tr>- <tr>- <td style="font-size:16px; color: #1A67A3; font-weight: bold; padding-bottom: 10px;">- <%= summary %>- </td>- </tr>- <tr>- <td style="padding: 10px 0 32px 0;">- <a href="<%= notifications_center_url %>"- target="_blank"- style="background: #D1E5F5; padding: 8px 12px; color: #1A67A3; border: 1px solid #1A67A3; border-radius: 16px; text-decoration: none;">- <%= I18n.t(:'mail.notification.center') %>- </a>+ <%= placeholder_cell('16px', false) %>+ <td>+ <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;"}) %>+ </td>+ </tr>+ </table></td></tr></table></td>- <td style="width: 96px; height: 96px; vertical-align: top;">- <%= logo_tag({ alt: "#{Setting.app_title} #{I18n.t(:'mail.logo_alt_text')}", style: "height: 96px;"}) %>- </td></tr>-</table>+</table>\ No newline at end of file