rails_bootstrap_navbar 0.1.3.beta → 0.1.4.beta
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.
data/CHANGELOG.md
CHANGED
@@ -13,4 +13,12 @@ These allow you to add dividers and headers into your dropdowns. Surprisingly en
|
|
13
13
|
|
14
14
|
## v0.1.2.beta
|
15
15
|
|
16
|
-
* Allow options for menu_items to pass through to link_to, so that you can set IDs, classes, method, data-tags etc.
|
16
|
+
* Allow options for menu_items to pass through to link_to, so that you can set IDs, classes, method, data-tags etc.
|
17
|
+
|
18
|
+
## v0.1.3.beta
|
19
|
+
|
20
|
+
* Made the menu_text feature work properly (it was missing a css class). Also added the ability to pull it left or right.
|
21
|
+
|
22
|
+
## v0.1.4.beta
|
23
|
+
|
24
|
+
* Added ability to change the link for the brand text
|
data/README.md
CHANGED
@@ -75,13 +75,7 @@ Which will render:
|
|
75
75
|
|
76
76
|
### Fixed navbar
|
77
77
|
|
78
|
-
If you want the navbar to stick to the top
|
79
|
-
|
80
|
-
````
|
81
|
-
<%= nav_bar :fixed => :top %>
|
82
|
-
````
|
83
|
-
|
84
|
-
Or
|
78
|
+
If you want the navbar to stick to the top of the screen, pass in the option like this:
|
85
79
|
|
86
80
|
````
|
87
81
|
<%= nav_bar :fixed => :top %>
|
@@ -97,24 +91,12 @@ To render:
|
|
97
91
|
</div>
|
98
92
|
|
99
93
|
|
100
|
-
Or
|
101
|
-
|
102
|
-
|
103
|
-
<div class="navbar navbar-fixed-bottom">
|
104
|
-
<div class="navbar-inner">
|
105
|
-
<div class="container">
|
106
|
-
</div>
|
107
|
-
</div>
|
108
|
-
</div>
|
109
|
-
|
110
|
-
|
111
|
-
|
112
94
|
### Brand name
|
113
95
|
|
114
|
-
Add the name of your site on the left hand edge of the navbar.
|
96
|
+
Add the name of your site on the left hand edge of the navbar. By default, it will link to root_url. Passing a brand_link option will set the url to whatever you want.
|
115
97
|
|
116
98
|
````
|
117
|
-
<%= nav_bar :brand => "We're sooo web 2.0alizr" %>
|
99
|
+
<%= nav_bar :brand => "We're sooo web 2.0alizr", :brand_link => account_dashboard_path %>
|
118
100
|
````
|
119
101
|
|
120
102
|
Which will render:
|
@@ -122,7 +104,7 @@ Which will render:
|
|
122
104
|
<div class="navbar">
|
123
105
|
<div class="navbar-inner">
|
124
106
|
<div class="container">
|
125
|
-
<a class="brand" href="/">
|
107
|
+
<a class="brand" href="/accounts/dashboard">
|
126
108
|
We're sooo web 2.0alizr
|
127
109
|
</a>
|
128
110
|
</div>
|
@@ -6,7 +6,7 @@ module RailsBootstrapNavbar
|
|
6
6
|
def nav_bar(options={}, &block)
|
7
7
|
nav_bar_div(options[:fixed]) do
|
8
8
|
navbar_inner_div do
|
9
|
-
container_div(options[:brand], options[:responsive], options[:fluid]) do
|
9
|
+
container_div(options[:brand], options[:brand_link], options[:responsive], options[:fluid]) do
|
10
10
|
yield if block_given?
|
11
11
|
end
|
12
12
|
end
|
@@ -67,20 +67,20 @@ module RailsBootstrapNavbar
|
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
70
|
-
def container_div(brand, responsive, fluid, &block)
|
70
|
+
def container_div(brand, brand_link, responsive, fluid, &block)
|
71
71
|
content_tag :div, :class => "container#{"-fluid" if fluid}" do
|
72
|
-
container_div_with_block(brand, responsive, &block)
|
72
|
+
container_div_with_block(brand, brand_link, responsive, &block)
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
76
|
-
def container_div_with_block(brand, responsive, &block)
|
76
|
+
def container_div_with_block(brand, brand_link, responsive, &block)
|
77
77
|
output = []
|
78
78
|
if responsive == true
|
79
79
|
output << responsive_button
|
80
|
-
output << brand_link(brand)
|
80
|
+
output << brand_link(brand, brand_link)
|
81
81
|
output << responsive_div {capture(&block)}
|
82
82
|
else
|
83
|
-
output << brand_link(brand)
|
83
|
+
output << brand_link(brand, brand_link)
|
84
84
|
output << capture(&block)
|
85
85
|
end
|
86
86
|
output.join("\n").html_safe
|
@@ -92,9 +92,10 @@ module RailsBootstrapNavbar
|
|
92
92
|
css_class.join(" ")
|
93
93
|
end
|
94
94
|
|
95
|
-
def brand_link(name)
|
95
|
+
def brand_link(name, url)
|
96
96
|
return "" if name.blank?
|
97
|
-
|
97
|
+
url ||= root_url
|
98
|
+
link_to(name, url, :class => "brand")
|
98
99
|
end
|
99
100
|
|
100
101
|
def responsive_button
|
@@ -8,7 +8,10 @@ include ActionView::Helpers
|
|
8
8
|
include ActionView::Context
|
9
9
|
|
10
10
|
describe RailsBootstrapNavbar::ViewHelpers, :type => :helper do
|
11
|
-
before
|
11
|
+
before do
|
12
|
+
self.stub!("current_page?").and_return(false)
|
13
|
+
self.stub!("root_url").and_return("/")
|
14
|
+
end
|
12
15
|
describe "nav_bar" do
|
13
16
|
it "should return a basic bootstrap navbar" do
|
14
17
|
nav_bar.gsub(/\s/,'').downcase.should eql(BASIC_NAVBAR.gsub(/\s/,'').downcase)
|
@@ -26,6 +29,11 @@ describe RailsBootstrapNavbar::ViewHelpers, :type => :helper do
|
|
26
29
|
nav_bar(:brand => "Ninety Ten").gsub(/\s/,'').downcase.should eql(NAVBAR_WITH_BRAND.gsub(/\s/,'').downcase)
|
27
30
|
end
|
28
31
|
|
32
|
+
it "should be able to set the brand link url" do
|
33
|
+
nav_bar(:brand => "Ninety Ten", :brand_link => "http://www.ninetyten.com").gsub(/\s/,'').downcase.should eql(
|
34
|
+
NAVBAR_WITH_BRAND_AND_LINK.gsub(/\s/,'').downcase)
|
35
|
+
end
|
36
|
+
|
29
37
|
it "should set the container to fluid" do
|
30
38
|
nav_bar(:fluid => :true).gsub(/\s/,'').downcase.should eql(BASIC_NAVBAR_FLUID.gsub(/\s/,'').downcase)
|
31
39
|
end
|
@@ -185,6 +193,18 @@ NAVBAR_WITH_BRAND = <<-HTML
|
|
185
193
|
</div>
|
186
194
|
HTML
|
187
195
|
|
196
|
+
NAVBAR_WITH_BRAND_AND_LINK = <<-HTML
|
197
|
+
<div class="navbar">
|
198
|
+
<div class="navbar-inner">
|
199
|
+
<div class="container">
|
200
|
+
<a href="http://www.ninetyten.com" class="brand">
|
201
|
+
Ninety Ten
|
202
|
+
</a>
|
203
|
+
</div>
|
204
|
+
</div>
|
205
|
+
</div>
|
206
|
+
HTML
|
207
|
+
|
188
208
|
RESPONSIVE_NAVBAR = <<-HTML
|
189
209
|
<div class="navbar">
|
190
210
|
<div class="navbar-inner">
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_bootstrap_navbar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4.beta
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-03-
|
12
|
+
date: 2012-03-24 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70221055337840 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70221055337840
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rake
|
27
|
-
requirement: &
|
27
|
+
requirement: &70221055336680 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70221055336680
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rails
|
38
|
-
requirement: &
|
38
|
+
requirement: &70221055335960 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: 3.0.0
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70221055335960
|
47
47
|
description: A helper method for easy generation of Twitter Bootstrap Navigation menus
|
48
48
|
in Rails
|
49
49
|
email:
|