Rename setting, fix wordings

This commit is contained in:
Fabian Schneider 2019-01-10 22:06:42 +01:00
parent 8fabc92e8b
commit 864ce6b87a
11 changed files with 28 additions and 36 deletions

View file

@ -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,

View file

@ -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

View file

@ -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,

View file

@ -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.')

View file

@ -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'

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -90,8 +90,6 @@ 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.

View file

@ -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

View file

@ -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 ""