Class: Redmine::FieldFormat::IntFormat

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

Overview

Since:

  • 2.5.0

Instance Method Summary collapse

Methods inherited from Numeric

#cast_total_value, #order_statement, #total_for_scope

Methods inherited from Base

#before_custom_field_save, #bulk_edit_tag, #cast_custom_value, #cast_value, #edit_tag, field_attributes, #formatted_custom_value, #formatted_value, #join_for_order_statement, #name, #order_statement, #possible_custom_value_options, #possible_values_options, #target_class, #validate_custom_field, #validate_custom_value, #value_from_keyword

Methods included from Helpers::URL

#uri_with_safe_scheme?

Methods included from I18n

#current_language, #day_letter, #day_name, #find_language, #format_date, #format_time, #l, #l_hours, #l_hours_short, #l_or_humanize, #languages_options, #ll, #lu, #month_name, #set_language_if_valid, #valid_languages

Instance Method Details

#cast_single_value(custom_field, value, customized = nil) ⇒ Object



421
422
423
# File 'lib/redmine/field_format.rb', line 421

def cast_single_value(custom_field, value, customized=nil)
  value.to_i
end

#group_statement(custom_field) ⇒ Object



435
436
437
# File 'lib/redmine/field_format.rb', line 435

def group_statement(custom_field)
  order_statement(custom_field)
end

#labelObject



417
418
419
# File 'lib/redmine/field_format.rb', line 417

def label
  "label_integer"
end

#query_filter_options(custom_field, query) ⇒ Object



431
432
433
# File 'lib/redmine/field_format.rb', line 431

def query_filter_options(custom_field, query)
  {:type => :integer}
end

#validate_single_value(custom_field, value, customized = nil) ⇒ Object



425
426
427
428
429
# File 'lib/redmine/field_format.rb', line 425

def validate_single_value(custom_field, value, customized=nil)
  errs = super
  errs << ::I18n.t('activerecord.errors.messages.not_a_number') unless value.to_s.strip =~ /^[+-]?\d+$/
  errs
end