Adds a sortable "Project" column to the issue list.

It's displayed by default on the cross-project issue list (#2889). It's also available for saved queries.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2566 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2009-03-07 15:58:39 +00:00
parent 554e569de1
commit 03572ec569
3 changed files with 10 additions and 2 deletions

View File

@ -40,7 +40,7 @@ module QueriesHelper
else
case column.name
when :subject
h((@project.nil? || @project != issue.project) ? "#{issue.project.name} - " : '') +
h((!@project.nil? && @project != issue.project) ? "#{issue.project.name} - " : '') +
link_to(h(value), :controller => 'issues', :action => 'show', :id => issue)
when :done_ratio
progress_bar(value, :width => '80px')

View File

@ -92,6 +92,7 @@ class Query < ActiveRecord::Base
cattr_reader :operators_by_filter_type
@@available_columns = [
QueryColumn.new(:project, :sortable => "#{Project.table_name}.name"),
QueryColumn.new(:tracker, :sortable => "#{Tracker.table_name}.position"),
QueryColumn.new(:status, :sortable => "#{IssueStatus.table_name}.position"),
QueryColumn.new(:priority, :sortable => "#{Enumeration.table_name}.position", :default_order => 'desc'),
@ -236,7 +237,10 @@ class Query < ActiveRecord::Base
def columns
if has_default_columns?
available_columns.select {|c| Setting.issue_list_default_columns.include?(c.name.to_s) }
available_columns.select do |c|
# Adds the project column by default for cross-project lists
Setting.issue_list_default_columns.include?(c.name.to_s) || (c.name == :project && project.nil?)
end
else
# preserve the column_names order
column_names.collect {|name| available_columns.find {|col| col.name == name}}.compact

View File

@ -58,6 +58,8 @@ class IssuesControllerTest < Test::Unit::TestCase
end
def test_index
Setting.default_language = 'en'
get :index
assert_response :success
assert_template 'index.rhtml'
@ -68,6 +70,8 @@ class IssuesControllerTest < Test::Unit::TestCase
# private projects hidden
assert_no_tag :tag => 'a', :content => /Issue of a private subproject/
assert_no_tag :tag => 'a', :content => /Issue on project 2/
# project column
assert_tag :tag => 'th', :content => /Project/
end
def test_index_should_not_list_issues_when_module_disabled