Commit b6d0f2852d1f2518ca8987667beb7df2b8223611

Authored by Andrew8xx8
1 parent ab98db73

Issues link from project page follows on remote bug tracker if it selected now

app/helpers/issues_helper.rb
@@ -41,6 +41,18 @@ module IssuesHelper @@ -41,6 +41,18 @@ module IssuesHelper
41 @project.milestones.active.order("id desc").all 41 @project.milestones.active.order("id desc").all
42 end 42 end
43 43
  44 + def url_for_project_issues
  45 + return "" if @project.nil?
  46 +
  47 + if @project.used_default_issues_tracker?
  48 + project_issues_filter_path(@project)
  49 + else
  50 + url = Settings[:issues_tracker][@project.issues_tracker]["project_url"]
  51 + url.gsub(':project_id', @project.id.to_s)
  52 + .gsub(':issues_tracker_id', @project.issues_tracker_id.to_s)
  53 + end
  54 + end
  55 +
44 def url_for_issue(issue_id) 56 def url_for_issue(issue_id)
45 return "" if @project.nil? 57 return "" if @project.nil?
46 58
app/views/layouts/project_resource.html.haml
@@ -22,11 +22,12 @@ @@ -22,11 +22,12 @@
22 = nav_link(controller: %w(graph)) do 22 = nav_link(controller: %w(graph)) do
23 = link_to "Network", project_graph_path(@project, @ref || @repository.root_ref) 23 = link_to "Network", project_graph_path(@project, @ref || @repository.root_ref)
24 24
25 - - if @project.issues_enabled 25 + - if @project.issues_enabled
26 = nav_link(controller: %w(issues milestones labels)) do 26 = nav_link(controller: %w(issues milestones labels)) do
27 - = link_to project_issues_filter_path(@project) do 27 + = link_to url_for_project_issues do
28 Issues 28 Issues
29 - %span.count.issue_counter= @project.issues.opened.count 29 + - if @project.used_default_issues_tracker?
  30 + %span.count.issue_counter= @project.issues.opened.count
30 31
31 - if @project.repo_exists? && @project.merge_requests_enabled 32 - if @project.repo_exists? && @project.merge_requests_enabled
32 = nav_link(controller: :merge_requests) do 33 = nav_link(controller: :merge_requests) do
config/gitlab.yml.example
@@ -41,6 +41,11 @@ production: &base @@ -41,6 +41,11 @@ production: &base
41 ## External issues trackers 41 ## External issues trackers
42 issues_tracker: 42 issues_tracker:
43 redmine: 43 redmine:
  44 + ## If not nil, link 'Issues' on project page will be replaced tp this
  45 + ## Use placeholders:
  46 + ## :project_id - Gitlab project identifier
  47 + ## :issues_tracker_id - Project Name or Id in external issue tracker
  48 + project_url: "http://redmine.sample/projects/:issues_tracker_id"
44 ## If not nil, links from /#\d/ entities from commit messages will replaced to this 49 ## If not nil, links from /#\d/ entities from commit messages will replaced to this
45 ## Use placeholders: 50 ## Use placeholders:
46 ## :project_id - Gitlab project identifier 51 ## :project_id - Gitlab project identifier
@@ -146,6 +151,7 @@ test: @@ -146,6 +151,7 @@ test:
146 <<: *base 151 <<: *base
147 issues_tracker: 152 issues_tracker:
148 redmine: 153 redmine:
  154 + project_url: "http://redmine/projects/:issues_tracker_id"
149 issues_url: "http://redmine/:project_id/:issues_tracker_id/:id" 155 issues_url: "http://redmine/:project_id/:issues_tracker_id/:id"
150 156
151 staging: 157 staging: