Makes issue custom fields available as timelog columns (#1766).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11174 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -85,6 +85,28 @@ class QueryCustomFieldColumn < QueryColumn
|
||||
end
|
||||
end
|
||||
|
||||
class QueryAssociationCustomFieldColumn < QueryCustomFieldColumn
|
||||
|
||||
def initialize(association, custom_field)
|
||||
super(custom_field)
|
||||
self.name = "#{association}.cf_#{custom_field.id}".to_sym
|
||||
# TODO: support sorting/grouping by association custom field
|
||||
self.sortable = false
|
||||
self.groupable = false
|
||||
@association = association
|
||||
end
|
||||
|
||||
def value(object)
|
||||
if assoc = object.send(@association)
|
||||
super(assoc)
|
||||
end
|
||||
end
|
||||
|
||||
def css_classes
|
||||
@css_classes ||= "#{@association}_cf_#{@cf.id} #{@cf.field_format}"
|
||||
end
|
||||
end
|
||||
|
||||
class Query < ActiveRecord::Base
|
||||
class StatementInvalid < ::ActiveRecord::StatementInvalid
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user