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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0dc36c2542ff2a2ab79117d29f5c59b6805c1a63
|
4
|
+
data.tar.gz: 09b3a68aa70b938572d91db608db093927828e2e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
14
|
+
concat(draw_button(*button))
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
-
def button(
|
21
|
-
@buttons <<
|
20
|
+
def button(*args)
|
21
|
+
@buttons << args
|
22
22
|
nil
|
23
23
|
end
|
24
24
|
|
25
25
|
private
|
26
26
|
|
27
|
-
def draw_button(
|
28
|
-
|
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
|
@@ -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)
|