diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-09-22 02:20:26 -0700 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-09-22 02:20:26 -0700 |
commit | 5bc07b2ad82492e8438f07363337bb5e80a22dfb (patch) | |
tree | a4465d59939f1b2268a98f945e046cbe52bec5d2 | |
parent | 0d23ea294db936c7c9e4879cda75907b749eee54 (diff) | |
parent | fcba0d55f483248022ca6c85faf33c5b4202dd9a (diff) | |
download | gitlab-ce-5bc07b2ad82492e8438f07363337bb5e80a22dfb.tar.gz |
Merge pull request #5116 from karlhungus/feature-configurable-theme
Make users theme configurable
-rw-r--r-- | app/models/user.rb | 2 | ||||
-rw-r--r-- | config/gitlab.yml.example | 8 | ||||
-rw-r--r-- | config/initializers/1_settings.rb | 1 | ||||
-rw-r--r-- | spec/models/user_spec.rb | 21 |
4 files changed, 22 insertions, 10 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index c1026a44f87..ea004e4c9a7 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -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 diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example index 0434601cb49..c1cc9f872f3 100644 --- a/config/gitlab.yml.example +++ b/config/gitlab.yml.example @@ -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. diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb index da7a83a62a4..1c8758d9420 100644 --- a/config/initializers/1_settings.rb +++ b/config/initializers/1_settings.rb @@ -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 diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 79915daa463..2b42226ecaf 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -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 |