Class: Bootstrap::ViewHelpers::Components::Button
- Inherits:
-
Bootstrap::ViewHelpers::Component
- Object
- Bootstrap::ViewHelpers::Component
- Bootstrap::ViewHelpers::Components::Button
- Defined in:
- lib/bootstrap/view_helpers/components/button.rb,
lib/bootstrap/view_helpers/components/button/link.rb,
lib/bootstrap/view_helpers/components/button/close.rb,
lib/bootstrap/view_helpers/components/button/radio.rb,
lib/bootstrap/view_helpers/components/button/checkbox.rb,
lib/bootstrap/view_helpers/components/button/button_type_not_found_error.rb
Direct Known Subclasses
Defined Under Namespace
Classes: ButtonTypeNotFoundError, Checkbox, Close, Link, Radio
Constant Summary collapse
- TYPES =
{ button: Button, checkbox: Button::Checkbox, close: Button::Close, link: Button::Link, radio: Button::Radio }
Instance Attribute Summary
Attributes inherited from Bootstrap::ViewHelpers::Component
#block, #options, #style, #view
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Bootstrap::ViewHelpers::Component
Constructor Details
This class inherits a constructor from Bootstrap::ViewHelpers::Component
Class Method Details
.build(view_context, options, &block) ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/bootstrap/view_helpers/components/button.rb', line 21 def build(view_context, , &block) type = .delete(:type) || defaults[:type] [:type] = [:html_type] unless TYPES.keys.include? type raise ButtonTypeNotFoundError, type end TYPES[type].new(view_context, , &block) end |
Instance Method Details
#to_html ⇒ Object
37 38 39 |
# File 'lib/bootstrap/view_helpers/components/button.rb', line 37 def to_html content_tag(:button, label, ) end |