Class: Bs5::ButtonToComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Bs5::ButtonToComponent
- Includes:
- ActiveModel::Validations
- Defined in:
- app/components/bs5/button_to_component.rb
Constant Summary collapse
- STYLES =
%i[primary secondary success danger warning info light dark link].freeze
- DEFAULT_COLOR =
:primary
- SIZES =
{ small: :sm, large: :lg }.freeze
- CLASS_PREFIX =
'btn'
Instance Attribute Summary collapse
-
#size ⇒ Object
readonly
Returns the value of attribute size.
Instance Method Summary collapse
- #before_render ⇒ Object
- #call ⇒ Object
-
#initialize(name = nil, options = nil, html_options = nil) ⇒ ButtonToComponent
constructor
A new instance of ButtonToComponent.
Constructor Details
#initialize(name = nil, options = nil, html_options = nil) ⇒ ButtonToComponent
Returns a new instance of ButtonToComponent.
16 17 18 19 20 21 22 23 24 |
# File 'app/components/bs5/button_to_component.rb', line 16 def initialize(name = nil, = nil, = nil) @name = name @options = @html_options = end |
Instance Attribute Details
#size ⇒ Object (readonly)
Returns the value of attribute size.
10 11 12 |
# File 'app/components/bs5/button_to_component.rb', line 10 def size @size end |
Instance Method Details
#before_render ⇒ Object
26 27 28 |
# File 'app/components/bs5/button_to_component.rb', line 26 def before_render raise errors..to_sentence if invalid? end |
#call ⇒ Object
30 31 32 33 34 35 36 |
# File 'app/components/bs5/button_to_component.rb', line 30 def call if content (@name, @options, @html_options) { content } else (@name, @options, @html_options) end end |