Separated ReportsController#issue_report into two separate actions.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3396 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
23c46c68ab
commit
597725d77c
|
@ -22,6 +22,27 @@ class ReportsController < ApplicationController
|
||||||
def issue_report
|
def issue_report
|
||||||
@statuses = IssueStatus.find(:all, :order => 'position')
|
@statuses = IssueStatus.find(:all, :order => 'position')
|
||||||
|
|
||||||
|
@trackers = @project.trackers
|
||||||
|
@versions = @project.shared_versions.sort
|
||||||
|
@priorities = IssuePriority.all
|
||||||
|
@categories = @project.issue_categories
|
||||||
|
@assignees = @project.members.collect { |m| m.user }.sort
|
||||||
|
@authors = @project.members.collect { |m| m.user }.sort
|
||||||
|
@subprojects = @project.descendants.active
|
||||||
|
issues_by_tracker
|
||||||
|
issues_by_version
|
||||||
|
issues_by_priority
|
||||||
|
issues_by_category
|
||||||
|
issues_by_assigned_to
|
||||||
|
issues_by_author
|
||||||
|
issues_by_subproject
|
||||||
|
|
||||||
|
render :template => "reports/issue_report"
|
||||||
|
end
|
||||||
|
|
||||||
|
def issue_report_details
|
||||||
|
@statuses = IssueStatus.find(:all, :order => 'position')
|
||||||
|
|
||||||
case params[:detail]
|
case params[:detail]
|
||||||
when "tracker"
|
when "tracker"
|
||||||
@field = "tracker_id"
|
@field = "tracker_id"
|
||||||
|
@ -66,25 +87,10 @@ class ReportsController < ApplicationController
|
||||||
@report_title = l(:field_subproject)
|
@report_title = l(:field_subproject)
|
||||||
render :template => "reports/issue_report_details"
|
render :template => "reports/issue_report_details"
|
||||||
else
|
else
|
||||||
@trackers = @project.trackers
|
redirect_to :action => 'issue_report', :id => @project
|
||||||
@versions = @project.shared_versions.sort
|
|
||||||
@priorities = IssuePriority.all
|
|
||||||
@categories = @project.issue_categories
|
|
||||||
@assignees = @project.members.collect { |m| m.user }.sort
|
|
||||||
@authors = @project.members.collect { |m| m.user }.sort
|
|
||||||
@subprojects = @project.descendants.active
|
|
||||||
issues_by_tracker
|
|
||||||
issues_by_version
|
|
||||||
issues_by_priority
|
|
||||||
issues_by_category
|
|
||||||
issues_by_assigned_to
|
|
||||||
issues_by_author
|
|
||||||
issues_by_subproject
|
|
||||||
|
|
||||||
render :template => "reports/issue_report"
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
end
|
||||||
private
|
private
|
||||||
def issues_by_tracker
|
def issues_by_tracker
|
||||||
@issues_by_tracker ||= Issue.by_tracker(@project)
|
@issues_by_tracker ||= Issue.by_tracker(@project)
|
||||||
|
|
|
@ -139,9 +139,9 @@ ActionController::Routing::Routes.draw do |map|
|
||||||
relations.connect 'issues/:issue_id/relations/:id/destroy', :action => 'destroy'
|
relations.connect 'issues/:issue_id/relations/:id/destroy', :action => 'destroy'
|
||||||
end
|
end
|
||||||
|
|
||||||
map.with_options :controller => 'reports', :action => 'issue_report', :conditions => {:method => :get} do |reports|
|
map.with_options :controller => 'reports', :conditions => {:method => :get} do |reports|
|
||||||
reports.connect 'projects/:id/issues/report'
|
reports.connect 'projects/:id/issues/report', :action => 'issue_report'
|
||||||
reports.connect 'projects/:id/issues/report/:detail'
|
reports.connect 'projects/:id/issues/report/:detail', :action => 'issue_report_details'
|
||||||
end
|
end
|
||||||
|
|
||||||
map.with_options :controller => 'news' do |news_routes|
|
map.with_options :controller => 'news' do |news_routes|
|
||||||
|
|
|
@ -42,7 +42,7 @@ Redmine::AccessControl.map do |map|
|
||||||
:issues => [:index, :changes, :show, :context_menu],
|
:issues => [:index, :changes, :show, :context_menu],
|
||||||
:versions => [:show, :status_by],
|
:versions => [:show, :status_by],
|
||||||
:queries => :index,
|
:queries => :index,
|
||||||
:reports => :issue_report}
|
:reports => [:issue_report, :issue_report_details]}
|
||||||
map.permission :add_issues, {:issues => [:new, :update_form]}
|
map.permission :add_issues, {:issues => [:new, :update_form]}
|
||||||
map.permission :edit_issues, {:issues => [:edit, :reply, :bulk_edit, :update_form]}
|
map.permission :edit_issues, {:issues => [:edit, :reply, :bulk_edit, :update_form]}
|
||||||
map.permission :manage_issue_relations, {:issue_relations => [:new, :destroy]}
|
map.permission :manage_issue_relations, {:issue_relations => [:new, :destroy]}
|
||||||
|
|
|
@ -48,12 +48,32 @@ class ReportsControllerTest < ActionController::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_issue_report_details
|
context "GET :issue_report_details" do
|
||||||
%w(tracker version priority category assigned_to author subproject).each do |detail|
|
%w(tracker version priority category assigned_to author subproject).each do |detail|
|
||||||
get :issue_report, :id => 1, :detail => detail
|
context "for #{detail}" do
|
||||||
assert_response :success
|
setup do
|
||||||
assert_template 'issue_report_details'
|
get :issue_report_details, :id => 1, :detail => detail
|
||||||
|
end
|
||||||
|
|
||||||
|
should_respond_with :success
|
||||||
|
should_render_template :issue_report_details
|
||||||
|
should_assign_to :field
|
||||||
|
should_assign_to :rows
|
||||||
|
should_assign_to :data
|
||||||
|
should_assign_to :report_title
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "with an invalid detail" do
|
||||||
|
setup do
|
||||||
|
get :issue_report_details, :id => 1, :detail => 'invalid'
|
||||||
|
end
|
||||||
|
|
||||||
|
should_respond_with :redirect
|
||||||
|
should_redirect_to('the issue report') {{:controller => 'reports', :action => 'issue_report', :id => 'ecookbook'}}
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -20,7 +20,7 @@ require "test_helper"
|
||||||
class RoutingTest < ActionController::IntegrationTest
|
class RoutingTest < ActionController::IntegrationTest
|
||||||
context "issue reports" do
|
context "issue reports" do
|
||||||
should_route :get, "/projects/567/issues/report", :controller => 'reports', :action => 'issue_report', :id => '567'
|
should_route :get, "/projects/567/issues/report", :controller => 'reports', :action => 'issue_report', :id => '567'
|
||||||
should_route :get, "/projects/567/issues/report/assigned_to", :controller => 'reports', :action => 'issue_report', :id => '567', :detail => 'assigned_to'
|
should_route :get, "/projects/567/issues/report/assigned_to", :controller => 'reports', :action => 'issue_report_details', :id => '567', :detail => 'assigned_to'
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue