From 864ce6b87ad610ac0bace900bb7e9ebcc0d63983 Mon Sep 17 00:00:00 2001 From: Fabian Schneider Date: Thu, 10 Jan 2019 22:06:42 +0100 Subject: Rename setting, fix wordings --- app/helpers/application_settings_helper.rb | 2 +- app/helpers/preferences_helper.rb | 4 ++-- app/models/application_setting.rb | 2 +- .../admin/application_settings/_localization.html.haml | 4 ++-- app/views/profiles/preferences/show.html.haml | 2 -- ..._default_first_day_of_week_to_application_settings.rb | 16 ---------------- ...0717_add_first_day_of_week_to_application_settings.rb | 16 ++++++++++++++++ db/schema.rb | 2 +- doc/user/profile/preferences.md | 4 +--- lib/gitlab/gon_helper.rb | 3 +-- locale/gitlab.pot | 9 +++------ 11 files changed, 28 insertions(+), 36 deletions(-) delete mode 100644 db/migrate/20181028120717_add_default_first_day_of_week_to_application_settings.rb create mode 100644 db/migrate/20181028120717_add_first_day_of_week_to_application_settings.rb diff --git a/app/helpers/application_settings_helper.rb b/app/helpers/application_settings_helper.rb index 667c5097d91..67d16306525 100644 --- a/app/helpers/application_settings_helper.rb +++ b/app/helpers/application_settings_helper.rb @@ -136,7 +136,6 @@ module ApplicationSettingsHelper :container_registry_token_expire_delay, :default_artifacts_expire_in, :default_branch_protection, - :default_first_day_of_week, :default_group_visibility, :default_project_visibility, :default_projects_limit, @@ -151,6 +150,7 @@ module ApplicationSettingsHelper :email_author_in_body, :enabled_git_access_protocol, :enforce_terms, + :first_day_of_week, :gitaly_timeout_default, :gitaly_timeout_medium, :gitaly_timeout_fast, diff --git a/app/helpers/preferences_helper.rb b/app/helpers/preferences_helper.rb index 0faa28581cc..f1513f4f680 100644 --- a/app/helpers/preferences_helper.rb +++ b/app/helpers/preferences_helper.rb @@ -51,11 +51,11 @@ module PreferencesHelper end def default_first_day_of_week - first_day_of_week_choices.rassoc(Gitlab::CurrentSettings.default_first_day_of_week).first + first_day_of_week_choices.rassoc(Gitlab::CurrentSettings.first_day_of_week).first end def first_day_of_week_choices_with_default - first_day_of_week_choices.unshift([_('System Default (%{default})') % { default: default_first_day_of_week }, nil]) + first_day_of_week_choices.unshift([_('System default (%{default})') % { default: default_first_day_of_week }, nil]) end def user_application_theme diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb index 4f9dee1720c..6d7c51c2315 100644 --- a/app/models/application_setting.rb +++ b/app/models/application_setting.rb @@ -237,7 +237,6 @@ class ApplicationSetting < ActiveRecord::Base container_registry_token_expire_delay: 5, default_artifacts_expire_in: '30 days', default_branch_protection: Settings.gitlab['default_branch_protection'], - default_first_day_of_week: 0, default_group_visibility: Settings.gitlab.default_projects_features['visibility_level'], default_project_visibility: Settings.gitlab.default_projects_features['visibility_level'], default_projects_limit: Settings.gitlab['default_projects_limit'], @@ -247,6 +246,7 @@ class ApplicationSetting < ActiveRecord::Base dsa_key_restriction: 0, ecdsa_key_restriction: 0, ed25519_key_restriction: 0, + first_day_of_week: 0, gitaly_timeout_default: 55, gitaly_timeout_fast: 10, gitaly_timeout_medium: 30, diff --git a/app/views/admin/application_settings/_localization.html.haml b/app/views/admin/application_settings/_localization.html.haml index 7392b32ee89..95d016a94a5 100644 --- a/app/views/admin/application_settings/_localization.html.haml +++ b/app/views/admin/application_settings/_localization.html.haml @@ -3,8 +3,8 @@ %fieldset .form-group - = f.label :default_first_day_of_week, _('Default first day of the week'), class: 'label-bold' - = f.select :default_first_day_of_week, first_day_of_week_choices, {}, class: 'form-control' + = f.label :first_day_of_week, _('Default first day of the week'), class: 'label-bold' + = f.select :first_day_of_week, first_day_of_week_choices, {}, class: 'form-control' .form-text.text-muted = _('Default first day of the week in calendars and date pickers.') diff --git a/app/views/profiles/preferences/show.html.haml b/app/views/profiles/preferences/show.html.haml index e290ba89684..1a9aca1f6bf 100644 --- a/app/views/profiles/preferences/show.html.haml +++ b/app/views/profiles/preferences/show.html.haml @@ -76,7 +76,5 @@ = 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' - .form-text.text-muted - = _('Choose on what day the week should start.') .form-group = f.submit _('Save changes'), class: 'btn btn-success' diff --git a/db/migrate/20181028120717_add_default_first_day_of_week_to_application_settings.rb b/db/migrate/20181028120717_add_default_first_day_of_week_to_application_settings.rb deleted file mode 100644 index 110a48d4d35..00000000000 --- a/db/migrate/20181028120717_add_default_first_day_of_week_to_application_settings.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -class AddDefaultFirstDayOfWeekToApplicationSettings < ActiveRecord::Migration - include Gitlab::Database::MigrationHelpers - disable_ddl_transaction! - - DOWNTIME = false - - def up - add_column_with_default(:application_settings, :default_first_day_of_week, :integer, default: 0) - end - - def down - remove_column(:application_settings, :default_first_day_of_week) - end -end diff --git a/db/migrate/20181028120717_add_first_day_of_week_to_application_settings.rb b/db/migrate/20181028120717_add_first_day_of_week_to_application_settings.rb new file mode 100644 index 00000000000..53cfaa289f6 --- /dev/null +++ b/db/migrate/20181028120717_add_first_day_of_week_to_application_settings.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class AddFirstDayOfWeekToApplicationSettings < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + disable_ddl_transaction! + + DOWNTIME = false + + def up + add_column_with_default(:application_settings, :first_day_of_week, :integer, default: 0) + end + + def down + remove_column(:application_settings, :first_day_of_week) + end +end diff --git a/db/schema.rb b/db/schema.rb index aef0f234a72..ffdc937ab52 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -168,7 +168,7 @@ ActiveRecord::Schema.define(version: 20190131122559) do t.string "commit_email_hostname" t.boolean "protected_ci_variables", default: false, null: false t.string "runners_registration_token_encrypted" - t.integer "default_first_day_of_week", default: 0, null: false + t.integer "first_day_of_week", default: 0, null: false t.index ["usage_stats_set_by_user_id"], name: "index_application_settings_on_usage_stats_set_by_user_id", using: :btree end diff --git a/doc/user/profile/preferences.md b/doc/user/profile/preferences.md index 6b8b5cf4d5e..c8f4e9bf1f3 100644 --- a/doc/user/profile/preferences.md +++ b/doc/user/profile/preferences.md @@ -90,9 +90,7 @@ You can choose between 3 options: ## Localization -This following setting allows you to customize calendar layouts. - ### First day of the week You can choose between **System Default**, **Sunday** and **Monday** for the first day of the week. If you select **System Default**, the system-wide default setting will be used. -This preference will be used for all calendar views and datepickers. +This preference will be used for all calendar views and date pickers. diff --git a/lib/gitlab/gon_helper.rb b/lib/gitlab/gon_helper.rb index f0af5329d76..3235d3ccc4e 100644 --- a/lib/gitlab/gon_helper.rb +++ b/lib/gitlab/gon_helper.rb @@ -24,14 +24,13 @@ module Gitlab gon.emoji_sprites_css_path = ActionController::Base.helpers.stylesheet_path('emoji_sprites') gon.test_env = Rails.env.test? gon.suggested_label_colors = LabelsHelper.suggested_colors - gon.first_day_of_week = Gitlab::CurrentSettings.default_first_day_of_week + gon.first_day_of_week = current_user&.first_day_of_week || Gitlab::CurrentSettings.first_day_of_week if current_user gon.current_user_id = current_user.id gon.current_username = current_user.username gon.current_user_fullname = current_user.name gon.current_user_avatar_url = current_user.avatar_url - gon.first_day_of_week = current_user.first_day_of_week if current_user.first_day_of_week end end diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 26d64e908b7..9e7cc8900c8 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -1413,9 +1413,6 @@ msgstr "" msgid "Choose file..." msgstr "" -msgid "Choose on what day the week should start." -msgstr "" - msgid "Choose the top-level group for your repository imports." msgstr "" @@ -6956,15 +6953,15 @@ msgstr "" msgid "Switch branch/tag" msgstr "" -msgid "System Default (%{default})" -msgstr "" - msgid "System Hooks" msgstr "" msgid "System Info" msgstr "" +msgid "System default (%{default})" +msgstr "" + msgid "System metrics (Custom)" msgstr "" -- cgit v1.2.1