Class: RailsBootstrapHelpers::Renderers::ButtonRenderer
- Inherits:
-
AbstractButtonRenderer
- Object
- Renderer
- AbstractButtonRenderer
- RailsBootstrapHelpers::Renderers::ButtonRenderer
- Defined in:
- lib/rails-bootstrap-helpers/renderers/button_renderer.rb
Instance Attribute Summary
Attributes inherited from Renderer
Instance Method Summary collapse
Methods inherited from AbstractButtonRenderer
Methods inherited from Renderer
Constructor Details
This class inherits a constructor from RailsBootstrapHelpers::Renderers::AbstractButtonRenderer
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class RailsBootstrapHelpers::Renderers::Renderer
Instance Method Details
#render ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/rails-bootstrap-helpers/renderers/button_renderer.rb', line 3 def render append_class "btn" if style = has_option?("style") append_class "btn-" + style.to_s end if size = has_option?("size") append_class "btn-" + size.to_s end if disabled = has_option?("disabled") append_class "disabled" end if icon = has_option?("icon") pos = has_option?("icon_position") icon_args = [icon, invert: has_option?("icon_invert")] if pos.to_s == "right" self.text = self.text.to_s + " " + RailsBootstrapHelpers::Helpers::BaseHelper.icon(*icon_args) else self.text = RailsBootstrapHelpers::Helpers::BaseHelper.icon(*icon_args) + " " + self.text.to_s end self.text = self.text.html_safe else end super end |