rails_bootstrap_navbar 0.1.0.beta → 0.1.1.beta
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/.travis.yml +4 -0
- data/CHANGELOG.md +10 -1
- data/README.md +67 -68
- data/lib/rails_bootstrap_navbar/version.rb +1 -1
- data/lib/rails_bootstrap_navbar/view_helpers.rb +8 -0
- data/rails_bootstrap_navbar.gemspec +2 -0
- metadata +18 -6
data/.gitignore
CHANGED
data/.travis.yml
ADDED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# RailsBootstrapNavbar
|
1
|
+
# RailsBootstrapNavbar [![Build Status](https://secure.travis-ci.org/julescopeland/Rails-Bootstrap-Navbar.png?branch=master)](http://travis-ci.org/julescopeland/Rails-Bootstrap-Navbar)
|
2
2
|
|
3
3
|
The idea behind this gem is to make a really easy to use DSL for writing navbars for your rails apps, assuming you're already using Twitter Bootstrap >= 2.0 and Erb (It shouldn't make any difference how you ultimately get bootstrap into your app - i.e. through the sass-bootstrap gem, manually downloading the complied source, magic, whatever...). Just remember to include the javascript if you want things like dropdowns or responsive layouts.
|
4
4
|
|
@@ -8,9 +8,8 @@ Add this line to your application's Gemfile:
|
|
8
8
|
|
9
9
|
gem 'rails_bootstrap_navbar'
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
...
|
11
|
+
|
12
|
+
You need some form of Twitter bootstrap integration as well (I use Thomas McDonald's excellent [bootstrap-sass](https://github.com/thomas-mcdonald))
|
14
13
|
|
15
14
|
And then execute:
|
16
15
|
|
@@ -26,7 +25,7 @@ This gem aims to automate all of the features currently mentioned on the [twitte
|
|
26
25
|
|
27
26
|
It should let you write things like:
|
28
27
|
|
29
|
-
````
|
28
|
+
````
|
30
29
|
<%= nav_bar :fixed => :top, :brand => "Fashionable Clicheizr 2.0", :responsive => true do %>
|
31
30
|
<%= menu_group do %>
|
32
31
|
<%= menu_item "Home", root_path %>
|
@@ -60,104 +59,104 @@ It should let you write things like:
|
|
60
59
|
|
61
60
|
In your view file (most likely application.html.erb) to get a basic navbar set up you need to do this:
|
62
61
|
|
63
|
-
````
|
62
|
+
````
|
64
63
|
<%= nav_bar %>
|
65
64
|
````
|
66
65
|
|
67
66
|
Which will render:
|
68
|
-
|
69
|
-
<div class="navbar">
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
</div>
|
75
|
-
|
67
|
+
|
68
|
+
<div class="navbar">
|
69
|
+
<div class="navbar-inner">
|
70
|
+
<div class="container">
|
71
|
+
</div>
|
72
|
+
</div>
|
73
|
+
</div>
|
74
|
+
|
76
75
|
|
77
76
|
### Fixed navbar
|
78
77
|
|
79
78
|
If you want the navbar to stick to the top or the bottom of the screen, pass in the option like this:
|
80
79
|
|
81
|
-
````
|
80
|
+
````
|
82
81
|
<%= nav_bar :fixed => :top %>
|
83
82
|
````
|
84
83
|
|
85
84
|
Or
|
86
85
|
|
87
|
-
````
|
86
|
+
````
|
88
87
|
<%= nav_bar :fixed => :top %>
|
89
88
|
````
|
90
89
|
|
91
90
|
To render:
|
92
|
-
|
93
|
-
<div class="navbar navbar-fixed-top">
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
</div>
|
99
|
-
|
91
|
+
|
92
|
+
<div class="navbar navbar-fixed-top">
|
93
|
+
<div class="navbar-inner">
|
94
|
+
<div class="container">
|
95
|
+
</div>
|
96
|
+
</div>
|
97
|
+
</div>
|
98
|
+
|
100
99
|
|
101
100
|
Or
|
102
101
|
|
103
|
-
|
104
|
-
<div class="navbar navbar-fixed-bottom">
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
</div>
|
110
|
-
|
102
|
+
|
103
|
+
<div class="navbar navbar-fixed-bottom">
|
104
|
+
<div class="navbar-inner">
|
105
|
+
<div class="container">
|
106
|
+
</div>
|
107
|
+
</div>
|
108
|
+
</div>
|
109
|
+
|
111
110
|
|
112
111
|
|
113
112
|
### Brand name
|
114
113
|
|
115
114
|
Add the name of your site on the left hand edge of the navbar. At the moment, it will only link to root_url
|
116
115
|
|
117
|
-
````
|
116
|
+
````
|
118
117
|
<%= nav_bar :brand => "We're sooo web 2.0alizr" %>
|
119
118
|
````
|
120
119
|
|
121
120
|
Which will render:
|
122
|
-
|
123
|
-
<div class="navbar">
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
</div>
|
132
|
-
|
121
|
+
|
122
|
+
<div class="navbar">
|
123
|
+
<div class="navbar-inner">
|
124
|
+
<div class="container">
|
125
|
+
<a class="brand" href="/">
|
126
|
+
We're sooo web 2.0alizr
|
127
|
+
</a>
|
128
|
+
</div>
|
129
|
+
</div>
|
130
|
+
</div>
|
131
|
+
|
133
132
|
|
134
133
|
### Optional responsive variation
|
135
134
|
|
136
135
|
If you want the responsive version of the navbar to work (One that shrinks down on mobile devices etc.), you need to pass this option:
|
137
136
|
|
138
|
-
````
|
137
|
+
````
|
139
138
|
<%= nav_bar :responsive => true %>
|
140
139
|
````
|
141
140
|
Which renders the html quite differently:
|
142
141
|
|
143
|
-
|
144
|
-
<div class="navbar">
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
</div>
|
160
|
-
|
142
|
+
|
143
|
+
<div class="navbar">
|
144
|
+
<div class="navbar-inner">
|
145
|
+
<div class="container">
|
146
|
+
<!-- .btn-navbar is used as the toggle for collapsed navbar content -->
|
147
|
+
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
|
148
|
+
<span class="icon-bar"></span>
|
149
|
+
<span class="icon-bar"></span>
|
150
|
+
<span class="icon-bar"></span>
|
151
|
+
</a>
|
152
|
+
<!-- Everything in here gets hidden at 940px or less -->
|
153
|
+
<div class="nav-collapse">
|
154
|
+
<!-- menu items gets rendered here instead -->
|
155
|
+
</div>
|
156
|
+
</div>
|
157
|
+
</div>
|
158
|
+
</div>
|
159
|
+
|
161
160
|
|
162
161
|
### Nav links
|
163
162
|
|
@@ -167,7 +166,7 @@ You can group menu items in theoretical boxes which you can apply logic to - e.g
|
|
167
166
|
|
168
167
|
The active menu item will be inferred from the link for now.
|
169
168
|
|
170
|
-
````
|
169
|
+
````
|
171
170
|
<%= nav_bar :fixed => :top, :brand => "Ninety Ten" do %>
|
172
171
|
<% menu_group do %>
|
173
172
|
<%= menu_item "Home", root_path %>
|
@@ -193,7 +192,7 @@ The active menu item will be inferred from the link for now.
|
|
193
192
|
|
194
193
|
For multi-level list options, where it makes logical sense to group menu items, or simply to save space if you have a lot of pages, you can group menu items into drop down lists like this:
|
195
194
|
|
196
|
-
````
|
195
|
+
````
|
197
196
|
<%= nav_bar do %>
|
198
197
|
<%= menu_item "Home", root_path %>
|
199
198
|
|
@@ -212,7 +211,7 @@ For multi-level list options, where it makes logical sense to group menu items,
|
|
212
211
|
|
213
212
|
Dividers are just vertical bars that visually separate logically disparate groups of menu items
|
214
213
|
|
215
|
-
````
|
214
|
+
````
|
216
215
|
<%= nav_bar :fixed => :bottom do %>
|
217
216
|
<%= menu_item "Home", root_path %>
|
218
217
|
<%= menu_item "About Us", about_us_path %>
|
@@ -256,7 +255,7 @@ To change the size of the form fields, use .span2 (or however many span widths y
|
|
256
255
|
|
257
256
|
You can shift things to the left or the right across the nav bar. It's easiest to do this on grouped menu items:
|
258
257
|
|
259
|
-
````
|
258
|
+
````
|
260
259
|
<%= nav_bar :fixed => :bottom do %>
|
261
260
|
<% menu_group do %>
|
262
261
|
<%= menu_item "Home", root_path %>
|
@@ -275,7 +274,7 @@ You can shift things to the left or the right across the nav bar. It's easiest t
|
|
275
274
|
|
276
275
|
If you want to put regualr plain text in the navbar anywhere, you do it like this:
|
277
276
|
|
278
|
-
````
|
277
|
+
````
|
279
278
|
<%= nav_bar :brand => "Apple" do %>
|
280
279
|
<%= menu_text "We make shiny things" %>
|
281
280
|
<%= menu_item "Home", root_path %>
|
@@ -30,6 +30,14 @@ module RailsBootstrapNavbar
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
+
def drop_down_divider
|
34
|
+
content_tag :li, "", :class => "divider"
|
35
|
+
end
|
36
|
+
|
37
|
+
def drop_down_header(text)
|
38
|
+
content_tag :li, text, :class => "nav-header"
|
39
|
+
end
|
40
|
+
|
33
41
|
def menu_divider
|
34
42
|
content_tag :li, "", :class => "divider-vertical"
|
35
43
|
end
|
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.1.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-23 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70170647525700 !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: *70170647525700
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rake
|
27
|
-
requirement: &
|
27
|
+
requirement: &70170647525080 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,18 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70170647525080
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rails
|
38
|
+
requirement: &70170647524460 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 3.0.0
|
44
|
+
type: :runtime
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *70170647524460
|
36
47
|
description: A helper method for easy generation of Twitter Bootstrap Navigation menus
|
37
48
|
in Rails
|
38
49
|
email:
|
@@ -43,6 +54,7 @@ extra_rdoc_files: []
|
|
43
54
|
files:
|
44
55
|
- .gitignore
|
45
56
|
- .rspec
|
57
|
+
- .travis.yml
|
46
58
|
- CHANGELOG.md
|
47
59
|
- Gemfile
|
48
60
|
- LICENSE
|