diff --git a/app/assets/stylesheets/bootstrap_and_overrides.css.less b/app/assets/stylesheets/bootstrap_and_overrides.css.less index 8394971..da3827b 100644 --- a/app/assets/stylesheets/bootstrap_and_overrides.css.less +++ b/app/assets/stylesheets/bootstrap_and_overrides.css.less @@ -704,11 +704,11 @@ float:left; } -#s2id_user_organisation_id{ +#s2id_user_organisation_id, #s2id_user_language_id { min-width:84% !important; clear:both; float:left; - margin: 0 0 10px 0; + margin: 0 0 5px 0; } #other-org-link { diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 3903b3f..fd874ba 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -14,17 +14,18 @@ def set_locale # parameter from url takes precedence - if params[:locale] + # check if locale is defined + 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 - # TODO we need to error to the user that locale is missing, it can be THE CASE because there can be a missmatch between locales files and db I18n.locale = params[:locale] - elsif false # TODO + elsif user_signed_in? and !current_user[:language_id].nil? + I18n.locale = Language.find_by_id(current_user[:language_id]).name # if user has set preferred language use it elsif false # TODO # use user's organization language, keep in mine the "OTHER ORG" edge case which should use english else # just use the default language, line can be commented out, included just for clarity - # I18n.locale = config.I18n.default_locale + I18n.locale = I18n.default_locale end end diff --git a/app/controllers/contacts_controller.rb b/app/controllers/contacts_controller.rb index 08843f2..ae9e85a 100644 --- a/app/controllers/contacts_controller.rb +++ b/app/controllers/contacts_controller.rb @@ -1,4 +1,7 @@ -class ContactsController < ContactUs::ContactsController +class ContactsController < ContactUs::ContactsController + + # in order to i18 this file recaptcha gem has to be updated + def create @contact = ContactUs::Contact.new(params[:contact_us_contact]) if (!user_signed_in?) diff --git a/app/models/user.rb b/app/models/user.rb index 2c0064b..5bc6893 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -14,6 +14,7 @@ has_many :project_groups, :dependent => :destroy has_many :organisations , through: :user_org_roles has_many :user_role_types, through: :user_org_roles + has_one :language @@ -47,7 +48,8 @@ attr_accessible :password_confirmation, :encrypted_password, :remember_me, :id, :email, :firstname, :last_login,:login_count, :orcid_id, :password, :shibboleth_id, :user_status_id, :surname, :user_type_id, :organisation_id, :skip_invitation, - :other_organisation, :accept_terms, :role_ids, :dmponline3, :api_token + :other_organisation, :accept_terms, :role_ids, :dmponline3, :api_token, + :language_id # FIXME: The duplication in the block is to set defaults. It might be better if # they could be set in Settings::PlanList itself, if possible. diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/devise/registrations/edit.html.erb index 6b85dc8..23d22a2 100644 --- a/app/views/devise/registrations/edit.html.erb +++ b/app/views/devise/registrations/edit.html.erb @@ -1,138 +1,145 @@

<%= t("helpers.edit_profile") %>

- <%= raw t("helpers.user_details_text_html")%> +<%= raw t("helpers.user_details_text_html") %>
- <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| %> - <%= hidden_field_tag :unlink_flag, "false" ,:id => "unlink_flag" %> - -
+ <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => {:method => :put}) do |f| %> + <%= hidden_field_tag :unlink_flag, "false", :id => "unlink_flag" %> + +
-

<%= raw t("helpers.user_details_paragraph_html")%>

+

<%= raw t("helpers.user_details_paragraph_html") %>

- - - - - - - - - - - - - - - - - - <% other_organisations = Array.new %> - <% Organisation.where("parent_id IS ? AND is_other = ?", nil, 1).each do |org| %> - <% other_organisations << org.id %> - <% end %> - "> - - - - - - - - <% unless @user.api_token.nil? %> - - - - - - - - - <% end %> -
<%= (t("helpers.email") + " *") %><%= f.email_field :email, :as => :email %>
<%= t("helpers.first_name") %><%= f.text_field :firstname, :as => :string, - :id => "first_time_login_firstname", - :autofocus => true, - :class => "text_field has-tooltip", - "data-toggle" => "tooltip", - "data-trigger" => "focus" , - "title" => t("helpers.first_name_help_text") %>
<%= t("helpers.last_name") %><%= f.text_field :surname, - :as => :string, :id => "first_time_login_surname", - :class => "text_field has-tooltip", - "data-toggle" => "tooltip", - "data-trigger" => "focus" , - "title" => t("helpers.surname_help_text") %>
<%= t("helpers.org_type.organisation") %><%= collection_select(:user, - :organisation_id, Organisation.where("parent_id IS NULL").order("name"), - :id, :name, {include_blank: t("helpers.org_type.organisation")}, - { :class => "typeahead org_sign_up" }) %>
<%= t("helpers.orcid_id") %><%= f.text_field :orcid_id , - :as => :string, - :autocomplete => "off" , - :class => "text_field has-tooltip", "data-toggle" => "tooltip", "data-html" => "true", "title" => t("helpers.orcid_html") %>
<%= t("helpers.api_token") %><%= @user.api_token %>
<%= t("helpers.api_info") %><%= link_to( t("helpers.api_use"), controller: "token_permission_types", action: "index")%>
-
-

- <% if Rails.application.config.shibboleth_enabled %> - <% if resource.shibboleth_id.nil? || resource.shibboleth_id.length == 0 then %> - <%= link_to t("helpers.shibboleth_to_link_text"), user_omniauth_shibboleth_path, :class => "a-orange" %> - <% else %> - <%= t("helpers.shibboleth_linked_text") %> - - <%= t("helpers.shibboleth_unlink_label")%> - - <% end %> - <% end %> -

-
-
-
-

- <%= raw t("helpers.edit_password_info")%> -

- - <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %> -
<%= t('custom_devise.waiting_for_confirmation') %><%= resource.unconfirmed_email %>
- <% end %> - - - - - - - - - - - - -
<%= t("helpers.current_password") %> - <%= f.password_field :current_password, :as => :password %> -
<%= t("helpers.new_password") %><%= f.password_field :password, :as => :password, :autocomplete => "off" %> -
<%= t("helpers.password_conf") %><%= f.password_field :password_confirmation, :as => :password, :autocomplete => "off" %>
-
- <%= f.submit t("helpers.submit.save"), :class => "btn btn-primary" %> - <%= link_to t("helpers.submit.cancel"), :back, :class => "btn btn-primary" %> -
- <% end %> - -
+
diff --git a/app/views/layouts/_dmponline_footer.html.erb b/app/views/layouts/_dmponline_footer.html.erb index 4ce4a31..cf63060 100644 --- a/app/views/layouts/_dmponline_footer.html.erb +++ b/app/views/layouts/_dmponline_footer.html.erb @@ -3,10 +3,9 @@