diff options
author | Fabian Schneider <fabbbbbi+git@googlemail.com> | 2019-02-21 01:58:53 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-02-21 01:58:53 +0300 |
commit | a32fd49dd87414fcb8a9c979bd19b57355758c6e (patch) | |
tree | b797cfd4d7315be01162301fbf6ea98b99692fa5 /app | |
parent | 09532e38bd7c612fd3d0e6ac7e17ec7bc648302f (diff) |
Move language setting to preferences
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/profiles/preferences_controller.rb | 10 | ||||
-rw-r--r-- | app/controllers/profiles_controller.rb | 1 | ||||
-rw-r--r-- | app/helpers/preferences_helper.rb | 4 | ||||
-rw-r--r-- | app/views/profiles/preferences/show.html.haml | 6 | ||||
-rw-r--r-- | app/views/profiles/show.html.haml | 3 |
5 files changed, 19 insertions, 5 deletions
diff --git a/app/controllers/profiles/preferences_controller.rb b/app/controllers/profiles/preferences_controller.rb index 94002095739..0227af2c266 100644 --- a/app/controllers/profiles/preferences_controller.rb +++ b/app/controllers/profiles/preferences_controller.rb @@ -37,6 +37,14 @@ class Profiles::PreferencesController < Profiles::ApplicationController end def preferences_param_names - [:color_scheme_id, :layout, :dashboard, :project_view, :theme_id, :first_day_of_week] + [ + :color_scheme_id, + :layout, + :dashboard, + :project_view, + :theme_id, + :first_day_of_week, + :preferred_language + ] end end diff --git a/app/controllers/profiles_controller.rb b/app/controllers/profiles_controller.rb index 15248d2d08f..b9c52618d4b 100644 --- a/app/controllers/profiles_controller.rb +++ b/app/controllers/profiles_controller.rb @@ -104,7 +104,6 @@ class ProfilesController < Profiles::ApplicationController :username, :website_url, :organization, - :preferred_language, :private_profile, :include_private_contributions, status: [:emoji, :message] diff --git a/app/helpers/preferences_helper.rb b/app/helpers/preferences_helper.rb index bc1742e8167..eed529f93db 100644 --- a/app/helpers/preferences_helper.rb +++ b/app/helpers/preferences_helper.rb @@ -62,6 +62,10 @@ module PreferencesHelper Gitlab::ColorSchemes.for_user(current_user).css_class end + def language_choices + Gitlab::I18n::AVAILABLE_LANGUAGES.map { |value, label| [label, value] } + end + private # Ensure that anyone adding new options updates `DASHBOARD_CHOICES` too diff --git a/app/views/profiles/preferences/show.html.haml b/app/views/profiles/preferences/show.html.haml index 1a9aca1f6bf..bfe1c3ddf33 100644 --- a/app/views/profiles/preferences/show.html.haml +++ b/app/views/profiles/preferences/show.html.haml @@ -73,6 +73,12 @@ = link_to _('Learn more'), help_page_path('user/profile/preferences', anchor: 'localization'), target: '_blank' .col-lg-8 .form-group + = f.label :preferred_language, class: 'label-bold' do + = _('Language') + = f.select :preferred_language, language_choices, {}, class: 'select2' + .form-text.text-muted + = s_('Preferences|This feature is experimental and translations are not complete yet') + .form-group = f.label :first_day_of_week, class: 'label-bold' do = _('First day of the week') = f.select :first_day_of_week, first_day_of_week_choices_with_default, {}, class: 'form-control' diff --git a/app/views/profiles/show.html.haml b/app/views/profiles/show.html.haml index 753316b27e2..4d3d92d09c0 100644 --- a/app/views/profiles/show.html.haml +++ b/app/views/profiles/show.html.haml @@ -95,9 +95,6 @@ = f.select :commit_email, options_for_select(commit_email_select_options(@user), selected: selected_commit_email(@user)), { help: s_("Profiles|This email will be used for web based operations, such as edits and merges. %{learn_more}").html_safe % { learn_more: commit_email_docs_link } }, control_class: 'select2 input-lg' - = f.select :preferred_language, Gitlab::I18n::AVAILABLE_LANGUAGES.map { |value, label| [label, value] }, - { help: s_("Profiles|This feature is experimental and translations are not complete yet") }, - control_class: 'select2 input-lg' = f.text_field :skype, class: 'input-md', placeholder: s_("Profiles|username") = f.text_field :linkedin, class: 'input-md', help: s_("Profiles|Your LinkedIn profile name from linkedin.com/in/profilename") = f.text_field :twitter, class: 'input-md', placeholder: s_("Profiles|@username") |