Class: QueryAssociationCustomFieldColumn
- Inherits:
-
QueryCustomFieldColumn
- Object
- QueryColumn
- QueryCustomFieldColumn
- QueryAssociationCustomFieldColumn
- Defined in:
- app/models/query.rb
Instance Attribute Summary
Attributes inherited from QueryColumn
#default_order, #groupable, #name, #sortable, #totalable
Instance Method Summary collapse
- #css_classes ⇒ Object
-
#groupable? ⇒ Boolean
TODO: support grouping by association custom field.
-
#initialize(association, custom_field, options = {}) ⇒ QueryAssociationCustomFieldColumn
constructor
A new instance of QueryAssociationCustomFieldColumn.
- #value_object(object) ⇒ Object
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
#abbr_day_name, #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, #normalize_float, #set_language_if_valid, #valid_languages
Constructor Details
#initialize(association, custom_field, options = {}) ⇒ QueryAssociationCustomFieldColumn
Returns a new instance of QueryAssociationCustomFieldColumn.
190 191 192 193 194 195 196 197 |
# File 'app/models/query.rb', line 190 def initialize(association, custom_field, ={}) super(custom_field, ) self.name = :"#{association}.cf_#{custom_field.id}" # TODO: support sorting by association custom field self.sortable = false self.groupable = false @association = association end |
Instance Method Details
#css_classes ⇒ Object
206 207 208 |
# File 'app/models/query.rb', line 206 def css_classes @css_classes ||= "#{@association}_cf_#{@cf.id} #{@cf.field_format}" end |
#groupable? ⇒ Boolean
TODO: support grouping by association custom field
211 212 213 |
# File 'app/models/query.rb', line 211 def groupable? false end |
#value_object(object) ⇒ Object
199 200 201 202 203 204 |
# File 'app/models/query.rb', line 199 def value_object(object) assoc = object.send(@association) if assoc && assoc.visible? super(assoc) end end |