Class: Redmine::FieldFormat::EnumerationFormat

Inherits:
RecordList show all
Defined in:
lib/redmine/field_format.rb

Instance Method Summary collapse

Methods inherited from RecordList

#cast_single_value, #group_statement, #join_for_order_statement, #order_statement, #possible_custom_value_options, #reset_target_class, #validate_custom_value

Methods inherited from List

#bulk_edit_tag, #edit_tag, #query_filter_options

Methods inherited from Base

#after_save_custom_value, #before_custom_field_save, #bulk_edit_tag, #cast_custom_value, #cast_single_value, #cast_value, #edit_tag, field_attributes, #formatted_custom_value, #formatted_value, #group_statement, #join_for_order_statement, #name, #order_statement, #possible_custom_value_options, #query_filter_options, #set_custom_field_value, #validate_custom_field, #validate_custom_value, #validate_single_value

Methods included from Helpers::URL

#uri_with_safe_scheme?

Methods included from 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

Instance Method Details

#labelObject


804
805
806
# File 'lib/redmine/field_format.rb', line 804

def label
  "label_field_format_enumeration"
end

#possible_values_options(custom_field, object = nil) ⇒ Object


812
813
814
# File 'lib/redmine/field_format.rb', line 812

def possible_values_options(custom_field, object=nil)
  possible_values_records(custom_field, object).map {|u| [u.name, u.id.to_s]}
end

#possible_values_records(custom_field, object = nil) ⇒ Object


816
817
818
# File 'lib/redmine/field_format.rb', line 816

def possible_values_records(custom_field, object=nil)
  custom_field.enumerations.active
end

#target_classObject


808
809
810
# File 'lib/redmine/field_format.rb', line 808

def target_class
  @target_class ||= CustomFieldEnumeration
end

#value_from_keyword(custom_field, keyword, object) ⇒ Object


820
821
822
823
824
# File 'lib/redmine/field_format.rb', line 820

def value_from_keyword(custom_field, keyword, object)
  parse_keyword(custom_field, keyword) do |k|
    custom_field.enumerations.where("LOWER(name) LIKE LOWER(?)", k).first.try(:id)
  end
end