Class: SimpleFormWithClientValidation::Inputs::CollectionInput

Inherits:
Base
  • Object
show all
Defined in:
lib/simple_form_with_client_validation/inputs/collection_input.rb

Instance Attribute Summary

Attributes inherited from Base

#attribute_name, #column, #html_classes, #input_html_classes, #input_html_options, #input_type, #options, #reflection

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

disable, enable, #initialize

Methods included from SimpleFormWithClientValidation::I18nCache

#get_i18n_cache, #i18n_cache, #reset_i18n_cache

Methods included from Components::Readonly

#readonly

Methods included from Components::Placeholders

#placeholder, #placeholder_text

Methods included from Components::Pattern

#pattern

Methods included from Components::MinMax

#min_max

Methods included from Components::Minlength

#minlength

Methods included from Components::Maxlength

#maxlength

Methods included from Components::LabelInput

#label_input

Methods included from Components::HTML5

#html5, #html5?, #initialize

Methods included from Components::Hints

#has_hint?, #hint

Methods included from Components::Errors

#error, #has_errors?

Methods included from Helpers::Validators

#has_validators?

Constructor Details

This class inherits a constructor from SimpleFormWithClientValidation::Inputs::Base

Class Method Details

.boolean_collectionObject

Default boolean collection for use with selects/radios when no collection is given. Always fallback to this boolean collection. Texts can be translated using i18n in “simple_form.yes” and “simple_form.no” keys. See the example locale file.



8
9
10
11
12
13
# File 'lib/simple_form_with_client_validation/inputs/collection_input.rb', line 8

def self.boolean_collection
  i18n_cache :boolean_collection do
    [ [I18n.t(:"simple_form.yes", :default => 'Yes'), true],
      [I18n.t(:"simple_form.no", :default => 'No'), false] ]
  end
end

Instance Method Details

#inputObject

Raises:

  • (NotImplementedError)


15
16
17
18
# File 'lib/simple_form_with_client_validation/inputs/collection_input.rb', line 15

def input
  raise NotImplementedError,
    "input should be implemented by classes inheriting from CollectionInput"
end

#input_optionsObject



20
21
22
23
24
# File 'lib/simple_form_with_client_validation/inputs/collection_input.rb', line 20

def input_options
  options = super
  options[:include_blank] = true unless skip_include_blank?
  options
end