@@ -0,0 +1,53 | |||||
|
1 | # Redmine - project management software | |||
|
2 | # Copyright (C) 2006-2014 Jean-Philippe Lang | |||
|
3 | # | |||
|
4 | # This program is free software; you can redistribute it and/or | |||
|
5 | # modify it under the terms of the GNU General Public License | |||
|
6 | # as published by the Free Software Foundation; either version 2 | |||
|
7 | # of the License, or (at your option) any later version. | |||
|
8 | # | |||
|
9 | # This program is distributed in the hope that it will be useful, | |||
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
|
12 | # GNU General Public License for more details. | |||
|
13 | # | |||
|
14 | # You should have received a copy of the GNU General Public License | |||
|
15 | # along with this program; if not, write to the Free Software | |||
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||
|
17 | ||||
|
18 | require File.expand_path('../../../test_helper', __FILE__) | |||
|
19 | ||||
|
20 | class VersionsHelperTest < ActionView::TestCase | |||
|
21 | ||||
|
22 | fixtures :projects, :versions | |||
|
23 | ||||
|
24 | def test_version_filtered_issues_path_sharing_none | |||
|
25 | version = Version.new(:name => 'test', :sharing => 'none') | |||
|
26 | version.project = Project.find(5) | |||
|
27 | assert_match '/projects/private-child/issues?', version_filtered_issues_path(version) | |||
|
28 | end | |||
|
29 | ||||
|
30 | def test_version_filtered_issues_path_sharing_descendants | |||
|
31 | version = Version.new(:name => 'test', :sharing => 'descendants') | |||
|
32 | version.project = Project.find(5) | |||
|
33 | assert_match '/projects/private-child/issues?', version_filtered_issues_path(version) | |||
|
34 | end | |||
|
35 | ||||
|
36 | def test_version_filtered_issues_path_sharing_hierarchy | |||
|
37 | version = Version.new(:name => 'test', :sharing => 'hierarchy') | |||
|
38 | version.project = Project.find(5) | |||
|
39 | assert_match '/projects/ecookbook/issues?', version_filtered_issues_path(version) | |||
|
40 | end | |||
|
41 | ||||
|
42 | def test_version_filtered_issues_path_sharing_tree | |||
|
43 | version = Version.new(:name => 'test', :sharing => 'tree') | |||
|
44 | version.project = Project.find(5) | |||
|
45 | assert_match '/projects/ecookbook/issues?', version_filtered_issues_path(version) | |||
|
46 | end | |||
|
47 | ||||
|
48 | def test_version_filtered_issues_path_sharing_system | |||
|
49 | version = Version.new(:name => 'test', :sharing => 'system') | |||
|
50 | version.project = Project.find(5) | |||
|
51 | assert_match /^\/issues\?/, version_filtered_issues_path(version) | |||
|
52 | end | |||
|
53 | end |
@@ -27,6 +27,28 module VersionsHelper | |||||
27 | end |
|
27 | end | |
28 | end |
|
28 | end | |
29 |
|
29 | |||
|
30 | def version_filtered_issues_path(version, options = {}) | |||
|
31 | options = {:fixed_version_id => version, :set_filter => 1}.merge(options) | |||
|
32 | project = case version.sharing | |||
|
33 | when 'hierarchy', 'tree' | |||
|
34 | if version.project && version.project.root.visible? | |||
|
35 | version.project.root | |||
|
36 | else | |||
|
37 | version.project | |||
|
38 | end | |||
|
39 | when 'system' | |||
|
40 | nil | |||
|
41 | else | |||
|
42 | version.project | |||
|
43 | end | |||
|
44 | ||||
|
45 | if project | |||
|
46 | project_issues_path(project, options) | |||
|
47 | else | |||
|
48 | issues_path(options) | |||
|
49 | end | |||
|
50 | end | |||
|
51 | ||||
30 | STATUS_BY_CRITERIAS = %w(tracker status priority author assigned_to category) |
|
52 | STATUS_BY_CRITERIAS = %w(tracker status priority author assigned_to category) | |
31 |
|
53 | |||
32 | def render_issue_status_by(version, criteria) |
|
54 | def render_issue_status_by(version, criteria) |
@@ -20,19 +20,15 | |||||
20 | :width => '40em', :legend => ('%0.0f%' % version.completed_percent)) %> |
|
20 | :width => '40em', :legend => ('%0.0f%' % version.completed_percent)) %> | |
21 | <p class="progress-info"> |
|
21 | <p class="progress-info"> | |
22 |
<%= link_to(l(:label_x_issues, :count => version.issues_count), |
|
22 | <%= link_to(l(:label_x_issues, :count => version.issues_count), | |
23 |
|
|
23 | version_filtered_issues_path(version, :status_id => '*')) %> | |
24 | :status_id => '*', :fixed_version_id => version, |
|
|||
25 | :set_filter => 1)) %> |
|
|||
26 |
|
|
24 | | |
27 |
|
|
25 | (<%= link_to_if(version.closed_issues_count > 0, | |
28 |
|
|
26 | l(:label_x_closed_issues_abbr, :count => version.closed_issues_count), | |
29 |
|
|
27 | version_filtered_issues_path(version, :status_id => 'c')) %> | |
30 | :fixed_version_id => version, :set_filter => 1)) %> |
|
|||
31 |
|
|
28 | — | |
32 |
|
|
29 | <%= link_to_if(version.open_issues_count > 0, | |
33 |
|
|
30 | l(:label_x_open_issues_abbr, :count => version.open_issues_count), | |
34 |
|
|
31 | version_filtered_issues_path(version, :status_id => 'o')) %>) | |
35 | :fixed_version_id => version, :set_filter => 1)) %>) |
|
|||
36 | </p> |
|
32 | </p> | |
37 | <% else %> |
|
33 | <% else %> | |
38 | <p class="progress-info"><%= l(:label_roadmap_no_issues) %></p> |
|
34 | <p class="progress-info"><%= l(:label_roadmap_no_issues) %></p> |
General Comments 0
You need to be logged in to leave comments.
Login now