##// END OF EJS Templates
Extracted the rendering from each case statement in issue_reports_details...
Eric Davis -
r3287:f50feca73061
parent child
Show More
@@ -1,123 +1,121
1 1 # redMine - project management software
2 2 # Copyright (C) 2006 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 class ReportsController < ApplicationController
19 19 menu_item :issues
20 20 before_filter :find_project, :authorize
21 21
22 22 def issue_report
23 23 @statuses = IssueStatus.find(:all, :order => 'position')
24 24
25 25 @trackers = @project.trackers
26 26 @versions = @project.shared_versions.sort
27 27 @priorities = IssuePriority.all
28 28 @categories = @project.issue_categories
29 29 @assignees = @project.members.collect { |m| m.user }.sort
30 30 @authors = @project.members.collect { |m| m.user }.sort
31 31 @subprojects = @project.descendants.active
32 32 issues_by_tracker
33 33 issues_by_version
34 34 issues_by_priority
35 35 issues_by_category
36 36 issues_by_assigned_to
37 37 issues_by_author
38 38 issues_by_subproject
39 39
40 40 render :template => "reports/issue_report"
41 41 end
42 42
43 43 def issue_report_details
44 44 @statuses = IssueStatus.find(:all, :order => 'position')
45 45
46 46 case params[:detail]
47 47 when "tracker"
48 48 @field = "tracker_id"
49 49 @rows = @project.trackers
50 50 @data = issues_by_tracker
51 51 @report_title = l(:field_tracker)
52 render :template => "reports/issue_report_details"
53 52 when "version"
54 53 @field = "fixed_version_id"
55 54 @rows = @project.shared_versions.sort
56 55 @data = issues_by_version
57 56 @report_title = l(:field_version)
58 render :template => "reports/issue_report_details"
59 57 when "priority"
60 58 @field = "priority_id"
61 59 @rows = IssuePriority.all
62 60 @data = issues_by_priority
63 61 @report_title = l(:field_priority)
64 render :template => "reports/issue_report_details"
65 62 when "category"
66 63 @field = "category_id"
67 64 @rows = @project.issue_categories
68 65 @data = issues_by_category
69 66 @report_title = l(:field_category)
70 render :template => "reports/issue_report_details"
71 67 when "assigned_to"
72 68 @field = "assigned_to_id"
73 69 @rows = @project.members.collect { |m| m.user }.sort
74 70 @data = issues_by_assigned_to
75 71 @report_title = l(:field_assigned_to)
76 render :template => "reports/issue_report_details"
77 72 when "author"
78 73 @field = "author_id"
79 74 @rows = @project.members.collect { |m| m.user }.sort
80 75 @data = issues_by_author
81 76 @report_title = l(:field_author)
82 render :template => "reports/issue_report_details"
83 77 when "subproject"
84 78 @field = "project_id"
85 79 @rows = @project.descendants.active
86 80 @data = issues_by_subproject
87 81 @report_title = l(:field_subproject)
88 render :template => "reports/issue_report_details"
89 else
90 redirect_to :action => 'issue_report', :id => @project
91 82 end
92 83
84 respond_to do |format|
85 if @field
86 format.html {}
87 else
88 format.html { redirect_to :action => 'issue_report', :id => @project }
89 end
90 end
93 91 end
94 92 private
95 93 def issues_by_tracker
96 94 @issues_by_tracker ||= Issue.by_tracker(@project)
97 95 end
98 96
99 97 def issues_by_version
100 98 @issues_by_version ||= Issue.by_version(@project)
101 99 end
102 100
103 101 def issues_by_priority
104 102 @issues_by_priority ||= Issue.by_priority(@project)
105 103 end
106 104
107 105 def issues_by_category
108 106 @issues_by_category ||= Issue.by_category(@project)
109 107 end
110 108
111 109 def issues_by_assigned_to
112 110 @issues_by_assigned_to ||= Issue.by_assigned_to(@project)
113 111 end
114 112
115 113 def issues_by_author
116 114 @issues_by_author ||= Issue.by_author(@project)
117 115 end
118 116
119 117 def issues_by_subproject
120 118 @issues_by_subproject ||= Issue.by_subproject(@project)
121 119 @issues_by_subproject ||= []
122 120 end
123 121 end
General Comments 0
You need to be logged in to leave comments. Login now