Module: BootstrapHelp::ButtonHelpers
- Includes:
- ActionView::Context, ActionView::Helpers::TagHelper, ActionView::Helpers::TextHelper, ActionView::Helpers::UrlHelper, OptionHelpers
- Defined in:
- lib/bootstrap_help/button_helpers.rb
Constant Summary collapse
- BUTTON_OPTIONS =
%i(icon icon_color)
Instance Method Summary collapse
- #button(url = nil, options = {}) ⇒ Object
- #button_toolbar(&block) ⇒ Object
- #primary_button_to(name = nil, url = nil, options = {}) ⇒ Object
- #toolbar_button_to(name = nil, url = nil, options = {}) ⇒ Object
Methods included from OptionHelpers
Instance Method Details
#button(url = nil, options = {}) ⇒ Object
23 24 25 26 |
# File 'lib/bootstrap_help/button_helpers.rb', line 23 def (url=nil, ={}) @buttons << { url: url, options: } nil end |
#button_toolbar(&block) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/bootstrap_help/button_helpers.rb', line 11 def (&block) @buttons = [] block.call content_tag :div, class: "btn-toolbar" do content_tag :div, class: "btn-group" do @buttons.each do || concat((nil, [:url], [:options])) end end end end |
#primary_button_to(name = nil, url = nil, options = {}) ⇒ Object
28 29 30 31 |
# File 'lib/bootstrap_help/button_helpers.rb', line 28 def (name=nil, url=nil, ={}) = append_css_class("btn btn-primary", ) (name, url, ) end |
#toolbar_button_to(name = nil, url = nil, options = {}) ⇒ Object
33 34 35 36 |
# File 'lib/bootstrap_help/button_helpers.rb', line 33 def (name=nil, url=nil, ={}) = append_css_class("btn", ) (nil, url, ) end |