Commit dcbc6810 authored by Fabian Schneider's avatar Fabian Schneider Committed by Toon Claes

Rename setting, fix wordings

parent 218a1029
......@@ -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,
......
......@@ -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
......
......@@ -241,7 +241,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'],
......@@ -251,6 +250,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,
......
......@@ -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.')
......
......@@ -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'
# frozen_string_literal: true
class AddDefaultFirstDayOfWeekToApplicationSettings < ActiveRecord::Migration
class AddFirstDayOfWeekToApplicationSettings < 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)
add_column_with_default(:application_settings, :first_day_of_week, :integer, default: 0)
end
def down
remove_column(:application_settings, :default_first_day_of_week)
remove_column(:application_settings, :first_day_of_week)
end
end
......@@ -215,6 +215,7 @@ ActiveRecord::Schema.define(version: 20190204115450) do
t.boolean "protected_ci_variables", default: false, null: false
t.string "runners_registration_token_encrypted"
t.integer "local_markdown_version", default: 0, null: false
t.integer "first_day_of_week", default: 0, null: false
t.index ["custom_project_templates_group_id"], name: "index_application_settings_on_custom_project_templates_group_id", using: :btree
t.index ["file_template_project_id"], name: "index_application_settings_on_file_template_project_id", using: :btree
t.index ["usage_stats_set_by_user_id"], name: "index_application_settings_on_usage_stats_set_by_user_id", using: :btree
......@@ -3009,6 +3010,7 @@ ActiveRecord::Schema.define(version: 20190204115450) do
t.string "issues_sort"
t.string "merge_requests_sort"
t.string "roadmaps_sort"
t.integer "first_day_of_week"
t.index ["user_id"], name: "index_user_preferences_on_user_id", unique: true, using: :btree
end
......
......@@ -93,9 +93,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.
......@@ -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
......
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