Class: InputComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- InputComponent
- Includes:
- Alveole::Concerns::Bem
- Defined in:
- lib/alveole/components/input_component.rb
Constant Summary collapse
- MODIFIERS =
%i[disabled error].freeze
Instance Method Summary collapse
-
#initialize(type: nil, label: nil, value: nil, form: nil, fieldname: nil, collection: nil, modifiers: [], options: {}) ⇒ InputComponent
constructor
A new instance of InputComponent.
Methods included from Alveole::Concerns::Bem
Constructor Details
#initialize(type: nil, label: nil, value: nil, form: nil, fieldname: nil, collection: nil, modifiers: [], options: {}) ⇒ InputComponent
Returns a new instance of InputComponent.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/alveole/components/input_component.rb', line 6 def initialize(type: nil, label: nil, value: nil, form: nil, fieldname: nil, collection: nil, modifiers: [], options: {}) super @label = label @form = form @fieldname = fieldname @collection = collection @options = @options[:value] = value if value @type = type || :text @error_message = modifiers << :error if error? modifiers << :disabled if [:disabled] self.modifiers = modifiers end |