Allow issue grouping by custom field (#2679).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3071 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2009-11-16 18:07:30 +00:00
parent 2a3a6da45a
commit 71bc44a89d
7 changed files with 65 additions and 7 deletions
+11
View File
@@ -23,6 +23,9 @@ class QueryColumn
self.name = name
self.sortable = options[:sortable]
self.groupable = options[:groupable] || false
if groupable == true
self.groupable = name.to_s
end
self.default_order = options[:default_order]
end
@@ -41,6 +44,10 @@ class QueryCustomFieldColumn < QueryColumn
def initialize(custom_field)
self.name = "cf_#{custom_field.id}".to_sym
self.sortable = custom_field.order_statement || false
if %w(list date bool int).include?(custom_field.field_format)
self.groupable = custom_field.order_statement
end
self.groupable ||= false
@cf = custom_field
end
@@ -312,6 +319,10 @@ class Query < ActiveRecord::Base
groupable_columns.detect {|c| c.name.to_s == group_by}
end
def group_by_statement
group_by_column.groupable
end
def project_statement
project_clauses = []
if project && !@project.descendants.active.empty?