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
Kazuhiko Shiozaki
gitlab-ce
Commits
103a1bb0
Commit
103a1bb0
authored
Jan 23, 2015
by
Marin Jankovski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use service settings instead of config file settings to present issues.
parent
737f6516
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
14 deletions
+24
-14
app/helpers/issues_helper.rb
app/helpers/issues_helper.rb
+3
-8
app/models/project.rb
app/models/project.rb
+12
-0
app/models/project_services/issue_tracker_service.rb
app/models/project_services/issue_tracker_service.rb
+4
-0
app/models/project_services/redmine_service.rb
app/models/project_services/redmine_service.rb
+2
-2
lib/gitlab/markdown.rb
lib/gitlab/markdown.rb
+3
-4
No files found.
app/helpers/issues_helper.rb
View file @
103a1bb0
...
@@ -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
.
used_default_issues_tracker?
||
!
external_issues_tracker_enabled?
if
project
.
used_default_issues_tracker?
||
!
project
.
external_issues_tracker_enabled?
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
.
used_default_issues_tracker?
||
!
external_issues_tracker_enabled?
if
project
.
used_default_issues_tracker?
||
!
project
.
external_issues_tracker_enabled?
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
.
used_default_issues_tracker?
||
!
external_issues_tracker_enabled?
if
project
.
used_default_issues_tracker?
||
!
project
.
external_issues_tracker_enabled?
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'
]
...
@@ -77,11 +77,6 @@ module IssuesHelper
...
@@ -77,11 +77,6 @@ module IssuesHelper
ts
.
html_safe
ts
.
html_safe
end
end
# Checks if issues_tracker setting exists in gitlab.yml
def
external_issues_tracker_enabled?
Gitlab
.
config
.
issues_tracker
&&
Gitlab
.
config
.
issues_tracker
.
values
.
any?
end
def
bulk_update_milestone_options
def
bulk_update_milestone_options
options_for_select
([
'None (backlog)'
])
+
options_for_select
([
'None (backlog)'
])
+
options_from_collection_for_select
(
project_active_milestones
,
'id'
,
options_from_collection_for_select
(
project_active_milestones
,
'id'
,
...
...
app/models/project.rb
View file @
103a1bb0
...
@@ -309,6 +309,18 @@ class Project < ActiveRecord::Base
...
@@ -309,6 +309,18 @@ class Project < ActiveRecord::Base
self
.
issues_tracker
==
Project
.
issues_tracker
.
default_value
self
.
issues_tracker
==
Project
.
issues_tracker
.
default_value
end
end
def
external_issues_tracker_enabled?
external_issues_trackers
.
any?
end
def
external_issues_trackers
services
.
select
{
|
service
|
service
.
category
==
:issue_tracker
}
end
def
external_issue_tracker
@external_issues_tracker
||=
external_issues_trackers
.
select
(
&
:activated?
).
first
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
.
used_default_issues_tracker?
end
end
...
...
app/models/project_services/issue_tracker_service.rb
View file @
103a1bb0
class
IssueTrackerService
<
Service
class
IssueTrackerService
<
Service
def
category
:issue_tracker
end
def
project_url
def
project_url
# implement inside child
# implement inside child
end
end
...
...
app/models/project_services/redmine_service.rb
View file @
103a1bb0
...
@@ -48,9 +48,9 @@ class RedmineService < IssueTrackerService
...
@@ -48,9 +48,9 @@ class RedmineService < IssueTrackerService
end
end
def
set_project_url
def
set_project_url
id
=
self
.
project
.
issue_tracker_id
id
=
self
.
project
.
issue
s
_tracker_id
if
id
if
id
issues_tracker
[
'project_url'
].
gsub
(
":issue_tracker_id"
,
id
)
issues_tracker
[
'project_url'
].
gsub
(
":issue
s
_tracker_id"
,
id
)
else
else
issues_tracker
[
'project_url'
]
issues_tracker
[
'project_url'
]
end
end
...
...
lib/gitlab/markdown.rb
View file @
103a1bb0
...
@@ -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
.
used_default_issues_tracker?
||
!
external_issues_tracker_enabled?
if
project
.
used_default_issues_tracker?
||
!
project
.
external_issues_tracker_enabled?
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
)
...
@@ -220,8 +220,7 @@ module Gitlab
...
@@ -220,8 +220,7 @@ module Gitlab
link_to
(
"
#{
prefix_text
}
#
#{
identifier
}
"
,
url
,
options
)
link_to
(
"
#{
prefix_text
}
#
#{
identifier
}
"
,
url
,
options
)
end
end
else
else
config
=
Gitlab
.
config
external_issue_tracker
=
project
.
external_issue_tracker
external_issue_tracker
=
config
.
issues_tracker
[
project
.
issues_tracker
]
if
external_issue_tracker
.
present?
if
external_issue_tracker
.
present?
reference_external_issue
(
identifier
,
external_issue_tracker
,
project
,
reference_external_issue
(
identifier
,
external_issue_tracker
,
project
,
prefix_text
)
prefix_text
)
...
@@ -270,7 +269,7 @@ module Gitlab
...
@@ -270,7 +269,7 @@ module Gitlab
def
reference_external_issue
(
identifier
,
issue_tracker
,
project
=
@project
,
def
reference_external_issue
(
identifier
,
issue_tracker
,
project
=
@project
,
prefix_text
=
nil
)
prefix_text
=
nil
)
url
=
url_for_issue
(
identifier
,
project
)
url
=
url_for_issue
(
identifier
,
project
)
title
=
issue_tracker
[
'title'
]
title
=
issue_tracker
.
title
options
=
html_options
.
merge
(
options
=
html_options
.
merge
(
title:
"Issue in
#{
title
}
"
,
title:
"Issue in
#{
title
}
"
,
...
...
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