Commit 51e6095dd16a02c67966cea5de51a2c2ec81d9d6
1 parent
5367e42b
Exists in
master
and in
4 other branches
Make users theme configurable
GITLAB-1262 Change-Id: I690cb8ea294df53ebe8405a519c23c501af2c21a Conflicts: app/models/user.rb config/initializers/1_settings.rb spec/models/user_spec.rb
Showing
4 changed files
with
22 additions
and
10 deletions
Show diff stats
app/models/user.rb
... | ... | @@ -211,7 +211,7 @@ class User < ActiveRecord::Base |
211 | 211 | { |
212 | 212 | projects_limit: Gitlab.config.gitlab.default_projects_limit, |
213 | 213 | can_create_group: Gitlab.config.gitlab.default_can_create_group, |
214 | - theme_id: Gitlab::Theme::MARS | |
214 | + theme_id: Gitlab.config.gitlab.default_theme | |
215 | 215 | } |
216 | 216 | end |
217 | 217 | end | ... | ... |
config/gitlab.yml.example
... | ... | @@ -42,6 +42,14 @@ production: &base |
42 | 42 | default_projects_limit: 10 |
43 | 43 | # default_can_create_group: false # default: true |
44 | 44 | # username_changing_enabled: false # default: true - User can change her username/namespace |
45 | + ## Default theme | |
46 | + ## BASIC = 1 | |
47 | + ## MARS = 2 | |
48 | + ## MODERN = 3 | |
49 | + ## GRAY = 4 | |
50 | + ## COLOR = 5 | |
51 | + # default_theme: 1 # default: 1 | |
52 | + | |
45 | 53 | |
46 | 54 | ## Users management |
47 | 55 | # signup_enabled: true # default: false - Account passwords are not sent via the email if signup is enabled. | ... | ... |
config/initializers/1_settings.rb
... | ... | @@ -52,6 +52,7 @@ Settings['issues_tracker'] ||= {} |
52 | 52 | Settings['gitlab'] ||= Settingslogic.new({}) |
53 | 53 | Settings.gitlab['default_projects_limit'] ||= 10 |
54 | 54 | Settings.gitlab['default_can_create_group'] = true if Settings.gitlab['default_can_create_group'].nil? |
55 | +Settings.gitlab['default_theme'] = Gitlab::Theme::BASIC if Settings.gitlab['default_theme'].nil? | |
55 | 56 | Settings.gitlab['host'] ||= 'localhost' |
56 | 57 | Settings.gitlab['https'] = false if Settings.gitlab['https'].nil? |
57 | 58 | Settings.gitlab['port'] ||= Settings.gitlab.https ? 443 : 80 | ... | ... |
spec/models/user_spec.rb
... | ... | @@ -221,9 +221,9 @@ describe User do |
221 | 221 | let(:user) { User.build_user({}, as: :admin) } |
222 | 222 | |
223 | 223 | it "should apply defaults to user" do |
224 | - user.projects_limit.should == 42 | |
225 | - user.can_create_group.should be_false | |
226 | - user.theme_id.should == Gitlab::Theme::MARS | |
224 | + user.projects_limit.should == Gitlab.config.gitlab.default_projects_limit | |
225 | + user.can_create_group.should == Gitlab.config.gitlab.default_can_create_group | |
226 | + user.theme_id.should == Gitlab.config.gitlab.default_theme | |
227 | 227 | end |
228 | 228 | end |
229 | 229 | |
... | ... | @@ -231,6 +231,9 @@ describe User do |
231 | 231 | let(:user) { User.build_user({projects_limit: 123, can_create_group: true, can_create_team: true, theme_id: Gitlab::Theme::BASIC}, as: :admin) } |
232 | 232 | |
233 | 233 | it "should apply defaults to user" do |
234 | + Gitlab.config.gitlab.default_projects_limit.should_not == 123 | |
235 | + Gitlab.config.gitlab.default_can_create_group.should_not be_true | |
236 | + Gitlab.config.gitlab.default_theme.should_not == Gitlab::Theme::MARS | |
234 | 237 | user.projects_limit.should == 123 |
235 | 238 | user.can_create_group.should be_true |
236 | 239 | user.theme_id.should == Gitlab::Theme::BASIC |
... | ... | @@ -243,9 +246,9 @@ describe User do |
243 | 246 | let(:user) { User.build_user } |
244 | 247 | |
245 | 248 | it "should apply defaults to user" do |
246 | - user.projects_limit.should == 42 | |
247 | - user.can_create_group.should be_false | |
248 | - user.theme_id.should == Gitlab::Theme::MARS | |
249 | + user.projects_limit.should == Gitlab.config.gitlab.default_projects_limit | |
250 | + user.can_create_group.should == Gitlab.config.gitlab.default_can_create_group | |
251 | + user.theme_id.should == Gitlab.config.gitlab.default_theme | |
249 | 252 | end |
250 | 253 | end |
251 | 254 | |
... | ... | @@ -253,9 +256,9 @@ describe User do |
253 | 256 | let(:user) { User.build_user(projects_limit: 123, can_create_group: true, theme_id: Gitlab::Theme::BASIC) } |
254 | 257 | |
255 | 258 | it "should apply defaults to user" do |
256 | - user.projects_limit.should == 42 | |
257 | - user.can_create_group.should be_false | |
258 | - user.theme_id.should == Gitlab::Theme::MARS | |
259 | + user.projects_limit.should == Gitlab.config.gitlab.default_projects_limit | |
260 | + user.can_create_group.should == Gitlab.config.gitlab.default_can_create_group | |
261 | + user.theme_id.should == Gitlab.config.gitlab.default_theme | |
259 | 262 | end |
260 | 263 | end |
261 | 264 | end | ... | ... |