Class: Redmine::FieldFormat::FloatFormat
- Defined in:
- lib/redmine/field_format.rb
Instance Method Summary collapse
- #cast_single_value(custom_field, value, customized = nil) ⇒ Object
- #cast_total_value(custom_field, value) ⇒ Object
- #query_filter_options(custom_field, query) ⇒ Object
- #validate_single_value(custom_field, value, customized = nil) ⇒ Object
Methods inherited from Numeric
#order_statement, #total_for_scope
Methods inherited from Base
#after_save_custom_value, #before_custom_field_save, #bulk_edit_tag, #cast_custom_value, #cast_value, #edit_tag, field_attributes, #formatted_custom_value, #formatted_value, #group_statement, #join_for_order_statement, #label, #name, #order_statement, #possible_custom_value_options, #possible_values_options, #sanitize_html, #set_custom_field_value, #target_class, #validate_custom_field, #validate_custom_value, #value_from_keyword
Methods included from Helpers::URL
#uri_with_link_safe_scheme?, #uri_with_safe_scheme?
Methods included from 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
Instance Method Details
#cast_single_value(custom_field, value, customized = nil) ⇒ Object
534 535 536 |
# File 'lib/redmine/field_format.rb', line 534 def cast_single_value(custom_field, value, customized=nil) value.to_f end |
#cast_total_value(custom_field, value) ⇒ Object
538 539 540 |
# File 'lib/redmine/field_format.rb', line 538 def cast_total_value(custom_field, value) value.to_f.round(2) end |
#query_filter_options(custom_field, query) ⇒ Object
549 550 551 |
# File 'lib/redmine/field_format.rb', line 549 def (custom_field, query) {:type => :float} end |
#validate_single_value(custom_field, value, customized = nil) ⇒ Object
542 543 544 545 546 547 |
# File 'lib/redmine/field_format.rb', line 542 def validate_single_value(custom_field, value, customized=nil) value = normalize_float(value) errs = super errs << ::I18n.t('activerecord.errors.messages.invalid') unless Kernel.Float(value, exception: false) errs end |