Class: RailsBootstrapHelpers::Renderers::ButtonRenderer
- Inherits:
-
AbstractLinkRenderer
- Object
- Renderer
- AbstractLinkRenderer
- RailsBootstrapHelpers::Renderers::ButtonRenderer
- Includes:
- Helpers::BaseHelper
- Defined in:
- lib/rails-bootstrap-helpers/renderers/button_renderer.rb
Instance Attribute Summary
Attributes inherited from Renderer
Instance Method Summary collapse
Methods included from Helpers::BaseHelper
Methods included from Helpers::OptionsHelper
Methods inherited from AbstractLinkRenderer
Methods inherited from Renderer
Constructor Details
This class inherits a constructor from RailsBootstrapHelpers::Renderers::AbstractLinkRenderer
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class RailsBootstrapHelpers::Renderers::Renderer
Instance Method Details
#render ⇒ Object
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 35 36 |
# File 'lib/rails-bootstrap-helpers/renderers/button_renderer.rb', line 5 def render append_class "btn" if (style = has_option?("style")) && style != "default" 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 + " " + icon(*icon_args) else self.text = icon(*icon_args) + " " + self.text.to_s end self.text = self.text.html_safe else end super end |