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, BooleanInput, CollectionInput, DateTimeInput, HiddenInput, MappingInput, NumericInput, StringInput
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_classes ⇒ 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_class, #wrapper_error_class, #wrapper_html_options, #wrapper_tag
Methods included from Components::LabelInput
Methods included from Components::Hints
#hint, #hint_html_options, #hint_tag, #hint_text
Methods included from Components::Errors
#error, #error_html_options, #error_method, #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_classes ⇒ Object
36 37 38 |
# File 'lib/simple_form/inputs/base.rb', line 36 def input_html_classes [input_type, required_class] end |
#input_html_options ⇒ Object
32 33 34 |
# File 'lib/simple_form/inputs/base.rb', line 32 def (:input, input_html_classes) end |
#input_options ⇒ Object
28 29 30 |
# File 'lib/simple_form/inputs/base.rb', line 28 def end |
#render ⇒ Object
40 41 42 43 44 45 46 47 |
# File 'lib/simple_form/inputs/base.rb', line 40 def render content = "".html_safe components_list.each do |component| next if [component] == false content.safe_concat send(component).to_s end wrap(content) end |