Class: Redmine::FieldFormat::ListFormat
- Inherits:
-
List
- Object
- Base
- List
- Redmine::FieldFormat::ListFormat
show all
- Defined in:
- lib/redmine/field_format.rb
Instance Method Summary
collapse
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, #join_for_order_statement, #label, #name, #order_statement, #query_filter_options, #sanitize_html, #set_custom_field_value, #target_class, #validate_single_value, #value_from_keyword
#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
#group_statement(custom_field) ⇒ Object
718
719
720
|
# File 'lib/redmine/field_format.rb', line 718
def group_statement(custom_field)
order_statement(custom_field)
end
|
#possible_custom_value_options(custom_value) ⇒ Object
688
689
690
691
692
693
694
695
|
# File 'lib/redmine/field_format.rb', line 688
def possible_custom_value_options(custom_value)
options = possible_values_options(custom_value.custom_field)
missing = [custom_value.value].flatten.reject(&:blank?) - options
if missing.any?
options += missing
end
options
end
|
#possible_values_options(custom_field, object = nil) ⇒ Object
697
698
699
|
# File 'lib/redmine/field_format.rb', line 697
def possible_values_options(custom_field, object=nil)
custom_field.possible_values
end
|
#validate_custom_field(custom_field) ⇒ Object
701
702
703
704
705
706
|
# File 'lib/redmine/field_format.rb', line 701
def validate_custom_field(custom_field)
errors = []
errors << [:possible_values, :blank] if custom_field.possible_values.blank?
errors << [:possible_values, :invalid] unless custom_field.possible_values.is_a? Array
errors
end
|
#validate_custom_value(custom_value) ⇒ Object
708
709
710
711
712
713
714
715
716
|
# File 'lib/redmine/field_format.rb', line 708
def validate_custom_value(custom_value)
values = Array.wrap(custom_value.value).reject {|value| value.to_s == ''}
invalid_values = values - Array.wrap(custom_value.value_was) - custom_value.custom_field.possible_values
if invalid_values.any?
[::I18n.t('activerecord.errors.messages.inclusion')]
else
[]
end
end
|