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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
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
Hide 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
def
url_for_project_issues
(
project
=
@project
)
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
)
else
url
=
Gitlab
.
config
.
issues_tracker
[
project
.
issues_tracker
][
'project_url'
]
...
...
@@ -28,7 +28,7 @@ module IssuesHelper
def
url_for_new_issue
(
project
=
@project
)
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
else
issues_tracker
=
Gitlab
.
config
.
issues_tracker
[
project
.
issues_tracker
]
...
...
@@ -41,7 +41,7 @@ module IssuesHelper
def
url_for_issue
(
issue_iid
,
project
=
@project
)
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
else
url
=
Gitlab
.
config
.
issues_tracker
[
project
.
issues_tracker
][
'issues_url'
]
...
...
@@ -54,7 +54,7 @@ module IssuesHelper
def
title_for_issue
(
issue_iid
,
project
=
@project
)
return
''
if
project
.
nil?
if
project
.
used_
default_issues_tracker?
if
project
.
default_issues_tracker?
issue
=
project
.
issues
.
where
(
iid:
issue_iid
).
first
return
issue
.
title
if
issue
end
...
...
app/models/project.rb
View file @
7c701acf
...
...
@@ -298,14 +298,14 @@ class Project < ActiveRecord::Base
end
def
issue_exists?
(
issue_id
)
if
used_
default_issues_tracker?
if
default_issues_tracker?
self
.
issues
.
where
(
iid:
issue_id
).
first
.
present?
else
true
end
end
def
used_
default_issues_tracker?
def
default_issues_tracker?
self
.
issues_tracker
==
Project
.
issues_tracker
.
default_value
end
...
...
@@ -321,8 +321,12 @@ class Project < ActiveRecord::Base
@external_issues_tracker
||=
external_issues_trackers
.
select
(
&
:activated?
).
first
end
def
using_issue_tracker?
default_issues_tracker?
||
!
external_issues_tracker_enabled?
end
def
can_have_issues_tracker_id?
self
.
issues_enabled
&&
!
self
.
used_
default_issues_tracker?
self
.
issues_enabled
&&
!
self
.
default_issues_tracker?
end
def
build_missing_services
...
...
app/views/layouts/nav/_project.html.haml
View file @
7c701acf
...
...
@@ -39,7 +39,7 @@
%i
.fa.fa-exclamation-circle
%span
Issues
-
if
@project
.
used_
default_issues_tracker?
-
if
@project
.
default_issues_tracker?
%span
.count.issue_counter
=
@project
.
issues
.
opened
.
count
-
if
project_nav_tab?
:merge_requests
...
...
lib/gitlab/markdown.rb
View file @
7c701acf
...
...
@@ -208,7 +208,7 @@ module Gitlab
end
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
url
=
url_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
end
end
describe
:
used_
default_issues_tracker?
do
describe
:default_issues_tracker?
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:ext_project
)
{
create
(
:redmine_project
)
}
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
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
...
...
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