diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index d116bf0..db6502c 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -24,6 +24,7 @@ if params[:locale] # and I18n.available_locales.include? params[:locale] # throw an error if not available # if locales data is present in the parameter from url use it I18n.locale = params[:locale] + elsif user_signed_in? and !current_user[:language_id].nil? I18n.locale = Language.find_by_id(current_user[:language_id]).abbreviation # if user has set preferred language use it @@ -31,6 +32,7 @@ elsif user_signed_in? and current_user.organisation.present? and !current_user.organisation[:language_id].nil? I18n.locale = Language.find_by_id(current_user.organisation[:language_id]).abbreviation # use user's organization language, keep in mine the "OTHER ORG" edge case which should use default language + else # just use the default language, line can be commented out, included just for clarity I18n.locale = I18n.default_locale diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb index 8a60e7b..e11166a 100644 --- a/app/mailers/user_mailer.rb +++ b/app/mailers/user_mailer.rb @@ -2,7 +2,7 @@ default from: I18n.t('helpers.main_email.from') def sharing_notification(project_group) - @project_group = project_group + @project_group = project_group mail(to: @project_group.user.email, subject: I18n.t('helpers.main_email.access_given')) end diff --git a/app/views/user_mailer/permissions_change_notification.html.erb b/app/views/user_mailer/permissions_change_notification.html.erb index 26d84db..10e3c8a 100644 --- a/app/views/user_mailer/permissions_change_notification.html.erb +++ b/app/views/user_mailer/permissions_change_notification.html.erb @@ -1,4 +1,4 @@ -

<%= t('custom_devise.hello') %><%= @project_group.user.name %>

+

<%= t('custom_devise.hello') %> <%= @project_group.user.name %>

<% access_level = "read-only" @@ -9,4 +9,4 @@ end %> -

<%= t('helpers.mailer.permission_relating') %>"<%= link_to @project_group.project.title, project_path(@project_group.project, :only_path => false) %>"<%= t('helpers.mailer.changed') %><%= access_level %><%= t('helpers.mailer.access') %>

+

<%= t('helpers.mailer.permission_relating') %>"<%= link_to @project_group.project.title, url_for(action: 'show', controller: 'projects', id: @project_group.project.id, locale: I18n.default_locale) %>"<%= t('helpers.mailer.changed') %><%= access_level %> <%= t('helpers.mailer.access') %>

diff --git a/app/views/user_mailer/sharing_notification.html.erb b/app/views/user_mailer/sharing_notification.html.erb index 8ed0f53..f93548b 100644 --- a/app/views/user_mailer/sharing_notification.html.erb +++ b/app/views/user_mailer/sharing_notification.html.erb @@ -1,4 +1,4 @@ -

<%= t('custom_devise.hello') %><%= @project_group.user.name %>

+

<%= t('custom_devise.hello') %> <%= @project_group.user.name %>

<% access_level = "read-only" @@ -9,4 +9,5 @@ end %> -

<%= t('helpers.mailer.given') %><%= access_level %><%= t('helpers.mailer.access_two') %>"<%= link_to @project_group.project.title, project_path(@project_group.project, :only_path => false) %>".

+

<%= t('helpers.mailer.given') %><%= access_level %><%= t('helpers.mailer.access_two') %><%= link_to @project_group.project.title, url_for(action: 'show', controller: 'projects', id: @project_group.project.id, locale: I18n.default_locale) %>".

+ diff --git a/config/application.rb b/config/application.rb index 3400116..e852698 100644 --- a/config/application.rb +++ b/config/application.rb @@ -72,8 +72,7 @@ config.action_controller.include_all_helpers = true # Set the default host for mailer URLs - config.action_mailer.default_url_options = { :host => 'example@dcc.ac.uk' } - + config.action_mailer.default_url_options = { :host => "#{Socket.gethostname}" } # Enable shibboleth as an alternative authentication method # Requires server configuration and omniauth shibboleth provider configuration