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:
parent
554e569de1
commit
03572ec569
@ -40,7 +40,7 @@ module QueriesHelper
|
|||||||
else
|
else
|
||||||
case column.name
|
case column.name
|
||||||
when :subject
|
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)
|
link_to(h(value), :controller => 'issues', :action => 'show', :id => issue)
|
||||||
when :done_ratio
|
when :done_ratio
|
||||||
progress_bar(value, :width => '80px')
|
progress_bar(value, :width => '80px')
|
||||||
|
@ -92,6 +92,7 @@ class Query < ActiveRecord::Base
|
|||||||
cattr_reader :operators_by_filter_type
|
cattr_reader :operators_by_filter_type
|
||||||
|
|
||||||
@@available_columns = [
|
@@available_columns = [
|
||||||
|
QueryColumn.new(:project, :sortable => "#{Project.table_name}.name"),
|
||||||
QueryColumn.new(:tracker, :sortable => "#{Tracker.table_name}.position"),
|
QueryColumn.new(:tracker, :sortable => "#{Tracker.table_name}.position"),
|
||||||
QueryColumn.new(:status, :sortable => "#{IssueStatus.table_name}.position"),
|
QueryColumn.new(:status, :sortable => "#{IssueStatus.table_name}.position"),
|
||||||
QueryColumn.new(:priority, :sortable => "#{Enumeration.table_name}.position", :default_order => 'desc'),
|
QueryColumn.new(:priority, :sortable => "#{Enumeration.table_name}.position", :default_order => 'desc'),
|
||||||
@ -236,7 +237,10 @@ class Query < ActiveRecord::Base
|
|||||||
|
|
||||||
def columns
|
def columns
|
||||||
if has_default_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
|
else
|
||||||
# preserve the column_names order
|
# preserve the column_names order
|
||||||
column_names.collect {|name| available_columns.find {|col| col.name == name}}.compact
|
column_names.collect {|name| available_columns.find {|col| col.name == name}}.compact
|
||||||
|
@ -58,6 +58,8 @@ class IssuesControllerTest < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_index
|
def test_index
|
||||||
|
Setting.default_language = 'en'
|
||||||
|
|
||||||
get :index
|
get :index
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template 'index.rhtml'
|
assert_template 'index.rhtml'
|
||||||
@ -68,6 +70,8 @@ class IssuesControllerTest < Test::Unit::TestCase
|
|||||||
# private projects hidden
|
# private projects hidden
|
||||||
assert_no_tag :tag => 'a', :content => /Issue of a private subproject/
|
assert_no_tag :tag => 'a', :content => /Issue of a private subproject/
|
||||||
assert_no_tag :tag => 'a', :content => /Issue on project 2/
|
assert_no_tag :tag => 'a', :content => /Issue on project 2/
|
||||||
|
# project column
|
||||||
|
assert_tag :tag => 'th', :content => /Project/
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_index_should_not_list_issues_when_module_disabled
|
def test_index_should_not_list_issues_when_module_disabled
|
||||||
|
Loading…
x
Reference in New Issue
Block a user