Class: QueryAssociationCustomFieldColumn

Inherits:
QueryCustomFieldColumn show all
Defined in:
app/models/query.rb

Instance Attribute Summary

Attributes inherited from QueryColumn

#default_order, #groupable, #name, #sortable, #totalable

Instance Method Summary collapse

Methods inherited from QueryCustomFieldColumn

#caption, #custom_field, #group_by_statement, #value

Methods inherited from QueryColumn

#caption, #frozen?, #group_by_statement, #group_value, #inline?, #sortable?, #value

Methods included from Redmine::I18n

#current_language, #day_letter, #day_name, #find_language, #format_date, #format_hours, #format_time, included, #l, #l_hours, #l_hours_short, #l_or_humanize, #languages_options, #ll, #lu, #month_name, #set_language_if_valid, #valid_languages

Constructor Details

#initialize(association, custom_field, options = {}) ⇒ QueryAssociationCustomFieldColumn

Returns a new instance of QueryAssociationCustomFieldColumn.



177
178
179
180
181
182
183
184
# File 'app/models/query.rb', line 177

def initialize(association, custom_field, options={})
  super(custom_field, options)
  self.name = "#{association}.cf_#{custom_field.id}".to_sym
  # TODO: support sorting by association custom field
  self.sortable = false
  self.groupable = false
  @association = association
end

Instance Method Details

#css_classesObject



192
193
194
# File 'app/models/query.rb', line 192

def css_classes
  @css_classes ||= "#{@association}_cf_#{@cf.id} #{@cf.field_format}"
end

#groupable?Boolean

TODO: support grouping by association custom field

Returns:

  • (Boolean)


197
198
199
# File 'app/models/query.rb', line 197

def groupable?
  false
end

#value_object(object) ⇒ Object



186
187
188
189
190
# File 'app/models/query.rb', line 186

def value_object(object)
  if assoc = object.send(@association)
    super(assoc)
  end
end