Commit 65f5d062e9665b10ef8c1be07156be285c759faa
1 parent
c147b571
Exists in
master
and in
4 other branches
Use proper titles for issues trackers
Showing
4 changed files
with
27 additions
and
1 deletions
Show diff stats
app/helpers/projects_helper.rb
@@ -80,6 +80,18 @@ module ProjectsHelper | @@ -80,6 +80,18 @@ module ProjectsHelper | ||
80 | @project.milestones.active.order("id desc").all | 80 | @project.milestones.active.order("id desc").all |
81 | end | 81 | end |
82 | 82 | ||
83 | + def project_issues_trackers | ||
84 | + values = Project.issues_tracker.values.map do |tracker_key| | ||
85 | + if tracker_key.to_sym == :gitlab | ||
86 | + ['GitLab', tracker_key] | ||
87 | + else | ||
88 | + [Gitlab.config.issues_tracker[tracker_key]['title'] || tracker_key, tracker_key] | ||
89 | + end | ||
90 | + end | ||
91 | + | ||
92 | + options_for_select(values) | ||
93 | + end | ||
94 | + | ||
83 | private | 95 | private |
84 | 96 | ||
85 | def get_project_nav_tabs(project, current_user) | 97 | def get_project_nav_tabs(project, current_user) |
app/views/projects/edit.html.haml
@@ -67,7 +67,7 @@ | @@ -67,7 +67,7 @@ | ||
67 | - if Project.issues_tracker.values.count > 1 | 67 | - if Project.issues_tracker.values.count > 1 |
68 | .control-group | 68 | .control-group |
69 | = f.label :issues_tracker, "Issues tracker", class: 'control-label' | 69 | = f.label :issues_tracker, "Issues tracker", class: 'control-label' |
70 | - .controls= f.select(:issues_tracker, Project.issues_tracker.values, {}, { disabled: !@project.issues_enabled }) | 70 | + .controls= f.select(:issues_tracker, project_issues_trackers, {}, { disabled: !@project.issues_enabled }) |
71 | 71 | ||
72 | .control-group | 72 | .control-group |
73 | = f.label :issues_tracker_id, "Project name or id in issues tracker", class: 'control-label' | 73 | = f.label :issues_tracker_id, "Project name or id in issues tracker", class: 'control-label' |
config/gitlab.yml.example
@@ -73,6 +73,7 @@ production: &base | @@ -73,6 +73,7 @@ production: &base | ||
73 | ## External issues trackers | 73 | ## External issues trackers |
74 | issues_tracker: | 74 | issues_tracker: |
75 | # redmine: | 75 | # redmine: |
76 | + # title: "Redmine" | ||
76 | # ## If not nil, link 'Issues' on project page will be replaced with this | 77 | # ## If not nil, link 'Issues' on project page will be replaced with this |
77 | # ## Use placeholders: | 78 | # ## Use placeholders: |
78 | # ## :project_id - GitLab project identifier | 79 | # ## :project_id - GitLab project identifier |
@@ -93,6 +94,7 @@ production: &base | @@ -93,6 +94,7 @@ production: &base | ||
93 | # new_issue_url: "http://redmine.sample/projects/:issues_tracker_id/issues/new" | 94 | # new_issue_url: "http://redmine.sample/projects/:issues_tracker_id/issues/new" |
94 | # | 95 | # |
95 | # jira: | 96 | # jira: |
97 | + # title: "Atlassian Jira" | ||
96 | # project_url: "http://jira.sample/issues/?jql=project=:issues_tracker_id" | 98 | # project_url: "http://jira.sample/issues/?jql=project=:issues_tracker_id" |
97 | # issues_url: "http://jira.sample/browse/:id" | 99 | # issues_url: "http://jira.sample/browse/:id" |
98 | # new_issue_url: "http://jira.sample/secure/CreateIssue.jspa" | 100 | # new_issue_url: "http://jira.sample/secure/CreateIssue.jspa" |
@@ -206,6 +208,7 @@ test: | @@ -206,6 +208,7 @@ test: | ||
206 | <<: *base | 208 | <<: *base |
207 | issues_tracker: | 209 | issues_tracker: |
208 | redmine: | 210 | redmine: |
211 | + title: "Redmine" | ||
209 | project_url: "http://redmine/projects/:issues_tracker_id" | 212 | project_url: "http://redmine/projects/:issues_tracker_id" |
210 | issues_url: "http://redmine/:project_id/:issues_tracker_id/:id" | 213 | issues_url: "http://redmine/:project_id/:issues_tracker_id/:id" |
211 | new_issue_url: "http://redmine/projects/:issues_tracker_id/issues/new" | 214 | new_issue_url: "http://redmine/projects/:issues_tracker_id/issues/new" |
@@ -0,0 +1,11 @@ | @@ -0,0 +1,11 @@ | ||
1 | +require 'spec_helper' | ||
2 | + | ||
3 | +describe ProjectsHelper do | ||
4 | + describe '#project_issues_trackers' do | ||
5 | + it "returns the correct issues trackers available" do | ||
6 | + project_issues_trackers.should == | ||
7 | + "<option value=\"redmine\">Redmine</option>\n" \ | ||
8 | + "<option value=\"gitlab\">GitLab</option>" | ||
9 | + end | ||
10 | + end | ||
11 | +end |