Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
5bc07b2a
Commit
5bc07b2a
authored
Sep 22, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5116 from karlhungus/feature-configurable-theme
Make users theme configurable
parents
0d23ea29
fcba0d55
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
10 deletions
+22
-10
app/models/user.rb
app/models/user.rb
+1
-1
config/gitlab.yml.example
config/gitlab.yml.example
+8
-0
config/initializers/1_settings.rb
config/initializers/1_settings.rb
+1
-0
spec/models/user_spec.rb
spec/models/user_spec.rb
+12
-9
No files found.
app/models/user.rb
View file @
5bc07b2a
...
...
@@ -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
...
...
config/gitlab.yml.example
View file @
5bc07b2a
...
...
@@ -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.
...
...
config/initializers/1_settings.rb
View file @
5bc07b2a
...
...
@@ -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
...
...
spec/models/user_spec.rb
View file @
5bc07b2a
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment