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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
0afdf39d
Commit
0afdf39d
authored
Feb 11, 2013
by
Andrew8xx8
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New field added
parent
62de22c1
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
37 additions
and
6 deletions
+37
-6
app/models/project.rb
app/models/project.rb
+6
-1
app/views/admin/projects/_form.html.haml
app/views/admin/projects/_form.html.haml
+4
-0
app/views/projects/_form.html.haml
app/views/projects/_form.html.haml
+4
-0
config/gitlab.yml.example
config/gitlab.yml.example
+1
-5
spec/factories.rb
spec/factories.rb
+1
-0
spec/models/project_spec.rb
spec/models/project_spec.rb
+21
-0
No files found.
app/models/project.rb
View file @
0afdf39d
...
@@ -28,7 +28,7 @@ class Project < ActiveRecord::Base
...
@@ -28,7 +28,7 @@ class Project < ActiveRecord::Base
class
TransferError
<
StandardError
;
end
class
TransferError
<
StandardError
;
end
attr_accessible
:name
,
:path
,
:description
,
:default_branch
,
:issues_tracker
,
attr_accessible
:name
,
:path
,
:description
,
:default_branch
,
:issues_tracker
,
:issues_enabled
,
:wall_enabled
,
:merge_requests_enabled
,
:issues_enabled
,
:wall_enabled
,
:merge_requests_enabled
,
:issues_tracker_id
,
:wiki_enabled
,
:public
,
:import_url
,
as:
[
:default
,
:admin
]
:wiki_enabled
,
:public
,
:import_url
,
as:
[
:default
,
:admin
]
attr_accessible
:namespace_id
,
:creator_id
,
as: :admin
attr_accessible
:namespace_id
,
:creator_id
,
as: :admin
...
@@ -74,6 +74,7 @@ class Project < ActiveRecord::Base
...
@@ -74,6 +74,7 @@ class Project < ActiveRecord::Base
message:
"only letters, digits & '_' '-' '.' allowed. Letter should be first"
}
message:
"only letters, digits & '_' '-' '.' allowed. Letter should be first"
}
validates
:issues_enabled
,
:wall_enabled
,
:merge_requests_enabled
,
validates
:issues_enabled
,
:wall_enabled
,
:merge_requests_enabled
,
:wiki_enabled
,
inclusion:
{
in:
[
true
,
false
]
}
:wiki_enabled
,
inclusion:
{
in:
[
true
,
false
]
}
validates
:issues_tracker_id
,
length:
{
within:
0
..
255
}
validates_uniqueness_of
:name
,
scope: :namespace_id
validates_uniqueness_of
:name
,
scope: :namespace_id
validates_uniqueness_of
:path
,
scope: :namespace_id
validates_uniqueness_of
:path
,
scope: :namespace_id
...
@@ -217,6 +218,10 @@ class Project < ActiveRecord::Base
...
@@ -217,6 +218,10 @@ class Project < ActiveRecord::Base
self
.
issues_tracker
==
Project
.
issues_tracker
.
default_value
self
.
issues_tracker
==
Project
.
issues_tracker
.
default_value
end
end
def
can_have_issues_tracker_id?
self
.
issues_enabled
&&
!
self
.
used_default_issues_tracker?
end
def
services
def
services
[
gitlab_ci_service
].
compact
[
gitlab_ci_service
].
compact
end
end
...
...
app/views/admin/projects/_form.html.haml
View file @
0afdf39d
...
@@ -35,6 +35,10 @@
...
@@ -35,6 +35,10 @@
=
f
.
label
:issues_tracker
,
"Issues tracker"
,
class:
'control-label'
=
f
.
label
:issues_tracker
,
"Issues tracker"
,
class:
'control-label'
.input
=
f
.
select
(
:issues_tracker
,
Project
.
issues_tracker
.
values
,
{},
{
disabled:
!
@project
.
issues_enabled
})
.input
=
f
.
select
(
:issues_tracker
,
Project
.
issues_tracker
.
values
,
{},
{
disabled:
!
@project
.
issues_enabled
})
.clearfix
=
f
.
label
:issues_tracker_id
,
"Project name or id in issues tracker"
,
class:
'control-label'
.input
=
f
.
text_field
:issues_tracker_id
,
class:
"xxlarge"
,
disabled:
!
@project
.
can_have_issues_tracker_id?
.clearfix
.clearfix
=
f
.
label
:merge_requests_enabled
,
"Merge Requests"
=
f
.
label
:merge_requests_enabled
,
"Merge Requests"
.input
=
f
.
check_box
:merge_requests_enabled
.input
=
f
.
check_box
:merge_requests_enabled
...
...
app/views/projects/_form.html.haml
View file @
0afdf39d
...
@@ -28,6 +28,10 @@
...
@@ -28,6 +28,10 @@
=
f
.
label
:issues_tracker
,
"Issues tracker"
,
class:
'control-label'
=
f
.
label
:issues_tracker
,
"Issues tracker"
,
class:
'control-label'
.input
=
f
.
select
(
:issues_tracker
,
Project
.
issues_tracker
.
values
,
{},
{
disabled:
!
@project
.
issues_enabled
})
.input
=
f
.
select
(
:issues_tracker
,
Project
.
issues_tracker
.
values
,
{},
{
disabled:
!
@project
.
issues_enabled
})
.clearfix
=
f
.
label
:issues_tracker_id
,
"Project name or id in issues tracker"
,
class:
'control-label'
.input
=
f
.
text_field
:issues_tracker_id
,
class:
"xxlarge"
,
disabled:
!
@project
.
can_have_issues_tracker_id?
.control-group
.control-group
=
f
.
label
:merge_requests_enabled
,
"Merge Requests"
,
class:
'control-label'
=
f
.
label
:merge_requests_enabled
,
"Merge Requests"
,
class:
'control-label'
.controls
.controls
...
...
config/gitlab.yml.example
View file @
0afdf39d
...
@@ -7,8 +7,6 @@
...
@@ -7,8 +7,6 @@
# 2. Replace gitlab -> host with your domain
# 2. Replace gitlab -> host with your domain
# 3. Replace gitlab -> email_from
# 3. Replace gitlab -> email_from
<<<<<<< HEAD
<<<<<<< HEAD
production: &base
production: &base
#
#
# 1. GitLab app settings
# 1. GitLab app settings
...
@@ -43,9 +41,7 @@ production: &base
...
@@ -43,9 +41,7 @@ production: &base
## External issues trackers
## External issues trackers
issues_tracker:
issues_tracker:
redmine:
redmine:
## If not nil Issues link in project page will be replaced to this
## If not nil, links from /#\d/ entities from commit messages will replaced to this
url: "http://redmine.sample"
## If not nil links from /#\d/ entities from commit messages will replaced to this
## Use placeholders:
## Use placeholders:
## :project_id - Gitlab project identifier
## :project_id - Gitlab project identifier
## :issues_tracker_id - Project Name or Id in external issue tracker
## :issues_tracker_id - Project Name or Id in external issue tracker
...
...
spec/factories.rb
View file @
0afdf39d
...
@@ -31,6 +31,7 @@ FactoryGirl.define do
...
@@ -31,6 +31,7 @@ FactoryGirl.define do
factory
:redmine_project
,
parent: :project
do
factory
:redmine_project
,
parent: :project
do
issues_tracker
{
"redmine"
}
issues_tracker
{
"redmine"
}
issues_tracker_id
{
"project_name_in_redmine"
}
end
end
factory
:group
do
factory
:group
do
...
...
spec/models/project_spec.rb
View file @
0afdf39d
...
@@ -60,6 +60,7 @@ describe Project do
...
@@ -60,6 +60,7 @@ describe Project do
it
{
should
ensure_inclusion_of
(
:wall_enabled
).
in_array
([
true
,
false
])
}
it
{
should
ensure_inclusion_of
(
:wall_enabled
).
in_array
([
true
,
false
])
}
it
{
should
ensure_inclusion_of
(
:merge_requests_enabled
).
in_array
([
true
,
false
])
}
it
{
should
ensure_inclusion_of
(
:merge_requests_enabled
).
in_array
([
true
,
false
])
}
it
{
should
ensure_inclusion_of
(
:wiki_enabled
).
in_array
([
true
,
false
])
}
it
{
should
ensure_inclusion_of
(
:wiki_enabled
).
in_array
([
true
,
false
])
}
it
{
should
ensure_length_of
(
:issues_tracker_id
).
is_within
(
0
..
255
)
}
it
"should not allow new projects beyond user limits"
do
it
"should not allow new projects beyond user limits"
do
project
.
stub
(
:creator
).
and_return
(
double
(
can_create_project?:
false
,
projects_limit:
1
))
project
.
stub
(
:creator
).
and_return
(
double
(
can_create_project?:
false
,
projects_limit:
1
))
...
@@ -223,4 +224,24 @@ describe Project do
...
@@ -223,4 +224,24 @@ describe Project do
end
end
end
end
describe
:can_have_issues_tracker_id?
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:ext_project
)
{
create
(
:redmine_project
)
}
it
"should be true for projects with external issues tracker if issues enabled"
do
ext_project
.
can_have_issues_tracker_id?
.
should
be_true
end
it
"should be false for projects with internal issue tracker if issues enabled"
do
project
.
can_have_issues_tracker_id?
.
should
be_false
end
it
"should be always false if issues disbled"
do
project
.
issues_enabled
=
false
ext_project
.
issues_enabled
=
false
project
.
can_have_issues_tracker_id?
.
should
be_false
ext_project
.
can_have_issues_tracker_id?
.
should
be_false
end
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