Commit 51e6095d authored by Izaak Alpert's avatar Izaak Alpert

Make users theme configurable

GITLAB-1262

Change-Id: I690cb8ea294df53ebe8405a519c23c501af2c21a

Conflicts:
	app/models/user.rb
	config/initializers/1_settings.rb
	spec/models/user_spec.rb
parent 5367e42b
...@@ -211,7 +211,7 @@ class User < ActiveRecord::Base ...@@ -211,7 +211,7 @@ class User < ActiveRecord::Base
{ {
projects_limit: Gitlab.config.gitlab.default_projects_limit, projects_limit: Gitlab.config.gitlab.default_projects_limit,
can_create_group: Gitlab.config.gitlab.default_can_create_group, can_create_group: Gitlab.config.gitlab.default_can_create_group,
theme_id: Gitlab::Theme::MARS theme_id: Gitlab.config.gitlab.default_theme
} }
end end
end end
......
...@@ -42,6 +42,14 @@ production: &base ...@@ -42,6 +42,14 @@ production: &base
default_projects_limit: 10 default_projects_limit: 10
# default_can_create_group: false # default: true # default_can_create_group: false # default: true
# username_changing_enabled: false # default: true - User can change her username/namespace # 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: 1 # default: 1
## Users management ## Users management
# signup_enabled: true # default: false - Account passwords are not sent via the email if signup is enabled. # signup_enabled: true # default: false - Account passwords are not sent via the email if signup is enabled.
......
...@@ -52,6 +52,7 @@ Settings['issues_tracker'] ||= {} ...@@ -52,6 +52,7 @@ Settings['issues_tracker'] ||= {}
Settings['gitlab'] ||= Settingslogic.new({}) Settings['gitlab'] ||= Settingslogic.new({})
Settings.gitlab['default_projects_limit'] ||= 10 Settings.gitlab['default_projects_limit'] ||= 10
Settings.gitlab['default_can_create_group'] = true if Settings.gitlab['default_can_create_group'].nil? Settings.gitlab['default_can_create_group'] = true if Settings.gitlab['default_can_create_group'].nil?
Settings.gitlab['default_theme'] = Gitlab::Theme::BASIC if Settings.gitlab['default_theme'].nil?
Settings.gitlab['host'] ||= 'localhost' Settings.gitlab['host'] ||= 'localhost'
Settings.gitlab['https'] = false if Settings.gitlab['https'].nil? Settings.gitlab['https'] = false if Settings.gitlab['https'].nil?
Settings.gitlab['port'] ||= Settings.gitlab.https ? 443 : 80 Settings.gitlab['port'] ||= Settings.gitlab.https ? 443 : 80
......
...@@ -221,9 +221,9 @@ describe User do ...@@ -221,9 +221,9 @@ describe User do
let(:user) { User.build_user({}, as: :admin) } let(:user) { User.build_user({}, as: :admin) }
it "should apply defaults to user" do it "should apply defaults to user" do
user.projects_limit.should == 42 user.projects_limit.should == Gitlab.config.gitlab.default_projects_limit
user.can_create_group.should be_false user.can_create_group.should == Gitlab.config.gitlab.default_can_create_group
user.theme_id.should == Gitlab::Theme::MARS user.theme_id.should == Gitlab.config.gitlab.default_theme
end end
end end
...@@ -231,6 +231,9 @@ describe User do ...@@ -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) } 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 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.projects_limit.should == 123
user.can_create_group.should be_true user.can_create_group.should be_true
user.theme_id.should == Gitlab::Theme::BASIC user.theme_id.should == Gitlab::Theme::BASIC
...@@ -243,9 +246,9 @@ describe User do ...@@ -243,9 +246,9 @@ describe User do
let(:user) { User.build_user } let(:user) { User.build_user }
it "should apply defaults to user" do it "should apply defaults to user" do
user.projects_limit.should == 42 user.projects_limit.should == Gitlab.config.gitlab.default_projects_limit
user.can_create_group.should be_false user.can_create_group.should == Gitlab.config.gitlab.default_can_create_group
user.theme_id.should == Gitlab::Theme::MARS user.theme_id.should == Gitlab.config.gitlab.default_theme
end end
end end
...@@ -253,9 +256,9 @@ describe User do ...@@ -253,9 +256,9 @@ describe User do
let(:user) { User.build_user(projects_limit: 123, can_create_group: true, theme_id: Gitlab::Theme::BASIC) } let(:user) { User.build_user(projects_limit: 123, can_create_group: true, theme_id: Gitlab::Theme::BASIC) }
it "should apply defaults to user" do it "should apply defaults to user" do
user.projects_limit.should == 42 user.projects_limit.should == Gitlab.config.gitlab.default_projects_limit
user.can_create_group.should be_false user.can_create_group.should == Gitlab.config.gitlab.default_can_create_group
user.theme_id.should == Gitlab::Theme::MARS user.theme_id.should == Gitlab.config.gitlab.default_theme
end end
end 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