Class: Bs5::ButtonTagComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Bs5::ButtonTagComponent
- Includes:
- ActiveModel::Validations
- Defined in:
- app/components/bs5/button_tag_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
-
#content_or_options ⇒ Object
readonly
Returns the value of attribute content_or_options.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
Instance Method Summary collapse
- #before_render ⇒ Object
- #call ⇒ Object
-
#initialize(content_or_options = nil, options = nil) ⇒ ButtonTagComponent
constructor
A new instance of ButtonTagComponent.
Constructor Details
#initialize(content_or_options = nil, options = nil) ⇒ ButtonTagComponent
Returns a new instance of ButtonTagComponent.
16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/components/bs5/button_tag_component.rb', line 16 def initialize( = nil, = nil) if .is_a? Hash self. = else @content_or_options = self. = end end |
Instance Attribute Details
#content_or_options ⇒ Object (readonly)
Returns the value of attribute content_or_options.
10 11 12 |
# File 'app/components/bs5/button_tag_component.rb', line 10 def @content_or_options end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
10 11 12 |
# File 'app/components/bs5/button_tag_component.rb', line 10 def size @size end |
Instance Method Details
#before_render ⇒ Object
28 29 30 |
# File 'app/components/bs5/button_tag_component.rb', line 28 def before_render raise errors..to_sentence if invalid? end |
#call ⇒ Object
32 33 34 |
# File 'app/components/bs5/button_tag_component.rb', line 32 def call (content || , ) end |