Class: RailsAdmin::Config::Fields::Types::String
- Defined in:
- lib/rails_admin/config/fields/types/string.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Base
#abstract_model, #defined, #name, #order, #parent, #properties, #root, #section
Attributes included from Proxyable
Instance Method Summary collapse
Methods inherited from Base
#association?, #editable?, #errors, #form_default_value, #form_value, #generic_field_help, #initialize, #inspect, #inverse_of, #method_name, #optional, #optional=, #optional?, #parse_input, #type, #type_css_class, #value, #virtual?
Methods included from Groupable
Methods included from Hideable
#hidden?, #hide, included, #show
Methods included from Configurable
#has_option?, included, #register_deprecated_instance_option, #register_instance_option
Methods included from Proxyable
Constructor Details
This class inherits a constructor from RailsAdmin::Config::Fields::Base
Instance Method Details
#generic_help ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/rails_admin/config/fields/types/string.rb', line 17 def generic_help text = (required? ? I18n.translate('admin.form.required') : I18n.translate('admin.form.optional')) + '. ' if valid_length.present? && valid_length[:is].present? text += "#{I18n.translate("admin.form.char_length_of").capitalize} #{valid_length[:is]}." else max_length = [length, valid_length[:maximum] || nil].compact.min min_length = [0, valid_length[:minimum] || nil].compact.max if max_length if min_length == 0 text += "#{I18n.translate("admin.form.char_length_up_to").capitalize} #{max_length}." else text += "#{I18n.translate("admin.form.char_length_of").capitalize} #{min_length}-#{max_length}." end end end text end |