Class: QueryCustomFieldColumn
- Inherits:
-
QueryColumn
- Object
- QueryColumn
- QueryCustomFieldColumn
- Defined in:
- app/models/query.rb
Instance Attribute Summary
Attributes inherited from QueryColumn
#default_order, #groupable, #name, #sortable
Instance Method Summary collapse
- #caption ⇒ Object
- #custom_field ⇒ Object
-
#initialize(custom_field) ⇒ QueryCustomFieldColumn
constructor
A new instance of QueryCustomFieldColumn.
- #value(issue) ⇒ Object
Methods inherited from QueryColumn
Methods included from Redmine::I18n
#current_language, #day_name, #find_language, #format_date, #format_time, included, #l, #l_hours, #l_or_humanize, #ll, #month_name, #set_language_if_valid, #valid_languages
Constructor Details
#initialize(custom_field) ⇒ QueryCustomFieldColumn
Returns a new instance of QueryCustomFieldColumn.
49 50 51 52 53 54 55 56 57 |
# File 'app/models/query.rb', line 49 def initialize(custom_field) self.name = "cf_#{custom_field.id}".to_sym self.sortable = custom_field.order_statement || false if %w(list date bool int).include?(custom_field.field_format) self.groupable = custom_field.order_statement end self.groupable ||= false @cf = custom_field end |
Instance Method Details
#caption ⇒ Object
59 60 61 |
# File 'app/models/query.rb', line 59 def @cf.name end |
#custom_field ⇒ Object
63 64 65 |
# File 'app/models/query.rb', line 63 def custom_field @cf end |
#value(issue) ⇒ Object
67 68 69 70 |
# File 'app/models/query.rb', line 67 def value(issue) cv = issue.custom_values.detect {|v| v.custom_field_id == @cf.id} cv && @cf.cast_value(cv.value) end |