diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2009-11-16 18:07:30 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2009-11-16 18:07:30 +0000 |
commit | 71bc44a89dceb4b6caacb4982849a2b65f02edf8 (patch) | |
tree | 3b3014564043b8de562a52d83efdda86d8c79372 /app/models/query.rb | |
parent | 2a3a6da45a47684f5918032d499ff4a2f10b17f4 (diff) | |
download | redmine-71bc44a89dceb4b6caacb4982849a2b65f02edf8.tar.gz redmine-71bc44a89dceb4b6caacb4982849a2b65f02edf8.zip |
Allow issue grouping by custom field (#2679).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3071 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/query.rb')
-rw-r--r-- | app/models/query.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/app/models/query.rb b/app/models/query.rb index 7ce95f0ea..816c5c5a0 100644 --- a/app/models/query.rb +++ b/app/models/query.rb @@ -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? |