Class: QueryAssociationCustomFieldColumn
- Inherits:
-
QueryCustomFieldColumn
- Object
- QueryColumn
- QueryCustomFieldColumn
- QueryAssociationCustomFieldColumn
- Defined in:
- app/models/query.rb
Overview
Instance Attribute Summary
Attributes inherited from QueryColumn
#default_order, #groupable, #name, #sortable, #totalable
Instance Method Summary collapse
- #css_classes ⇒ Object
-
#initialize(association, custom_field, options = {}) ⇒ QueryAssociationCustomFieldColumn
constructor
A new instance of QueryAssociationCustomFieldColumn.
- #value_object(object) ⇒ Object
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_hours, #format_time, #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
143 144 145 146 147 148 149 150 |
# File 'app/models/query.rb', line 143 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_classes ⇒ Object
158 159 160 |
# File 'app/models/query.rb', line 158 def css_classes @css_classes ||= "#{@association}_cf_#{@cf.id} #{@cf.field_format}" end |
#value_object(object) ⇒ Object
152 153 154 155 156 |
# File 'app/models/query.rb', line 152 def value_object(object) if assoc = object.send(@association) super(assoc) end end |