##// END OF EJS Templates
Separated ReportsController#issue_report into two separate actions....
Eric Davis -
r3282:597725d77ce0
parent child
Show More
@@ -22,6 +22,27 class ReportsController < ApplicationController
22 def issue_report
22 def issue_report
23 @statuses = IssueStatus.find(:all, :order => 'position')
23 @statuses = IssueStatus.find(:all, :order => 'position')
24
24
25 @trackers = @project.trackers
26 @versions = @project.shared_versions.sort
27 @priorities = IssuePriority.all
28 @categories = @project.issue_categories
29 @assignees = @project.members.collect { |m| m.user }.sort
30 @authors = @project.members.collect { |m| m.user }.sort
31 @subprojects = @project.descendants.active
32 issues_by_tracker
33 issues_by_version
34 issues_by_priority
35 issues_by_category
36 issues_by_assigned_to
37 issues_by_author
38 issues_by_subproject
39
40 render :template => "reports/issue_report"
41 end
42
43 def issue_report_details
44 @statuses = IssueStatus.find(:all, :order => 'position')
45
25 case params[:detail]
46 case params[:detail]
26 when "tracker"
47 when "tracker"
27 @field = "tracker_id"
48 @field = "tracker_id"
@@ -66,25 +87,10 class ReportsController < ApplicationController
66 @report_title = l(:field_subproject)
87 @report_title = l(:field_subproject)
67 render :template => "reports/issue_report_details"
88 render :template => "reports/issue_report_details"
68 else
89 else
69 @trackers = @project.trackers
90 redirect_to :action => 'issue_report', :id => @project
70 @versions = @project.shared_versions.sort
71 @priorities = IssuePriority.all
72 @categories = @project.issue_categories
73 @assignees = @project.members.collect { |m| m.user }.sort
74 @authors = @project.members.collect { |m| m.user }.sort
75 @subprojects = @project.descendants.active
76 issues_by_tracker
77 issues_by_version
78 issues_by_priority
79 issues_by_category
80 issues_by_assigned_to
81 issues_by_author
82 issues_by_subproject
83
84 render :template => "reports/issue_report"
85 end
91 end
86 end
92
87
93 end
88 private
94 private
89 def issues_by_tracker
95 def issues_by_tracker
90 @issues_by_tracker ||= Issue.by_tracker(@project)
96 @issues_by_tracker ||= Issue.by_tracker(@project)
@@ -139,9 +139,9 ActionController::Routing::Routes.draw do |map|
139 relations.connect 'issues/:issue_id/relations/:id/destroy', :action => 'destroy'
139 relations.connect 'issues/:issue_id/relations/:id/destroy', :action => 'destroy'
140 end
140 end
141
141
142 map.with_options :controller => 'reports', :action => 'issue_report', :conditions => {:method => :get} do |reports|
142 map.with_options :controller => 'reports', :conditions => {:method => :get} do |reports|
143 reports.connect 'projects/:id/issues/report'
143 reports.connect 'projects/:id/issues/report', :action => 'issue_report'
144 reports.connect 'projects/:id/issues/report/:detail'
144 reports.connect 'projects/:id/issues/report/:detail', :action => 'issue_report_details'
145 end
145 end
146
146
147 map.with_options :controller => 'news' do |news_routes|
147 map.with_options :controller => 'news' do |news_routes|
@@ -42,7 +42,7 Redmine::AccessControl.map do |map|
42 :issues => [:index, :changes, :show, :context_menu],
42 :issues => [:index, :changes, :show, :context_menu],
43 :versions => [:show, :status_by],
43 :versions => [:show, :status_by],
44 :queries => :index,
44 :queries => :index,
45 :reports => :issue_report}
45 :reports => [:issue_report, :issue_report_details]}
46 map.permission :add_issues, {:issues => [:new, :update_form]}
46 map.permission :add_issues, {:issues => [:new, :update_form]}
47 map.permission :edit_issues, {:issues => [:edit, :reply, :bulk_edit, :update_form]}
47 map.permission :edit_issues, {:issues => [:edit, :reply, :bulk_edit, :update_form]}
48 map.permission :manage_issue_relations, {:issue_relations => [:new, :destroy]}
48 map.permission :manage_issue_relations, {:issue_relations => [:new, :destroy]}
@@ -48,12 +48,32 class ReportsControllerTest < ActionController::TestCase
48 end
48 end
49 end
49 end
50 end
50 end
51
51
52 def test_issue_report_details
52 context "GET :issue_report_details" do
53 %w(tracker version priority category assigned_to author subproject).each do |detail|
53 %w(tracker version priority category assigned_to author subproject).each do |detail|
54 get :issue_report, :id => 1, :detail => detail
54 context "for #{detail}" do
55 assert_response :success
55 setup do
56 assert_template 'issue_report_details'
56 get :issue_report_details, :id => 1, :detail => detail
57 end
58
59 should_respond_with :success
60 should_render_template :issue_report_details
61 should_assign_to :field
62 should_assign_to :rows
63 should_assign_to :data
64 should_assign_to :report_title
65 end
57 end
66 end
67
68 context "with an invalid detail" do
69 setup do
70 get :issue_report_details, :id => 1, :detail => 'invalid'
71 end
72
73 should_respond_with :redirect
74 should_redirect_to('the issue report') {{:controller => 'reports', :action => 'issue_report', :id => 'ecookbook'}}
75 end
76
58 end
77 end
78
59 end
79 end
@@ -20,7 +20,7 require "test_helper"
20 class RoutingTest < ActionController::IntegrationTest
20 class RoutingTest < ActionController::IntegrationTest
21 context "issue reports" do
21 context "issue reports" do
22 should_route :get, "/projects/567/issues/report", :controller => 'reports', :action => 'issue_report', :id => '567'
22 should_route :get, "/projects/567/issues/report", :controller => 'reports', :action => 'issue_report', :id => '567'
23 should_route :get, "/projects/567/issues/report/assigned_to", :controller => 'reports', :action => 'issue_report', :id => '567', :detail => 'assigned_to'
23 should_route :get, "/projects/567/issues/report/assigned_to", :controller => 'reports', :action => 'issue_report_details', :id => '567', :detail => 'assigned_to'
24 end
24 end
25
25
26 end
26 end
General Comments 0
You need to be logged in to leave comments. Login now