Class: SimpleForm::Inputs::Base
- Inherits:
-
Object
- Object
- SimpleForm::Inputs::Base
- Extended by:
- SimpleForm::I18nCache
- Defined in:
- lib/simple_form/inputs/base.rb
Direct Known Subclasses
BlockInput, CollectionInput, DateTimeInput, HiddenInput, MappingInput, TextFieldInput
Constant Summary collapse
- ACTIONS =
When action is create or update, we still should use new and edit
{ :create => :new, :update => :edit }
Instance Method Summary collapse
-
#initialize(builder) ⇒ Base
constructor
A new instance of Base.
- #input ⇒ Object
- #input_html_options ⇒ Object
- #input_options ⇒ Object
- #render ⇒ Object
Methods included from SimpleForm::I18nCache
get_i18n_cache, i18n_cache, reset_i18n_cache
Methods included from Components::Wrapper
#wrap, #wrapper_html_options, #wrapper_tag
Methods included from Components::Labels
included, #label, #label_html_options, #label_target, #label_text
Methods included from Components::Hints
#hint, #hint_html_options, #hint_tag, #hint_text
Methods included from Components::Errors
#error, #error_html_options, #error_tag, #error_text
Constructor Details
#initialize(builder) ⇒ Base
Returns a new instance of Base.
20 21 22 |
# File 'lib/simple_form/inputs/base.rb', line 20 def initialize(builder) @builder = builder end |
Instance Method Details
#input ⇒ Object
24 25 26 |
# File 'lib/simple_form/inputs/base.rb', line 24 def input raise NotImplementedError end |
#input_html_options ⇒ Object
32 33 34 |
# File 'lib/simple_form/inputs/base.rb', line 32 def (:input, input_type, required_class) end |
#input_options ⇒ Object
28 29 30 |
# File 'lib/simple_form/inputs/base.rb', line 28 def end |
#render ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'lib/simple_form/inputs/base.rb', line 36 def render content = SimpleForm.components.map do |component| next if [component] == false send(component) end content.compact! wrap(content.join.html_safe).html_safe end |