bootstrap_help 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -6
- data/lib/bootstrap_help/nav_helpers.rb +15 -3
- data/lib/bootstrap_help/version.rb +1 -1
- data/spec/bootstrap_helper/nav_helper_spec.rb +25 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e54b2809c56183ee640f23008dee344b971d2d95
|
4
|
+
data.tar.gz: beaa6fc8f9903013ea325b254b88a76a36d0da25
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1195cde44bcba57eff99bb0a4f0b53cb385de07a1b3f786ccaacd089aee784a27c83544823526a27f60201a67c9d37f66db45cf87bfad3524018d5c21dcd2d5f
|
7
|
+
data.tar.gz: 55dfb7330f4323678455c939fa2d5b02cf4b36eeacbc4d5e0b7bc78178a0543d5688ec11d4c5c2570e772d18abf4571dfea7e26e2bf6a5782146526ba1604214
|
data/README.md
CHANGED
@@ -24,12 +24,15 @@ The Nav Helper helps you quickly build a fixed navigation bar in Bootstrap. For
|
|
24
24
|
|
25
25
|
`
|
26
26
|
= main_nav(brand: "My Awesome Company") do
|
27
|
-
=
|
28
|
-
=
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
27
|
+
= left do
|
28
|
+
= dropdown_menu "My Menu" do
|
29
|
+
= menu_link_to "Link1", "#"
|
30
|
+
= menu_link_to "Link2", "#"
|
31
|
+
= menu_link_to "Link3", "#"
|
32
|
+
= dropdown_divider
|
33
|
+
= menu_link_to "Link4", "#"
|
34
|
+
= right do
|
35
|
+
= menu_link_to "Sign In", "#"
|
33
36
|
`
|
34
37
|
|
35
38
|
## Contributing
|
@@ -15,13 +15,25 @@ module BootstrapHelp
|
|
15
15
|
concat(responsive_menu_variation)
|
16
16
|
concat(link_to(brand, brand_path, class: 'brand'))
|
17
17
|
if block_given?
|
18
|
-
concat(
|
18
|
+
concat(yield)
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
+
def left
|
26
|
+
if block_given?
|
27
|
+
content_tag(:div, class: 'nav') { yield }
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def right
|
32
|
+
if block_given?
|
33
|
+
content_tag(:div, class: 'nav pull-right') { yield }
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
25
37
|
#Dropdown Menus
|
26
38
|
def dropdown_menu(menu_name)
|
27
39
|
|
@@ -32,8 +44,8 @@ module BootstrapHelp
|
|
32
44
|
end
|
33
45
|
|
34
46
|
|
35
|
-
def
|
36
|
-
content_tag(:li, link_to(value, url))
|
47
|
+
def menu_link_to(value, url, args=nil)
|
48
|
+
content_tag(:li, link_to(value, url, args))
|
37
49
|
end
|
38
50
|
|
39
51
|
def dropdown_divider
|
@@ -25,11 +25,25 @@ describe BootstrapHelp::NavHelpers do
|
|
25
25
|
end
|
26
26
|
|
27
27
|
it 'returns a bootstrap top nav bar' do
|
28
|
-
result = "<div class=\"navbar navbar-fixed-top navbar-inverse\"><div class=\"navbar-inner\"><div class=\"container-fluid\"><button class=\"btn btn-navbar\" data-target=\".nav-collapse\" data-toggle=\"collapse\"><span class=\"icon-bar\"></span><span class=\"icon-bar\"></span><span class=\"icon-bar\"></span></button><a class=\"brand\" href=\"/\">Brand</a
|
28
|
+
result = "<div class=\"navbar navbar-fixed-top navbar-inverse\"><div class=\"navbar-inner\"><div class=\"container-fluid\"><button class=\"btn btn-navbar\" data-target=\".nav-collapse\" data-toggle=\"collapse\"><span class=\"icon-bar\"></span><span class=\"icon-bar\"></span><span class=\"icon-bar\"></span></button><a class=\"brand\" href=\"/\">Brand</a>block content</div></div></div>"
|
29
29
|
expect(helpers.main_nav(brand: 'Brand', &block)).to eq(result)
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
+
describe '#left' do
|
34
|
+
it 'returns html that wraps items on the left side of the nav' do
|
35
|
+
result = "<div class=\"nav\">block content</div>"
|
36
|
+
expect(helpers.left(&block)).to eq(result)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
describe '#right' do
|
41
|
+
it 'returns html that wraps items on the right side of the nav' do
|
42
|
+
result = "<div class=\"nav pull-right\">block content</div>"
|
43
|
+
expect(helpers.right(&block)).to eq(result)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
33
47
|
describe '#dropdown_menu' do
|
34
48
|
it 'returns a bootstrap dropdown menu with the provided name' do
|
35
49
|
result = "<li class=\"dropdown\"><a class=\"dropdown-toggle\" data-toggle=\"dropdown\" href=\"#\">test<b class=\"caret\"></b></a><ul class=\"dropdown-menu\">block content</ul></li>"
|
@@ -37,10 +51,10 @@ describe BootstrapHelp::NavHelpers do
|
|
37
51
|
end
|
38
52
|
end
|
39
53
|
|
40
|
-
describe '#
|
41
|
-
it 'returns a bootstrap
|
54
|
+
describe '#menu_link_to' do
|
55
|
+
it 'returns a bootstrap menu link with the provided value and url' do
|
42
56
|
result = "<li><a href=\"#\">test</a></li>"
|
43
|
-
expect(helpers.
|
57
|
+
expect(helpers.menu_link_to('test', '#')).to eq(result)
|
44
58
|
end
|
45
59
|
end
|
46
60
|
|
@@ -50,4 +64,11 @@ describe BootstrapHelp::NavHelpers do
|
|
50
64
|
expect(helpers.dropdown_divider).to eq(result)
|
51
65
|
end
|
52
66
|
end
|
67
|
+
|
68
|
+
describe '#left' do
|
69
|
+
it 'returns markup to align links to the left' do
|
70
|
+
result = "<li class=\"divider\"></li>"
|
71
|
+
expect(helpers.dropdown_divider).to eq(result)
|
72
|
+
end
|
73
|
+
end
|
53
74
|
end
|