Commit 864ce6b8 authored by Fabian Schneider's avatar Fabian Schneider

Rename setting, fix wordings

parent 8fabc92e
...@@ -136,7 +136,6 @@ module ApplicationSettingsHelper ...@@ -136,7 +136,6 @@ module ApplicationSettingsHelper
:container_registry_token_expire_delay, :container_registry_token_expire_delay,
:default_artifacts_expire_in, :default_artifacts_expire_in,
:default_branch_protection, :default_branch_protection,
:default_first_day_of_week,
:default_group_visibility, :default_group_visibility,
:default_project_visibility, :default_project_visibility,
:default_projects_limit, :default_projects_limit,
...@@ -151,6 +150,7 @@ module ApplicationSettingsHelper ...@@ -151,6 +150,7 @@ module ApplicationSettingsHelper
:email_author_in_body, :email_author_in_body,
:enabled_git_access_protocol, :enabled_git_access_protocol,
:enforce_terms, :enforce_terms,
:first_day_of_week,
:gitaly_timeout_default, :gitaly_timeout_default,
:gitaly_timeout_medium, :gitaly_timeout_medium,
:gitaly_timeout_fast, :gitaly_timeout_fast,
......
...@@ -51,11 +51,11 @@ module PreferencesHelper ...@@ -51,11 +51,11 @@ module PreferencesHelper
end end
def default_first_day_of_week 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 end
def first_day_of_week_choices_with_default 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 end
def user_application_theme def user_application_theme
......
...@@ -237,7 +237,6 @@ class ApplicationSetting < ActiveRecord::Base ...@@ -237,7 +237,6 @@ class ApplicationSetting < ActiveRecord::Base
container_registry_token_expire_delay: 5, container_registry_token_expire_delay: 5,
default_artifacts_expire_in: '30 days', default_artifacts_expire_in: '30 days',
default_branch_protection: Settings.gitlab['default_branch_protection'], 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_group_visibility: Settings.gitlab.default_projects_features['visibility_level'],
default_project_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'], default_projects_limit: Settings.gitlab['default_projects_limit'],
...@@ -247,6 +246,7 @@ class ApplicationSetting < ActiveRecord::Base ...@@ -247,6 +246,7 @@ class ApplicationSetting < ActiveRecord::Base
dsa_key_restriction: 0, dsa_key_restriction: 0,
ecdsa_key_restriction: 0, ecdsa_key_restriction: 0,
ed25519_key_restriction: 0, ed25519_key_restriction: 0,
first_day_of_week: 0,
gitaly_timeout_default: 55, gitaly_timeout_default: 55,
gitaly_timeout_fast: 10, gitaly_timeout_fast: 10,
gitaly_timeout_medium: 30, gitaly_timeout_medium: 30,
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
%fieldset %fieldset
.form-group .form-group
= f.label :default_first_day_of_week, _('Default first day of the week'), class: 'label-bold' = f.label :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.select :first_day_of_week, first_day_of_week_choices, {}, class: 'form-control'
.form-text.text-muted .form-text.text-muted
= _('Default first day of the week in calendars and date pickers.') = _('Default first day of the week in calendars and date pickers.')
......
...@@ -76,7 +76,5 @@ ...@@ -76,7 +76,5 @@
= f.label :first_day_of_week, class: 'label-bold' do = f.label :first_day_of_week, class: 'label-bold' do
= _('First day of the week') = _('First day of the week')
= f.select :first_day_of_week, first_day_of_week_choices_with_default, {}, class: 'form-control' = 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 .form-group
= f.submit _('Save changes'), class: 'btn btn-success' = f.submit _('Save changes'), class: 'btn btn-success'
# frozen_string_literal: true # frozen_string_literal: true
class AddDefaultFirstDayOfWeekToApplicationSettings < ActiveRecord::Migration class AddFirstDayOfWeekToApplicationSettings < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers include Gitlab::Database::MigrationHelpers
disable_ddl_transaction! disable_ddl_transaction!
DOWNTIME = false DOWNTIME = false
def up def up
add_column_with_default(:application_settings, :default_first_day_of_week, :integer, default: 0) add_column_with_default(:application_settings, :first_day_of_week, :integer, default: 0)
end end
def down def down
remove_column(:application_settings, :default_first_day_of_week) remove_column(:application_settings, :first_day_of_week)
end end
end end
...@@ -168,7 +168,7 @@ ActiveRecord::Schema.define(version: 20190131122559) do ...@@ -168,7 +168,7 @@ ActiveRecord::Schema.define(version: 20190131122559) do
t.string "commit_email_hostname" t.string "commit_email_hostname"
t.boolean "protected_ci_variables", default: false, null: false t.boolean "protected_ci_variables", default: false, null: false
t.string "runners_registration_token_encrypted" 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 t.index ["usage_stats_set_by_user_id"], name: "index_application_settings_on_usage_stats_set_by_user_id", using: :btree
end end
......
...@@ -90,9 +90,7 @@ You can choose between 3 options: ...@@ -90,9 +90,7 @@ You can choose between 3 options:
## Localization ## Localization
This following setting allows you to customize calendar layouts.
### First day of the week ### 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. 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.
...@@ -24,14 +24,13 @@ module Gitlab ...@@ -24,14 +24,13 @@ module Gitlab
gon.emoji_sprites_css_path = ActionController::Base.helpers.stylesheet_path('emoji_sprites') gon.emoji_sprites_css_path = ActionController::Base.helpers.stylesheet_path('emoji_sprites')
gon.test_env = Rails.env.test? gon.test_env = Rails.env.test?
gon.suggested_label_colors = LabelsHelper.suggested_colors 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 if current_user
gon.current_user_id = current_user.id gon.current_user_id = current_user.id
gon.current_username = current_user.username gon.current_username = current_user.username
gon.current_user_fullname = current_user.name gon.current_user_fullname = current_user.name
gon.current_user_avatar_url = current_user.avatar_url 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
end end
......
...@@ -1413,9 +1413,6 @@ msgstr "" ...@@ -1413,9 +1413,6 @@ msgstr ""
msgid "Choose file..." msgid "Choose file..."
msgstr "" msgstr ""
msgid "Choose on what day the week should start."
msgstr ""
msgid "Choose the top-level group for your repository imports." msgid "Choose the top-level group for your repository imports."
msgstr "" msgstr ""
...@@ -6956,15 +6953,15 @@ msgstr "" ...@@ -6956,15 +6953,15 @@ msgstr ""
msgid "Switch branch/tag" msgid "Switch branch/tag"
msgstr "" msgstr ""
msgid "System Default (%{default})"
msgstr ""
msgid "System Hooks" msgid "System Hooks"
msgstr "" msgstr ""
msgid "System Info" msgid "System Info"
msgstr "" msgstr ""
msgid "System default (%{default})"
msgstr ""
msgid "System metrics (Custom)" msgid "System metrics (Custom)"
msgstr "" msgstr ""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment