diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb index 90c6278..b4b34e3 100644 --- a/app/mailers/user_mailer.rb +++ b/app/mailers/user_mailer.rb @@ -1,6 +1,14 @@ class UserMailer < ActionMailer::Base default from: Rails.configuration.branding[:organisation][:email] + def welcome_notification(user) + @user = user + FastGettext.with_locale FastGettext.default_locale do + mail(to: @user.email, + subject: "#{_('Welcome to')} #{Rails.configuration.branding[:application][:name]}") + end + end + def sharing_notification(role, user) @role = role @user = user diff --git a/app/views/devise/mailer/reset_password_instructions.html.erb b/app/views/devise/mailer/reset_password_instructions.html.erb index 21ba9ff..55858c9 100644 --- a/app/views/devise/mailer/reset_password_instructions.html.erb +++ b/app/views/devise/mailer/reset_password_instructions.html.erb @@ -1,10 +1,13 @@ <% FastGettext.with_locale FastGettext.default_locale do %> -
<%= _("Hello") %> <%= @resource.email %>!
+<%= _("Hello ") %><%= @resource.email %>
-<%= _("Someone has requested a link to change your") %> <%= link_to Rails.configuration.branding[:application][:name], root_url %> <%= _("password. You can do this through the link below.") %>
+<%= _("Someone has requested a link to change your ") %><%= Rails.configuration.branding[:application][:name] %><%= _(" password. You can do this through the link below.") %>
-<%= link_to _('Change my password'), edit_password_url(@resource, :reset_password_token => @token) %>
+<%= link_to _('Change my password'), edit_password_url(@resource, :reset_password_token => @token) %>
-<%= _("If you didn't request this, please ignore this email.") %>
-<%= _("Your password won't change until you access the link above and create a new one.") %>
+<%= _("If you didn't request this, please ignore this email.") %>
+ +
+ <%= _("Many thanks,") %>
<%= _('The ') %><%= Rails.configuration.branding[:application][:name] %><%= _(' team') %>
+
<% _('Hello ') %><%= @user.name %>
- -- <% _('You have been granted permission by your organisation to use our API. ') %>"<%= link_to _('Your API token and instructions for using the API endpoints can be found here.'), controller: "users", action: "edit" %>". -
+<% _('Hello ') %><%= @user.name %>
+ +<%= _('You have been granted permission by your organisation to use our API. Your API token and instructions for using the API endpoints can be found ')%>here. +
+ +
+ <%=_('All the best,')%>
+
+ <%= _('The ')%><%= Rails.configuration.branding[:application][:name] %><%=_(' team')%>.
+
<%= _('Hello ') %> <%= @role.user.name %>
+<%= _('Hello ') %><%= @role.user.name %>
- <% - access_level = "read-only" - if @role.editor? - access_level = "editor" - end - if @role.administrator? - access_level = "co-owner" - end - %> + <% + access_level = "read-only" + permissions = "This means you can read the plan and leave comments." + if @role.editor? + access_level = "editor" + permissions = "This means you can write and edit the plan in a collaborative manner." + end + if @role.administrator? + access_level = "co-owner" + permissions = "This means you can write and edit the plan in a collaborative manner. You can also grant rights to other collaborators." + end + %> -<%= _('Your permissions relating to ') %>"<%= link_to @role.plan.title, url_for(action: 'show', controller: 'plans', id: @role.plan.id, locale: I18n.default_locale) %>"<%= _(' have changed. You now have ') %><%= access_level %><%= _(' access.') %>
+<%= _('Your permissions relating to ') %>"<%= link_to @role.plan.title, url_for(action: 'show', controller: 'plans', id: @role.plan.id, locale: I18n.default_locale) %>"<%= _(' have changed. ') %><%= permissions %>
+ +
+ <%=_('All the best,')%>
+
+ <%= _('The ')%><%= Rails.configuration.branding[:application][:name] %><%=_(' team')%>.
+
<%= _('Hello ') %> <%= @role.user.name %>
+<%= _('Hello ') %><%= @role.user.name %>
- <% - access_level = "read-only" - if @role.editor? - access_level = "editor" - elsif @role.administrator? - access_level = "co-owner" - end - %> +<%= _('A colleague has invited you to contribute to their Data Management Plan at ') %><%=Rails.configuration.branding[:application][:name]%>
-<%= _('You have been given ') %><%= access_level %><%= _(' access to') %>"<%= link_to @role.plan.title, url_for(action: 'show', controller: 'plans', id: @role.plan.id, locale: FastGettext.default_locale) %>" <%=_(' by ')%><%= @user.name %>.
+<%= link_to _('Click here'), url_for(action: 'show', controller: 'plans', id: @role.plan.id, locale: FastGettext.default_locale) %><%= _(' to accept the invitation, (or copy ') %><%= url_for(action: 'show', controller: 'plans', id: @role.plan.id, locale: FastGettext.default_locale) %><%= _(' into your browser)')%> -
<%=_('Please follow the link above to login to ')%><%=Rails.configuration.branding[:application][:name]%><%=_(' to view/edit the plan')%>.
-<%=_('Thanks')%>
-<%=Rails.configuration.branding[:application][:name]%> <%=_(' team')%>
+<%= _('If you don\'t want to accept the invitation, please ignore this email.') %>
+ +
+ <%=_('All the best,')%>
+
+ <%= _('The ')%><%= Rails.configuration.branding[:application][:name] %><%=_(' team')%>.
+
<%= _('Welcome to ') %><%= Rails.configuration.branding[:application][:name] %>
+ +<%= Rails.configuration.branding[:application][:name] %><%= _(' will help you to develop your Data Management Plan. If you have any queries or feedback as you use the tool, please contact us on ') %><%= Rails.configuration.branding[:application][:email] %>
+ +
+ <%=_('All the best,')%>
+
+ <%= _('The ')%><%= Rails.configuration.branding[:application][:name] %><%=_(' team')%>.
+