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

Methods included from OptionHelpers

#append_css_class

Instance Method Details

#button(url = nil, options = {}) ⇒ Object



23
24
25
26
# File 'lib/bootstrap_help/button_helpers.rb', line 23

def button(url=nil, options={})
  @buttons << { url: url, options: 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 button_toolbar(&block)
  @buttons = []
  block.call
   :div, class: "btn-toolbar" do
     :div, class: "btn-group" do
      @buttons.each do |button|
        concat(toolbar_button_to(nil, button[:url], button[: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 primary_button_to(name=nil, url=nil, options={})
  button_options = append_css_class("btn btn-primary", options)
  draw_button(name, url, button_options)
end

#toolbar_button_to(name = nil, url = nil, options = {}) ⇒ Object



33
34
35
36
# File 'lib/bootstrap_help/button_helpers.rb', line 33

def toolbar_button_to(name=nil, url=nil, options={})
  button_options = append_css_class("btn", options)
  draw_button(nil, url, button_options)
end