Module: RailsBootstrapHelpers::Helpers::ButtonHelper
- Defined in:
- lib/rails-bootstrap-helpers/helpers/button_helper.rb
Instance Method Summary collapse
-
#bs_button_to(*args, &block) ⇒ Object
Renders a Bootstrap button.
-
#bs_inline_button_to(url, icon, options = {}) ⇒ Object
Renders an inline Bootstrap button.
-
#bs_popover_button(name, content_or_options = nil, options = {}, &block) ⇒ Object
Renders a Bootstrap button with a popover.
Instance Method Details
#bs_button_to(*args, &block) ⇒ Object
Renders a Bootstrap button. This method behaves just as “link_to” but will render a Bootstrap button instead of a regular link. Note that this is still an “a” tag and not an “input” tag. In addition to the options “link_to” handles this method also handles the following options:
Options
15 16 17 |
# File 'lib/rails-bootstrap-helpers/helpers/button_helper.rb', line 15 def (*args, &block) RailsBootstrapHelpers::Renderers::ButtonRenderer.new(self, :link, *args, &block).render end |
#bs_inline_button_to(url, icon, options = {}) ⇒ Object
Renders an inline Bootstrap button. That is, a small button having only an icon and no text.
27 28 29 30 |
# File 'lib/rails-bootstrap-helpers/helpers/button_helper.rb', line 27 def (url, icon, = {}) = .reverse_merge icon: icon, size: "mini" RailsBootstrapHelpers::Renderers::ButtonRenderer.new(self, :link, nil, url, ).render end |
#bs_popover_button(name, content_or_options = nil, options = {}, &block) ⇒ Object
Renders a Bootstrap button with a popover.
Options
42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/rails-bootstrap-helpers/helpers/button_helper.rb', line 42 def (name, = nil, = {}, &block) if block_given? (name, capture(&block).gsub("\n", ""), || {}) else placement = .delete(:placement) || "bottom" = .reverse_merge :"data-content" => , :"data-toggle" => "popover", :"data-placement" => placement (name, '#', ) end end |