Commit 5bc07b2a authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge pull request #5116 from karlhungus/feature-configurable-theme

Make users theme configurable
parents 0d23ea29 fcba0d55
......@@ -211,7 +211,7 @@ class User < ActiveRecord::Base
{
projects_limit: Gitlab.config.gitlab.default_projects_limit,
can_create_group: Gitlab.config.gitlab.default_can_create_group,
theme_id: Gitlab::Theme::MARS
theme_id: Gitlab.config.gitlab.default_theme
}
end
end
......
......@@ -42,6 +42,14 @@ production: &base
default_projects_limit: 10
# default_can_create_group: false # default: true
# username_changing_enabled: false # default: true - User can change her username/namespace
## Default theme
## BASIC = 1
## MARS = 2
## MODERN = 3
## GRAY = 4
## COLOR = 5
# default_theme: 2 # default: 2
## Users management
# signup_enabled: true # default: false - Account passwords are not sent via the email if signup is enabled.
......
......@@ -52,6 +52,7 @@ Settings['issues_tracker'] ||= {}
Settings['gitlab'] ||= Settingslogic.new({})
Settings.gitlab['default_projects_limit'] ||= 10
Settings.gitlab['default_can_create_group'] = true if Settings.gitlab['default_can_create_group'].nil?
Settings.gitlab['default_theme'] = Gitlab::Theme::MARS if Settings.gitlab['default_theme'].nil?
Settings.gitlab['host'] ||= 'localhost'
Settings.gitlab['https'] = false if Settings.gitlab['https'].nil?
Settings.gitlab['port'] ||= Settings.gitlab.https ? 443 : 80
......
......@@ -221,9 +221,9 @@ describe User do
let(:user) { User.build_user({}, as: :admin) }
it "should apply defaults to user" do
user.projects_limit.should == 42
user.can_create_group.should be_false
user.theme_id.should == Gitlab::Theme::MARS
user.projects_limit.should == Gitlab.config.gitlab.default_projects_limit
user.can_create_group.should == Gitlab.config.gitlab.default_can_create_group
user.theme_id.should == Gitlab.config.gitlab.default_theme
end
end
......@@ -231,6 +231,9 @@ describe User do
let(:user) { User.build_user({projects_limit: 123, can_create_group: true, can_create_team: true, theme_id: Gitlab::Theme::BASIC}, as: :admin) }
it "should apply defaults to user" do
Gitlab.config.gitlab.default_projects_limit.should_not == 123
Gitlab.config.gitlab.default_can_create_group.should_not be_true
Gitlab.config.gitlab.default_theme.should_not == Gitlab::Theme::MARS
user.projects_limit.should == 123
user.can_create_group.should be_true
user.theme_id.should == Gitlab::Theme::BASIC
......@@ -243,9 +246,9 @@ describe User do
let(:user) { User.build_user }
it "should apply defaults to user" do
user.projects_limit.should == 42
user.can_create_group.should be_false
user.theme_id.should == Gitlab::Theme::MARS
user.projects_limit.should == Gitlab.config.gitlab.default_projects_limit
user.can_create_group.should == Gitlab.config.gitlab.default_can_create_group
user.theme_id.should == Gitlab.config.gitlab.default_theme
end
end
......@@ -253,9 +256,9 @@ describe User do
let(:user) { User.build_user(projects_limit: 123, can_create_group: true, theme_id: Gitlab::Theme::BASIC) }
it "should apply defaults to user" do
user.projects_limit.should == 42
user.can_create_group.should be_false
user.theme_id.should == Gitlab::Theme::MARS
user.projects_limit.should == Gitlab.config.gitlab.default_projects_limit
user.can_create_group.should == Gitlab.config.gitlab.default_can_create_group
user.theme_id.should == Gitlab.config.gitlab.default_theme
end
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