bootstrap_help 0.0.23 → 0.0.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 75126011c7ddf66d689e4e6a6066212f946d10cb
4
- data.tar.gz: 3354ae06e4372efa6d96090389ddddda5f6b15e7
3
+ metadata.gz: 0dc36c2542ff2a2ab79117d29f5c59b6805c1a63
4
+ data.tar.gz: 09b3a68aa70b938572d91db608db093927828e2e
5
5
  SHA512:
6
- metadata.gz: c8e7e30ccd5c11fcc1f88db3ff13fa100aa88399a426e385aef7e87d35810422b82d4d26a82e7bc04a633b09566825b8a83d6731a77a2bc5d8df7ee31ec72fd8
7
- data.tar.gz: d2da5818465674520b8058d1c53ee993a67df8d4c26db09e393a3a69ffbac703064226a9ef88ed5b9728a3e6da7de05371ed4f4ccf0c5f7878ddedba36b28a8d
6
+ metadata.gz: 356b0c3c823c7f9769dde05f22449fc42b84b71d3e0091fbf30e4bb229ceffc1732b42686f07782e03665a23d9d88e3747d0f75f2bf506d8990ccc6af7ee4377
7
+ data.tar.gz: 172d12d6cffbf092ff00ae6bab55da7e9209571c33ece8d1e67a8963bd942510301f59a2be08094f99714f132a19f62833bbd0e2e61f188413bac6faca2059f7
@@ -11,21 +11,25 @@ module BootstrapHelp
11
11
  content_tag :div, class: "btn-toolbar" do
12
12
  content_tag :div, class: "btn-group" do
13
13
  @buttons.each do |button|
14
- concat(draw_button(button[:icon_suffix], button[:options]))
14
+ concat(draw_button(*button))
15
15
  end
16
16
  end
17
17
  end
18
18
  end
19
19
 
20
- def button(icon_suffix, options)
21
- @buttons << {icon_suffix: icon_suffix, options: options}
20
+ def button(*args)
21
+ @buttons << args
22
22
  nil
23
23
  end
24
24
 
25
25
  private
26
26
 
27
- def draw_button(icon_suffix, options)
28
- link_to options, class: "btn" do
27
+ def draw_button(*args)
28
+ icon_suffix = args.first
29
+ options = args[1] || {}
30
+ html_options = args[2] || {}
31
+ html_options.merge!(class: "btn")
32
+ link_to options, html_options do
29
33
  content_tag :i, nil, class: "icon-#{icon_suffix}"
30
34
  end
31
35
  end
@@ -57,7 +57,7 @@ module BootstrapHelp
57
57
 
58
58
  def parse_column(column, item)
59
59
  if column[:block].present?
60
- output = capture(&column[:block])
60
+ output = capture(item, &column[:block])
61
61
  else
62
62
  output = item.send(column.fetch(:value))
63
63
  end
@@ -1,3 +1,3 @@
1
1
  module BootstrapHelp
2
- VERSION = "0.0.23"
2
+ VERSION = "0.0.24"
3
3
  end
@@ -10,11 +10,12 @@ describe BootstrapHelp::ButtonHelpers do
10
10
 
11
11
  describe '#table_for' do
12
12
  it 'returns a bootstrap table for a given collection' do
13
- expected_result = "<div class=\"btn-toolbar\"><div class=\"btn-group\"><a class=\"btn\" href=\"/test\"><i class=\"icon-edit\"></i></a><a class=\"btn\" href=\"/test-again\"><i class=\"icon-new\"></i></a></div></div>"
13
+ expected_result = "<div class=\"btn-toolbar\"><div class=\"btn-group\"><a class=\"btn\" href=\"/test\"><i class=\"icon-edit\"></i></a><a class=\"btn\" href=\"/test-again\"><i class=\"icon-new\"></i></a><a class=\"btn\" data-method=\"delete\" href=\"/test-again\" rel=\"nofollow\"><i class=\"icon-new\"></i></a></div></div>"
14
14
 
15
15
  block = Proc.new {
16
16
  helpers.button 'edit', "/test"
17
17
  helpers.button 'new', "/test-again"
18
+ helpers.button 'new', "/test-again", method: :delete
18
19
  }
19
20
 
20
21
  expect(helpers.button_toolbar(&block)).to eq(expected_result)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootstrap_help
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.23
4
+ version: 0.0.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Klina