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 41 @project.milestones.active.order("id desc").all
42 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 56 def url_for_issue(issue_id)
45 57 return "" if @project.nil?
46 58  
... ...
app/views/layouts/project_resource.html.haml
... ... @@ -22,11 +22,12 @@
22 22 = nav_link(controller: %w(graph)) do
23 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 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 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 32 - if @project.repo_exists? && @project.merge_requests_enabled
32 33 = nav_link(controller: :merge_requests) do
... ...
config/gitlab.yml.example
... ... @@ -41,6 +41,11 @@ production: &base
41 41 ## External issues trackers
42 42 issues_tracker:
43 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 49 ## If not nil, links from /#\d/ entities from commit messages will replaced to this
45 50 ## Use placeholders:
46 51 ## :project_id - Gitlab project identifier
... ... @@ -146,6 +151,7 @@ test:
146 151 <<: *base
147 152 issues_tracker:
148 153 redmine:
  154 + project_url: "http://redmine/projects/:issues_tracker_id"
149 155 issues_url: "http://redmine/:project_id/:issues_tracker_id/:id"
150 156  
151 157 staging:
... ...