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
|
||||
@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]
|
||||
when "tracker"
|
||||
@field = "tracker_id"
|
||||
|
@ -66,25 +87,10 @@ class ReportsController < ApplicationController
|
|||
@report_title = l(:field_subproject)
|
||||
render :template => "reports/issue_report_details"
|
||||
else
|
||||
@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"
|
||||
redirect_to :action => 'issue_report', :id => @project
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
private
|
||||
def issues_by_tracker
|
||||
@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'
|
||||
end
|
||||
|
||||
map.with_options :controller => 'reports', :action => 'issue_report', :conditions => {:method => :get} do |reports|
|
||||
reports.connect 'projects/:id/issues/report'
|
||||
reports.connect 'projects/:id/issues/report/:detail'
|
||||
map.with_options :controller => 'reports', :conditions => {:method => :get} do |reports|
|
||||
reports.connect 'projects/:id/issues/report', :action => 'issue_report'
|
||||
reports.connect 'projects/:id/issues/report/:detail', :action => 'issue_report_details'
|
||||
end
|
||||
|
||||
map.with_options :controller => 'news' do |news_routes|
|
||||
|
|
|
@ -42,7 +42,7 @@ Redmine::AccessControl.map do |map|
|
|||
:issues => [:index, :changes, :show, :context_menu],
|
||||
:versions => [:show, :status_by],
|
||||
:queries => :index,
|
||||
:reports => :issue_report}
|
||||
:reports => [:issue_report, :issue_report_details]}
|
||||
map.permission :add_issues, {:issues => [:new, :update_form]}
|
||||
map.permission :edit_issues, {:issues => [:edit, :reply, :bulk_edit, :update_form]}
|
||||
map.permission :manage_issue_relations, {:issue_relations => [:new, :destroy]}
|
||||
|
|
|
@ -48,12 +48,32 @@ class ReportsControllerTest < ActionController::TestCase
|
|||
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|
|
||||
get :issue_report, :id => 1, :detail => detail
|
||||
assert_response :success
|
||||
assert_template 'issue_report_details'
|
||||
context "for #{detail}" do
|
||||
setup do
|
||||
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
|
||||
|
||||
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
|
||||
|
|
|
@ -20,7 +20,7 @@ require "test_helper"
|
|||
class RoutingTest < ActionController::IntegrationTest
|
||||
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/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
|
||||
|
|
Loading…
Reference in New Issue