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 @@
<%= raw t("helpers.user_details_paragraph_html")%>
+<%= raw t("helpers.user_details_paragraph_html") %>
-| <%= (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")%> -
-| <%= 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" %> | -