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

Rework email design to adapt to existing styles

Aaron Contreras5d624a1941ad
diff --git a/app/assets/images/icon_logo.png b/app/assets/images/icon_logo.png
deleted file mode 100644
index b3afa1faeb4..00000000000
Binary files a/app/assets/images/icon_logo.png and /dev/null differ
diff --git a/app/mailers/sharing_mailer.rb b/app/mailers/sharing_mailer.rb
index 80ce2cee311..5a96df68484 100644
--- a/app/mailers/sharing_mailer.rb
+++ b/app/mailers/sharing_mailer.rb
@@ -5,18 +5,19 @@ class SharingMailer < ApplicationMailer
def shared_work_package(sharer, membership)
@sharer = sharer
+ @shared_with_user = membership.principal
@work_package = membership.entity
role = membership.roles.first
@role_rights = derive_role_rights(role)
@allowed_work_package_actions = derive_allowed_work_package_actions(role)
- recipient = membership.principal
+ @shared_with_user = membership.principal
set_open_project_headers(@work_package)
message_id(membership, sharer)
- with_locale_for(recipient) do
- mail to: recipient.mail,
+ with_locale_for(@shared_with_user) do
+ mail to: @shared_with_user.mail,
subject: I18n.t('mail.sharing.work_packages.subject',
id: @work_package.id)
end
diff --git a/app/views/mailer/_notification_row.html.erb b/app/views/mailer/_notification_row.html.erb
index fa0775fd1a2..bcb9e6912f0 100644
--- a/app/views/mailer/_notification_row.html.erb
+++ b/app/views/mailer/_notification_row.html.erb
@@ -105,7 +105,7 @@
</table>
<a style="margin-left: 12px;"
- href="<%= notifications_path(work_package.id) %>"
+ href="<%= defined?(open_in_browser_path) ? open_in_browser_path : notifications_path(work_package.id) %>"
target="_blank"
rel="noopener noreferrer">
<%= I18n.t('mail.work_packages.open_in_browser') %>
diff --git a/app/views/sharing_mailer/_notification_mailer_body.html.erb b/app/views/sharing_mailer/_notification_mailer_body.html.erb
deleted file mode 100644
index 48823e63d3d..00000000000
--- a/app/views/sharing_mailer/_notification_mailer_body.html.erb
+++ /dev/null
@@ -1,75 +0,0 @@
-<table <%= placeholder_table_styles(width:'100%', style: "width:100%;min-width:100%") %>>
- <tr>
- <td>
- <table <%= placeholder_table_styles(width:'100%', style: "width:100%;min-width:100%") %>>
- <tr>
- <td>
- <span>
- <%= salutation %>
- </span>
- </td>
- </tr>
-
- <tr>
- <%= placeholder_cell('40px', vertical: false) %>
- </tr>
-
- <tr>
- <td>
- <span style="color: #1A67A3;">
- <%= sharer.name %>
- </span>
- <span>
- <%= t('mail.sharing.work_packages.reason', role_rights: role_rights) %>
- </span>
- </td>
- </tr>
-
- </table>
- </td>
- </tr>
- <tr>
- <%= placeholder_cell('16px', vertical: false) %>
- </tr>
- <tr>
- <td>
- <%= render layout: 'sharing_mailer/notification_row',
- locals: {
- work_package: work_package,
- unique_reasons: [nil],
- show_count: false,
- } do %>
- <table <%= placeholder_table_styles(width:'100%',style: 'width:100%;') %>>
- <tr>
- <td style="<%= placeholder_text_styles %>">
- <%= t('mail.sharing.work_packages.allowed_actions', allowed_actions: allowed_work_package_actions).html_safe %>
- </td>
- </tr>
- </table>
- <% end %>
- </td>
- </tr>
- <tr>
- <%= placeholder_cell('24px', vertical: false) %>
- </tr>
-
- <tr>
- <td>
- <span>
- <%= t('mail.sharing.work_packages.support_text', contact_us_link: '<a style="color: #1A67A3;text-decoration: none;" href="mailto:[email protected]" target="_blank">contact us</a>').html_safe %>
- </span>
- </td>
- </tr>
-
- <tr>
- <%= placeholder_cell('36px', vertical: false) %>
- </tr>
-
- <tr>
- <td>
- <span>
- <%= t('mail.sharing.work_packages.signature').html_safe %>
- </span>
- </td>
- </tr>
-</table>
diff --git a/app/views/sharing_mailer/_notification_mailer_header.html.erb b/app/views/sharing_mailer/_notification_mailer_header.html.erb
deleted file mode 100644
index d127b1b0cfc..00000000000
--- a/app/views/sharing_mailer/_notification_mailer_header.html.erb
+++ /dev/null
@@ -1,52 +0,0 @@
-<table <%= placeholder_table_styles(width:'100%', style: "width:100%;min-width:100%") %>>
- <tr>
- <td>
- <table <%= placeholder_table_styles %>>
- <tr>
- <td>
- <table <%= placeholder_table_styles(width:'100%',style: "width:100%;") %>>
- <tr>
- <td>
- <table <%= placeholder_table_styles(style: 'font-size:24px;font-weight:bold') %>>
- <tr>
- <td style="white-space: nowrap;">
- <%= headline %>
- </td>
- <%= placeholder_cell('4px', vertical: true) %>
- <td style="color: <%= type_color(work_package.type, '#333333') %>;white-space: nowrap;">
- <%= work_package.type.to_s.upcase %>
- </td>
- <%= placeholder_cell('4px', vertical: true) %>
- <td width="100%" style="color: #333333;">
- #<%= work_package.id %>
- </td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <%= placeholder_cell('8px', vertical: false) %>
- </tr>
- <tr>
- <td>
- <span style="font-size:16px; color: #1A67A3; font-weight: bold;">
- <%= summary %>
- </span>
- </td>
- </tr>
- </table>
- </td>
-
- <td>
- <%= image_tag 'icon_logo.png',
- size: '48x48',
- style: 'width:48px;height:48px;' %>
- </td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <%= placeholder_cell('40px', vertical: false) %>
- </tr>
-</table>
diff --git a/app/views/sharing_mailer/_notification_row.html.erb b/app/views/sharing_mailer/_notification_row.html.erb
deleted file mode 100644
index 9999912bf71..00000000000
--- a/app/views/sharing_mailer/_notification_row.html.erb
+++ /dev/null
@@ -1,118 +0,0 @@
-<%= render layout: 'mailer/border_table' do %>
- <tr>
- <td>
- <table <%= placeholder_table_styles(width:'100%',style: 'width:100%;font-size:14px;') %>>
- <tr>
- <%= placeholder_cell('12px', vertical: true) %>
- <td>
- <table <%= placeholder_table_styles %>>
- <tr>
- <td>
- <table <%= placeholder_table_styles %>>
- <tr>
- <td style="color: #333333;
- background-color: #FFFFFF;
- <%= status_colors(work_package.status) %>
- white-space: nowrap;
- padding: 2px 12px;
- height: 18px;
- border-radius:2px;">
- <%= work_package.status %>
- </td>
- </tr>
- </table>
- </td>
- <%= placeholder_cell('8px', vertical: true) %>
- <td width="100%" style="color: #878787;">
- #<%= work_package.id %> - <%= work_package.project %>
- <%= ' - ' unless unique_reasons.length === 1 && unique_reasons.first.nil? %>
- <% unique_reasons.each_with_index do |reason, index| %>
- <%= I18n.t(
- :"mail.work_packages.reason.#{reason || :unknown}",
- default: '') %><%= ', ' unless unique_reasons.size-1 == index %>
- <% end %>
- </td>
- <td>
- <table <%= placeholder_table_styles %>>
- <tr>
- <% if show_count %>
- <td style="background-color: #00A3FF;
- color: white;
- border-radius: 10px;
- padding: 2px 8px;
- font-size: 14px;
- height: 18px;
- line-height: 18px;">
- <%= count %>
- </td>
- <% end %>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- </td>
- <%= placeholder_cell('12px', vertical: true) %>
- </tr>
- <tr>
- <%= placeholder_cell('12px', vertical: true) %>
- <%= placeholder_cell('16px', vertical: false) %>
- <%= placeholder_cell('12px', vertical: true) %>
- </tr>
- <tr>
- <%= placeholder_cell('12px', vertical: true) %>
- <td>
- <table <%= placeholder_table_styles(style: 'font-size:16px;font-weight:bold') %>>
- <tr>
- <td style="color: <%= type_color(work_package.type, '#333333') %>;white-space: nowrap;">
- <%= work_package.type.to_s.upcase %>
- </td>
- <%= placeholder_cell('4px', vertical: true) %>
- <td width="100%" style="color: #333333;">
- <%= work_package.subject %>
- </td>
- </tr>
- </table>
- </td>
- <%= placeholder_cell('12px', vertical: true) %>
- </tr>
- <tr>
- <%= placeholder_cell('12px', vertical: true) %>
- <%= placeholder_cell('12px', vertical: false) %>
- <%= placeholder_cell('12px', vertical: true) %>
- </tr>
- <tr>
- <%= placeholder_cell('12px', vertical: true) %>
- <td><%= yield %></td>
- <%= placeholder_cell('12px', vertical: true) %>
- </tr>
- </table>
- </td>
- </tr>
-<% end %>
-
-<table>
- <tr>
- <%= placeholder_cell('12px', vertical: false) %>
- </tr>
-</table>
-
-<table>
- <tr>
- <td>
- <table <%= placeholder_table_styles(width:'100%',style: 'width:100%;') %>>
- <tr>
- <%= placeholder_cell('0px', vertical: false) %>
- </tr>
- </table>
- </td>
-
- <td>
- <a style="text-decoration:none;padding:8px 12px;color:#333333;border-width:1px;border-color:#878787;border-style:solid;border-radius:16px;white-space:nowrap;"
- href="<%= shared_work_package_path(work_package.id) %>"
- target="_blank">
- <%= I18n.t('mail.sharing.work_packages.open_work_package') %>
- </a>
- </td>
- </tr>
-</table>
diff --git a/app/views/sharing_mailer/shared_work_package.html.erb b/app/views/sharing_mailer/shared_work_package.html.erb
index e3cf935e105..8c5e172c346 100644
--- a/app/views/sharing_mailer/shared_work_package.html.erb
+++ b/app/views/sharing_mailer/shared_work_package.html.erb
@@ -8,30 +8,38 @@
<tr>
<%= placeholder_cell('12px', vertical: true) %>
<td>
- <%= render partial: 'sharing_mailer/notification_mailer_header',
+ <%= render partial: 'mailer/notification_mailer_header',
locals: {
- headline: I18n.t('mail.sharing.work_packages.headline'),
- summary: I18n.t('mail.sharing.work_packages.summary'),
- work_package: @work_package
+ summary: I18n.t('mail.sharing.work_packages.summary', user: @sharer),
+ button_href: shared_work_package_path(@work_package.id),
+ button_text: I18n.t(:'mail.sharing.work_packages.see_in_open_project'),
+ salutation: I18n.t(:'mail.salutation', user: @shared_with_user.firstname)
} %>
- </td>
- <%= placeholder_cell('12px', vertical: true) %>
- </tr>
- <tr>
- <%= placeholder_cell('12px', vertical: true) %>
- <td>
- <%= render partial: 'sharing_mailer/notification_mailer_body',
+
+ <%= render layout: 'mailer/notification_row',
locals: {
- sharer: @sharer,
- salutation: I18n.t('mail.sharing.work_packages.salutation'),
- role_rights: @role_rights,
work_package: @work_package,
- allowed_work_package_actions: @allowed_work_package_actions
- } %>
+ unique_reasons: [:shared],
+ show_count: false,
+ open_in_browser_path: shared_work_package_path(@work_package.id)
+ } do %>
+ <table <%= placeholder_table_styles(width:'100%',style: 'width:100%;') %>>
+ <tr>
+ <td style="<%= placeholder_text_styles %>">
+ <%= t('mail.sharing.work_packages.allowed_actions', allowed_actions: @allowed_work_package_actions).html_safe %>
+ </td>
+ </tr>
+ </table>
+ <% end %>
+
+ <%= render partial: 'mailer/notification_settings_table' %>
+
+ <table>
+ <tr>
+ <%= placeholder_cell('40px', vertical: false) %>
+ </tr>
+ </table>
</td>
<%= placeholder_cell('12px', vertical: true) %>
</tr>
- <tr>
- <%= placeholder_cell('72px', vertical: false) %>
- </tr>
</table>
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 8c771880fc2..9ced65c2f47 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -2258,6 +2258,7 @@ en:
assigned: 'Assigned'
responsible: 'Accountable'
mentioned: 'Mentioned'
+ shared: 'Shared'
subscribed: 'all'
prefix: 'Received because of the notification setting: %{reason}'
date_alert_start_date: 'Date alert'
@@ -2268,8 +2269,9 @@ en:
work_packages:
subject: 'You have been shared work package #%{id}'
headline: 'Invitation to'
- summary: 'This work package has been shared with you'
+ summary: '%{user} shared a work package with you'
salutation: 'Hello,'
+ see_in_open_project: 'See work package in OpenProject'
reason: 'shared the following work package with you with %{role_rights} rights:'
allowed_actions: 'You may %{allowed_actions} this work package. This can change depending on your project role and permissions.'
open_work_package: 'Open work package'