##// END OF EJS Templates
Reversed order of priorities on the issue summary page (#11205)....
Jean-Philippe Lang -
r9696:7ed2c481d898
parent child
Show More
@@ -1,95 +1,95
1 # Redmine - project management software
1 # Redmine - project management software
2 # Copyright (C) 2006-2012 Jean-Philippe Lang
2 # Copyright (C) 2006-2012 Jean-Philippe Lang
3 #
3 #
4 # This program is free software; you can redistribute it and/or
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
7 # of the License, or (at your option) any later version.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU General Public License
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
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.
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
17
18 class ReportsController < ApplicationController
18 class ReportsController < ApplicationController
19 menu_item :issues
19 menu_item :issues
20 before_filter :find_project, :authorize, :find_issue_statuses
20 before_filter :find_project, :authorize, :find_issue_statuses
21
21
22 def issue_report
22 def issue_report
23 @trackers = @project.trackers
23 @trackers = @project.trackers
24 @versions = @project.shared_versions.sort
24 @versions = @project.shared_versions.sort
25 @priorities = IssuePriority.all
25 @priorities = IssuePriority.all.reverse
26 @categories = @project.issue_categories
26 @categories = @project.issue_categories
27 @assignees = (Setting.issue_group_assignment? ? @project.principals : @project.users).sort
27 @assignees = (Setting.issue_group_assignment? ? @project.principals : @project.users).sort
28 @authors = @project.users.sort
28 @authors = @project.users.sort
29 @subprojects = @project.descendants.visible
29 @subprojects = @project.descendants.visible
30
30
31 @issues_by_tracker = Issue.by_tracker(@project)
31 @issues_by_tracker = Issue.by_tracker(@project)
32 @issues_by_version = Issue.by_version(@project)
32 @issues_by_version = Issue.by_version(@project)
33 @issues_by_priority = Issue.by_priority(@project)
33 @issues_by_priority = Issue.by_priority(@project)
34 @issues_by_category = Issue.by_category(@project)
34 @issues_by_category = Issue.by_category(@project)
35 @issues_by_assigned_to = Issue.by_assigned_to(@project)
35 @issues_by_assigned_to = Issue.by_assigned_to(@project)
36 @issues_by_author = Issue.by_author(@project)
36 @issues_by_author = Issue.by_author(@project)
37 @issues_by_subproject = Issue.by_subproject(@project) || []
37 @issues_by_subproject = Issue.by_subproject(@project) || []
38
38
39 render :template => "reports/issue_report"
39 render :template => "reports/issue_report"
40 end
40 end
41
41
42 def issue_report_details
42 def issue_report_details
43 case params[:detail]
43 case params[:detail]
44 when "tracker"
44 when "tracker"
45 @field = "tracker_id"
45 @field = "tracker_id"
46 @rows = @project.trackers
46 @rows = @project.trackers
47 @data = Issue.by_tracker(@project)
47 @data = Issue.by_tracker(@project)
48 @report_title = l(:field_tracker)
48 @report_title = l(:field_tracker)
49 when "version"
49 when "version"
50 @field = "fixed_version_id"
50 @field = "fixed_version_id"
51 @rows = @project.shared_versions.sort
51 @rows = @project.shared_versions.sort
52 @data = Issue.by_version(@project)
52 @data = Issue.by_version(@project)
53 @report_title = l(:field_version)
53 @report_title = l(:field_version)
54 when "priority"
54 when "priority"
55 @field = "priority_id"
55 @field = "priority_id"
56 @rows = IssuePriority.all
56 @rows = IssuePriority.all.reverse
57 @data = Issue.by_priority(@project)
57 @data = Issue.by_priority(@project)
58 @report_title = l(:field_priority)
58 @report_title = l(:field_priority)
59 when "category"
59 when "category"
60 @field = "category_id"
60 @field = "category_id"
61 @rows = @project.issue_categories
61 @rows = @project.issue_categories
62 @data = Issue.by_category(@project)
62 @data = Issue.by_category(@project)
63 @report_title = l(:field_category)
63 @report_title = l(:field_category)
64 when "assigned_to"
64 when "assigned_to"
65 @field = "assigned_to_id"
65 @field = "assigned_to_id"
66 @rows = (Setting.issue_group_assignment? ? @project.principals : @project.users).sort
66 @rows = (Setting.issue_group_assignment? ? @project.principals : @project.users).sort
67 @data = Issue.by_assigned_to(@project)
67 @data = Issue.by_assigned_to(@project)
68 @report_title = l(:field_assigned_to)
68 @report_title = l(:field_assigned_to)
69 when "author"
69 when "author"
70 @field = "author_id"
70 @field = "author_id"
71 @rows = @project.users.sort
71 @rows = @project.users.sort
72 @data = Issue.by_author(@project)
72 @data = Issue.by_author(@project)
73 @report_title = l(:field_author)
73 @report_title = l(:field_author)
74 when "subproject"
74 when "subproject"
75 @field = "project_id"
75 @field = "project_id"
76 @rows = @project.descendants.visible
76 @rows = @project.descendants.visible
77 @data = Issue.by_subproject(@project) || []
77 @data = Issue.by_subproject(@project) || []
78 @report_title = l(:field_subproject)
78 @report_title = l(:field_subproject)
79 end
79 end
80
80
81 respond_to do |format|
81 respond_to do |format|
82 if @field
82 if @field
83 format.html {}
83 format.html {}
84 else
84 else
85 format.html { redirect_to :action => 'issue_report', :id => @project }
85 format.html { redirect_to :action => 'issue_report', :id => @project }
86 end
86 end
87 end
87 end
88 end
88 end
89
89
90 private
90 private
91
91
92 def find_issue_statuses
92 def find_issue_statuses
93 @statuses = IssueStatus.find(:all, :order => 'position')
93 @statuses = IssueStatus.find(:all, :order => 'position')
94 end
94 end
95 end
95 end
@@ -1,64 +1,71
1 # Redmine - project management software
1 # Redmine - project management software
2 # Copyright (C) 2006-2012 Jean-Philippe Lang
2 # Copyright (C) 2006-2012 Jean-Philippe Lang
3 #
3 #
4 # This program is free software; you can redistribute it and/or
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
7 # of the License, or (at your option) any later version.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU General Public License
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
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.
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
17
18 require File.expand_path('../../test_helper', __FILE__)
18 require File.expand_path('../../test_helper', __FILE__)
19
19
20 class ReportsControllerTest < ActionController::TestCase
20 class ReportsControllerTest < ActionController::TestCase
21 fixtures :projects, :trackers, :issue_statuses, :issues,
21 fixtures :projects, :trackers, :issue_statuses, :issues,
22 :enumerations, :users, :issue_categories,
22 :enumerations, :users, :issue_categories,
23 :projects_trackers,
23 :projects_trackers,
24 :roles,
24 :roles,
25 :member_roles,
25 :member_roles,
26 :members,
26 :members,
27 :enabled_modules,
27 :enabled_modules,
28 :workflows,
28 :workflows,
29 :versions
29 :versions
30
30
31 def setup
31 def setup
32 end
32 end
33
33
34 def test_get_issue_report
34 def test_get_issue_report
35 get :issue_report, :id => 1
35 get :issue_report, :id => 1
36
36
37 assert_response :success
37 assert_response :success
38 assert_template 'issue_report'
38 assert_template 'issue_report'
39
39
40 [:issues_by_tracker, :issues_by_version, :issues_by_category, :issues_by_assigned_to,
40 [:issues_by_tracker, :issues_by_version, :issues_by_category, :issues_by_assigned_to,
41 :issues_by_author, :issues_by_subproject].each do |ivar|
41 :issues_by_author, :issues_by_subproject, :issues_by_priority].each do |ivar|
42 assert_not_nil assigns(ivar)
42 assert_not_nil assigns(ivar)
43 end
43 end
44
45 assert_equal IssuePriority.all.reverse, assigns(:priorities)
44 end
46 end
45
47
46 def test_get_issue_report_details
48 def test_get_issue_report_details
47 %w(tracker version priority category assigned_to author subproject).each do |detail|
49 %w(tracker version priority category assigned_to author subproject).each do |detail|
48 get :issue_report_details, :id => 1, :detail => detail
50 get :issue_report_details, :id => 1, :detail => detail
49
51
50 assert_response :success
52 assert_response :success
51 assert_template 'issue_report_details'
53 assert_template 'issue_report_details'
52 assert_not_nil assigns(:field)
54 assert_not_nil assigns(:field)
53 assert_not_nil assigns(:rows)
55 assert_not_nil assigns(:rows)
54 assert_not_nil assigns(:data)
56 assert_not_nil assigns(:data)
55 assert_not_nil assigns(:report_title)
57 assert_not_nil assigns(:report_title)
56 end
58 end
57 end
59 end
58
60
61 def test_get_issue_report_details_by_priority
62 get :issue_report_details, :id => 1, :detail => 'priority'
63 assert_equal IssuePriority.all.reverse, assigns(:rows)
64 end
65
59 def test_get_issue_report_details_with_an_invalid_detail
66 def test_get_issue_report_details_with_an_invalid_detail
60 get :issue_report_details, :id => 1, :detail => 'invalid'
67 get :issue_report_details, :id => 1, :detail => 'invalid'
61
68
62 assert_redirected_to '/projects/ecookbook/issues/report'
69 assert_redirected_to '/projects/ecookbook/issues/report'
63 end
70 end
64 end
71 end
General Comments 0
You need to be logged in to leave comments. Login now