Class: Yattho::Forms::Button
- Inherits:
-
BaseComponent
- Object
- BaseComponent
- Yattho::Forms::Button
- Defined in:
- lib/yattho/forms/button.rb
Overview
:nodoc:
Defined Under Namespace
Modules: ButtonAttributeGenerator
Instance Attribute Summary
Attributes included from ActsAsComponent
Instance Method Summary collapse
-
#initialize(input:, type: :button) ⇒ Button
constructor
A new instance of Button.
- #input_arguments ⇒ Object
Methods inherited from BaseComponent
#content, inherited, #input?, #perform_render, #render?, #to_component, #type
Methods included from ActsAsComponent
#compile!, extended, #renders_templates
Methods included from ClassNameHelper
Constructor Details
#initialize(input:, type: :button) ⇒ Button
Returns a new instance of Button.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/yattho/forms/button.rb', line 33 def initialize(input:, type: :button) @input = input @type = type @input.add_input_classes("FormField-input flex-self-start") @input.merge_input_arguments!(tag_attributes.deep_symbolize_keys) # rails uses a string for this, but YVC wants a symbol @input.merge_input_arguments!(type: type.to_sym) # Never disable buttons. This overrides the global # ActionView::Base.automatically_disable_submit_tag setting. # Disabling buttons is not accessible. @input.remove_input_data(:disable_with) end |
Instance Method Details
#input_arguments ⇒ Object
49 50 51 52 53 54 |
# File 'lib/yattho/forms/button.rb', line 49 def input_arguments @input_arguments ||= @input.input_arguments.deep_dup.tap do |args| # rails uses :class but YVC wants :classes args[:classes] = args.delete(:class) end end |