Class: QueryAssociationCustomFieldColumn

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

Instance Attribute Summary

Attributes inherited from QueryColumn

#default_order, #groupable, #name, #sortable

Instance Method Summary collapse

Methods inherited from QueryCustomFieldColumn

#caption, #custom_field, #value

Methods inherited from QueryColumn

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

Methods included from Redmine::I18n

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

Constructor Details

#initialize(association, custom_field) ⇒ QueryAssociationCustomFieldColumn

Returns a new instance of QueryAssociationCustomFieldColumn.


121
122
123
124
125
126
127
128
# File 'app/models/query.rb', line 121

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

Instance Method Details

#css_classesObject


136
137
138
# File 'app/models/query.rb', line 136

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

#value_object(object) ⇒ Object


130
131
132
133
134
# File 'app/models/query.rb', line 130

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