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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a78583ac96350dc0cacde6ccc112ab5fe60f5eb9
4
- data.tar.gz: 9740021cdcb456c8de06868f9235be530fa440a9
3
+ metadata.gz: e54b2809c56183ee640f23008dee344b971d2d95
4
+ data.tar.gz: beaa6fc8f9903013ea325b254b88a76a36d0da25
5
5
  SHA512:
6
- metadata.gz: f451d062c0be2f351fb9f51c6e00abd103f40f1397fbf7fa70894bfaec0325023f4a8a5e84852b2a9848bf25039d3d33aaba3809a53644914c0ec9ff9db58149
7
- data.tar.gz: 559f63bf403b3f8ba363cb1ca75f372ba7829e2b7f23e92ef608d6cfb566503f125523a1bcfdc13f3d07b30a7fc6e22033eda880be0f13a0526ded456b2840f5
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
- = dropdown_menu "My Menu" do
28
- = dropdown_item "Link1", "#"
29
- = dropdown_item "Link2", "#"
30
- = dropdown_item "Link3", "#"
31
- = dropdown_divider
32
- = dropdown_item "Link4", "#"
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(content_tag(:div, class: 'nav') { yield })
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 dropdown_item(value, url)
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
@@ -1,3 +1,3 @@
1
1
  module BootstrapHelp
2
- VERSION = "0.0.11"
2
+ VERSION = "0.0.12"
3
3
  end
@@ -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><div class=\"nav\">block content</div></div></div></div>"
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 '#dropdown_item' do
41
- it 'returns a bootstrap dropdown item with the provided value and url' do
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.dropdown_item('test', '#')).to eq(result)
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
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.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Klina