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
Tatuya Kamada
gitlab-ce
Commits
7c701acf
Commit
7c701acf
authored
Jan 23, 2015
by
Marin Jankovski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do a check which issue tracker is used inside the project.
parent
103a1bb0
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
12 deletions
+16
-12
app/helpers/issues_helper.rb
app/helpers/issues_helper.rb
+4
-4
app/models/project.rb
app/models/project.rb
+7
-3
app/views/layouts/nav/_project.html.haml
app/views/layouts/nav/_project.html.haml
+1
-1
lib/gitlab/markdown.rb
lib/gitlab/markdown.rb
+1
-1
spec/models/project_spec.rb
spec/models/project_spec.rb
+3
-3
No files found.
app/helpers/issues_helper.rb
View file @
7c701acf
...
@@ -16,7 +16,7 @@ module IssuesHelper
...
@@ -16,7 +16,7 @@ module IssuesHelper
def
url_for_project_issues
(
project
=
@project
)
def
url_for_project_issues
(
project
=
@project
)
return
''
if
project
.
nil?
return
''
if
project
.
nil?
if
project
.
us
ed_default_issues_tracker?
||
!
project
.
external_issues_tracker_enabled
?
if
project
.
us
ing_issue_tracker
?
project_issues_path
(
project
)
project_issues_path
(
project
)
else
else
url
=
Gitlab
.
config
.
issues_tracker
[
project
.
issues_tracker
][
'project_url'
]
url
=
Gitlab
.
config
.
issues_tracker
[
project
.
issues_tracker
][
'project_url'
]
...
@@ -28,7 +28,7 @@ module IssuesHelper
...
@@ -28,7 +28,7 @@ module IssuesHelper
def
url_for_new_issue
(
project
=
@project
)
def
url_for_new_issue
(
project
=
@project
)
return
''
if
project
.
nil?
return
''
if
project
.
nil?
if
project
.
us
ed_default_issues_tracker?
||
!
project
.
external_issues_tracker_enabled
?
if
project
.
us
ing_issue_tracker
?
url
=
new_project_issue_path
project_id:
project
url
=
new_project_issue_path
project_id:
project
else
else
issues_tracker
=
Gitlab
.
config
.
issues_tracker
[
project
.
issues_tracker
]
issues_tracker
=
Gitlab
.
config
.
issues_tracker
[
project
.
issues_tracker
]
...
@@ -41,7 +41,7 @@ module IssuesHelper
...
@@ -41,7 +41,7 @@ module IssuesHelper
def
url_for_issue
(
issue_iid
,
project
=
@project
)
def
url_for_issue
(
issue_iid
,
project
=
@project
)
return
''
if
project
.
nil?
return
''
if
project
.
nil?
if
project
.
us
ed_default_issues_tracker?
||
!
project
.
external_issues_tracker_enabled
?
if
project
.
us
ing_issue_tracker
?
url
=
project_issue_url
project_id:
project
,
id:
issue_iid
url
=
project_issue_url
project_id:
project
,
id:
issue_iid
else
else
url
=
Gitlab
.
config
.
issues_tracker
[
project
.
issues_tracker
][
'issues_url'
]
url
=
Gitlab
.
config
.
issues_tracker
[
project
.
issues_tracker
][
'issues_url'
]
...
@@ -54,7 +54,7 @@ module IssuesHelper
...
@@ -54,7 +54,7 @@ module IssuesHelper
def
title_for_issue
(
issue_iid
,
project
=
@project
)
def
title_for_issue
(
issue_iid
,
project
=
@project
)
return
''
if
project
.
nil?
return
''
if
project
.
nil?
if
project
.
used_
default_issues_tracker?
if
project
.
default_issues_tracker?
issue
=
project
.
issues
.
where
(
iid:
issue_iid
).
first
issue
=
project
.
issues
.
where
(
iid:
issue_iid
).
first
return
issue
.
title
if
issue
return
issue
.
title
if
issue
end
end
...
...
app/models/project.rb
View file @
7c701acf
...
@@ -298,14 +298,14 @@ class Project < ActiveRecord::Base
...
@@ -298,14 +298,14 @@ class Project < ActiveRecord::Base
end
end
def
issue_exists?
(
issue_id
)
def
issue_exists?
(
issue_id
)
if
used_
default_issues_tracker?
if
default_issues_tracker?
self
.
issues
.
where
(
iid:
issue_id
).
first
.
present?
self
.
issues
.
where
(
iid:
issue_id
).
first
.
present?
else
else
true
true
end
end
end
end
def
used_
default_issues_tracker?
def
default_issues_tracker?
self
.
issues_tracker
==
Project
.
issues_tracker
.
default_value
self
.
issues_tracker
==
Project
.
issues_tracker
.
default_value
end
end
...
@@ -321,8 +321,12 @@ class Project < ActiveRecord::Base
...
@@ -321,8 +321,12 @@ class Project < ActiveRecord::Base
@external_issues_tracker
||=
external_issues_trackers
.
select
(
&
:activated?
).
first
@external_issues_tracker
||=
external_issues_trackers
.
select
(
&
:activated?
).
first
end
end
def
using_issue_tracker?
default_issues_tracker?
||
!
external_issues_tracker_enabled?
end
def
can_have_issues_tracker_id?
def
can_have_issues_tracker_id?
self
.
issues_enabled
&&
!
self
.
used_
default_issues_tracker?
self
.
issues_enabled
&&
!
self
.
default_issues_tracker?
end
end
def
build_missing_services
def
build_missing_services
...
...
app/views/layouts/nav/_project.html.haml
View file @
7c701acf
...
@@ -39,7 +39,7 @@
...
@@ -39,7 +39,7 @@
%i
.fa.fa-exclamation-circle
%i
.fa.fa-exclamation-circle
%span
%span
Issues
Issues
-
if
@project
.
used_
default_issues_tracker?
-
if
@project
.
default_issues_tracker?
%span
.count.issue_counter
=
@project
.
issues
.
opened
.
count
%span
.count.issue_counter
=
@project
.
issues
.
opened
.
count
-
if
project_nav_tab?
:merge_requests
-
if
project_nav_tab?
:merge_requests
...
...
lib/gitlab/markdown.rb
View file @
7c701acf
...
@@ -208,7 +208,7 @@ module Gitlab
...
@@ -208,7 +208,7 @@ module Gitlab
end
end
def
reference_issue
(
identifier
,
project
=
@project
,
prefix_text
=
nil
)
def
reference_issue
(
identifier
,
project
=
@project
,
prefix_text
=
nil
)
if
project
.
us
ed_default_issues_tracker?
||
!
project
.
external_issues_tracker_enabled
?
if
project
.
us
ing_issue_tracker
?
if
project
.
issue_exists?
identifier
if
project
.
issue_exists?
identifier
url
=
url_for_issue
(
identifier
,
project
)
url
=
url_for_issue
(
identifier
,
project
)
title
=
title_for_issue
(
identifier
,
project
)
title
=
title_for_issue
(
identifier
,
project
)
...
...
spec/models/project_spec.rb
View file @
7c701acf
...
@@ -195,16 +195,16 @@ describe Project do
...
@@ -195,16 +195,16 @@ describe Project do
end
end
end
end
describe
:
used_
default_issues_tracker?
do
describe
:default_issues_tracker?
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:ext_project
)
{
create
(
:redmine_project
)
}
let
(
:ext_project
)
{
create
(
:redmine_project
)
}
it
"should be true if used internal tracker"
do
it
"should be true if used internal tracker"
do
project
.
used_
default_issues_tracker?
.
should
be_true
project
.
default_issues_tracker?
.
should
be_true
end
end
it
"should be false if used other tracker"
do
it
"should be false if used other tracker"
do
ext_project
.
used_
default_issues_tracker?
.
should
be_false
ext_project
.
default_issues_tracker?
.
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