twitter-bootstrap-rails 2.1.7 → 2.2.8
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of twitter-bootstrap-rails might be problematic. Click here for more details.
- data/README.md +428 -21
- data/Rakefile +15 -3
- data/app/assets/fonts/fontawesome-webfont.eot +0 -0
- data/app/assets/fonts/fontawesome-webfont.svg +399 -0
- data/app/assets/fonts/fontawesome-webfont.ttf +0 -0
- data/app/assets/fonts/fontawesome-webfont.woff +0 -0
- data/{vendor → app}/assets/javascripts/twitter/bootstrap/bootstrap-affix.js +12 -1
- data/{vendor → app}/assets/javascripts/twitter/bootstrap/bootstrap-alert.js +12 -1
- data/{vendor → app}/assets/javascripts/twitter/bootstrap/bootstrap-button.js +12 -1
- data/{vendor → app}/assets/javascripts/twitter/bootstrap/bootstrap-carousel.js +42 -11
- data/{vendor → app}/assets/javascripts/twitter/bootstrap/bootstrap-collapse.js +18 -7
- data/{vendor → app}/assets/javascripts/twitter/bootstrap/bootstrap-dropdown.js +32 -11
- data/{vendor → app}/assets/javascripts/twitter/bootstrap/bootstrap-modal.js +25 -12
- data/{vendor → app}/assets/javascripts/twitter/bootstrap/bootstrap-popover.js +17 -6
- data/{vendor → app}/assets/javascripts/twitter/bootstrap/bootstrap-scrollspy.js +13 -2
- data/{vendor → app}/assets/javascripts/twitter/bootstrap/bootstrap-tab.js +12 -1
- data/{vendor → app}/assets/javascripts/twitter/bootstrap/bootstrap-tooltip.js +115 -30
- data/{vendor → app}/assets/javascripts/twitter/bootstrap/bootstrap-transition.js +1 -1
- data/{vendor → app}/assets/javascripts/twitter/bootstrap/bootstrap-typeahead.js +38 -13
- data/app/assets/stylesheets/twitter-bootstrap-static/bootstrap.css.erb +890 -0
- data/app/assets/stylesheets/twitter-bootstrap-static/fontawesome.css.erb +787 -0
- data/{vendor → app}/assets/stylesheets/twitter-bootstrap-static/sprites.css.erb +2 -2
- data/app/helpers/badge_label_helper.rb +16 -0
- data/app/helpers/bootstrap_flash_helper.rb +22 -16
- data/app/helpers/glyph_helper.rb +7 -2
- data/app/helpers/modal_helper.rb +29 -16
- data/app/helpers/navbar_helper.rb +194 -0
- data/app/helpers/twitter_breadcrumbs_helper.rb +7 -2
- data/app/views/twitter-bootstrap/_breadcrumbs.html.erb +2 -2
- data/lib/generators/bootstrap/install/install_generator.rb +19 -6
- data/lib/generators/bootstrap/install/templates/bootstrap.coffee +2 -3
- data/lib/generators/bootstrap/install/templates/bootstrap.js +2 -3
- data/lib/generators/bootstrap/install/templates/bootstrap_and_overrides.less +8 -10
- data/lib/generators/bootstrap/install/templates/en.bootstrap.yml +18 -0
- data/lib/generators/bootstrap/layout/templates/layout.html.erb +10 -12
- data/lib/generators/bootstrap/layout/templates/layout.html.haml +8 -11
- data/lib/generators/bootstrap/layout/templates/layout.html.slim +10 -11
- data/lib/generators/bootstrap/themed/templates/edit.html.erb +1 -2
- data/lib/generators/bootstrap/themed/templates/edit.html.haml +1 -1
- data/lib/generators/bootstrap/themed/templates/edit.html.slim +1 -1
- data/lib/generators/bootstrap/themed/templates/index.html.erb +1 -1
- data/lib/generators/bootstrap/themed/templates/index.html.haml +1 -1
- data/lib/generators/bootstrap/themed/templates/index.html.slim +1 -1
- data/lib/generators/bootstrap/themed/templates/new.html.erb +1 -2
- data/lib/generators/bootstrap/themed/templates/new.html.haml +1 -1
- data/lib/generators/bootstrap/themed/templates/new.html.slim +1 -1
- data/lib/generators/bootstrap/themed/templates/show.html.erb +1 -1
- data/lib/generators/bootstrap/themed/templates/show.html.haml +1 -1
- data/lib/generators/bootstrap/themed/templates/show.html.slim +1 -1
- data/lib/generators/bootstrap/themed/themed_generator.rb +2 -2
- data/lib/twitter/bootstrap/rails/engine.rb +3 -0
- data/lib/twitter/bootstrap/rails/twitter-bootstrap-breadcrumbs.rb +14 -2
- data/lib/twitter/bootstrap/rails/version.rb +2 -2
- data/lib/twitter-bootstrap-rails.rb +4 -4
- data/spec/lib/twitter_bootstrap_rails/badge_label_helper_spec.rb +22 -0
- data/spec/lib/twitter_bootstrap_rails/modal_helper_spec.rb +62 -0
- data/spec/lib/twitter_bootstrap_rails/navbar_helper_spec.rb +362 -0
- data/spec/lib/twitter_bootstrap_rails/uri_state_spec.rb +47 -0
- data/spec/spec_helper.rb +11 -0
- data/test/lib/breadcrumbs_test.rb +75 -0
- data/test/test_helper.rb +11 -0
- data/vendor/assets/stylesheets/twitter-bootstrap-static/bootstrap.css.erb +316 -294
- data/vendor/static-source/fontawesome.less +8 -6
- data/vendor/static-source/sprites.less +3 -2
- data/vendor/toolkit/fontawesome/bootstrap.less +84 -0
- data/vendor/toolkit/fontawesome/core.less +129 -0
- data/vendor/toolkit/fontawesome/extras.less +93 -0
- data/vendor/toolkit/fontawesome/font-awesome-ie7.less +1953 -0
- data/vendor/toolkit/fontawesome/font-awesome.less +33 -0
- data/vendor/toolkit/fontawesome/icons.less +381 -0
- data/vendor/toolkit/fontawesome/mixins.less +48 -0
- data/vendor/toolkit/fontawesome/path.less +14 -0
- data/vendor/toolkit/fontawesome/variables.less +735 -0
- data/vendor/toolkit/twitter/bootstrap/alerts.less +14 -0
- data/vendor/toolkit/twitter/bootstrap/bootstrap.less +4 -4
- data/vendor/toolkit/twitter/bootstrap/breadcrumbs.less +6 -6
- data/vendor/toolkit/twitter/bootstrap/button-groups.less +31 -44
- data/vendor/toolkit/twitter/bootstrap/buttons.less +13 -17
- data/vendor/toolkit/twitter/bootstrap/carousel.less +48 -21
- data/vendor/toolkit/twitter/bootstrap/close.less +2 -1
- data/vendor/toolkit/twitter/bootstrap/code.less +3 -0
- data/vendor/toolkit/twitter/bootstrap/dropdowns.less +32 -21
- data/vendor/toolkit/twitter/bootstrap/forms.less +17 -10
- data/vendor/toolkit/twitter/bootstrap/labels-badges.less +12 -2
- data/vendor/toolkit/twitter/bootstrap/media.less +2 -2
- data/vendor/toolkit/twitter/bootstrap/mixins.less +25 -9
- data/vendor/toolkit/twitter/bootstrap/modals.less +4 -3
- data/vendor/toolkit/twitter/bootstrap/navbar.less +35 -13
- data/vendor/toolkit/twitter/bootstrap/navs.less +45 -21
- data/vendor/toolkit/twitter/bootstrap/pager.less +3 -1
- data/vendor/toolkit/twitter/bootstrap/pagination.less +3 -1
- data/vendor/toolkit/twitter/bootstrap/popovers.less +55 -39
- data/vendor/toolkit/twitter/bootstrap/reset.less +82 -4
- data/vendor/toolkit/twitter/bootstrap/responsive-767px-max.less +2 -2
- data/vendor/toolkit/twitter/bootstrap/responsive-navbar.less +6 -2
- data/vendor/toolkit/twitter/bootstrap/responsive-utilities.less +16 -0
- data/vendor/toolkit/twitter/bootstrap/responsive.less +1 -1
- data/vendor/toolkit/twitter/bootstrap/scaffolding.less +2 -1
- data/vendor/toolkit/twitter/bootstrap/sprites.less +9 -5
- data/vendor/toolkit/twitter/bootstrap/tables.less +54 -46
- data/vendor/toolkit/twitter/bootstrap/thumbnails.less +3 -2
- data/vendor/toolkit/twitter/bootstrap/tooltip.less +6 -6
- data/vendor/toolkit/twitter/bootstrap/type.less +44 -24
- data/vendor/toolkit/twitter/bootstrap/variables.less +3 -3
- metadata +130 -44
- data/lib/generators/bootstrap/partial/templates/_navbar.html.erb +0 -13
- data/vendor/assets/fonts/fontawesome-webfont.eot +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.svg +0 -255
- data/vendor/assets/fonts/fontawesome-webfont.ttf +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.woff +0 -0
- data/vendor/assets/stylesheets/twitter-bootstrap-static/fontawesome.css.erb +0 -218
- data/vendor/toolkit/font-awesome-ie7.less +0 -245
- data/vendor/toolkit/fontawesome.less +0 -327
- /data/{vendor → app}/assets/images/twitter/bootstrap/glyphicons-halflings-white.png +0 -0
- /data/{vendor → app}/assets/images/twitter/bootstrap/glyphicons-halflings.png +0 -0
- /data/{vendor → app}/assets/javascripts/twitter/bootstrap.js +0 -0
- /data/{vendor → app}/assets/javascripts/twitter/bootstrap_ujs.js +0 -0
data/README.md
CHANGED
@@ -3,11 +3,17 @@ Bootstrap is a toolkit from Twitter designed to kickstart development of webapps
|
|
3
3
|
|
4
4
|
twitter-bootstrap-rails project integrates Bootstrap CSS toolkit for Rails 3.1 Asset Pipeline (Rails 3.2 supported)
|
5
5
|
|
6
|
-
[![
|
7
|
-
[![
|
8
|
-
[![
|
9
|
-
[![
|
10
|
-
|
6
|
+
[![Gem Version](https://badge.fury.io/rb/twitter-bootstrap-rails.png)][gem]
|
7
|
+
[![Build Status](https://secure.travis-ci.org/seyhunak/twitter-bootstrap-rails.png?branch=master)][travis]
|
8
|
+
[![Dependency Status](https://gemnasium.com/seyhunak/twitter-bootstrap-rails.png?travis)][gemnasium]
|
9
|
+
[![Code Climate](https://codeclimate.com/github/seyhunak/twitter-bootstrap-rails.png)][codeclimate]
|
10
|
+
[![Coverage Status](https://coveralls.io/repos/seyhunak/twitter-bootstrap-rails/badge.png?branch=master)][coveralls]
|
11
|
+
|
12
|
+
[gem]: https://rubygems.org/gems/twitter-bootstrap-rails
|
13
|
+
[travis]: http://travis-ci.org/seyhunak/twitter-bootstrap-rails
|
14
|
+
[gemnasium]: https://gemnasium.com/seyhunak/twitter-bootstrap-rails
|
15
|
+
[codeclimate]: https://codeclimate.com/github/seyhunak/twitter-bootstrap-rails
|
16
|
+
[coveralls]: https://coveralls.io/r/seyhunak/twitter-bootstrap-rails
|
11
17
|
|
12
18
|
## Screencasts
|
13
19
|
#### Installing twitter-bootstrap-rails, generators, usage and more
|
@@ -58,7 +64,7 @@ Then run `bundle install` from the command line:
|
|
58
64
|
|
59
65
|
bundle install
|
60
66
|
|
61
|
-
Then run the
|
67
|
+
Then run the bootstrap generator to add Bootstrap includes into your assets:
|
62
68
|
|
63
69
|
rails generate bootstrap:install less
|
64
70
|
|
@@ -88,12 +94,18 @@ Usage:
|
|
88
94
|
rails g bootstrap:layout [LAYOUT_NAME] [*fixed or fluid]
|
89
95
|
|
90
96
|
|
91
|
-
Example:
|
97
|
+
Example of a fixed layout:
|
92
98
|
|
93
99
|
|
94
100
|
rails g bootstrap:layout application fixed
|
95
101
|
|
96
102
|
|
103
|
+
Example of a responsive layout:
|
104
|
+
|
105
|
+
|
106
|
+
rails g bootstrap:layout application fluid
|
107
|
+
|
108
|
+
|
97
109
|
Themed (generates Twitter Bootstrap compatible scaffold views.) - (Haml and Slim supported)
|
98
110
|
|
99
111
|
|
@@ -154,19 +166,76 @@ To use individual components from bootstrap, your bootstrap_and_overrides.less c
|
|
154
166
|
If you'd like to alter Bootstrap's own variables, or define your LESS
|
155
167
|
styles inheriting Bootstrap's mixins, you can do so inside bootstrap_and_overrides.css.less:
|
156
168
|
|
169
|
+
|
157
170
|
```css
|
158
171
|
@linkColor: #ff0000;
|
159
172
|
```
|
160
173
|
|
174
|
+
### SASS
|
175
|
+
|
176
|
+
If you are using SASS to compile your application.css (e.g. your manifest file is application.css.sass or application.css.scss) you may get this:
|
177
|
+
|
178
|
+
```
|
179
|
+
Invalid CSS after "*": expected "{", was "= require twitt..."
|
180
|
+
(in app/assets/stylesheets/application.css)
|
181
|
+
(sass)
|
182
|
+
```
|
183
|
+
|
184
|
+
If this is the case, you **must** use @import instead of `*=` in your manifest file, or don't compile your manifest with SASS.
|
185
|
+
|
186
|
+
### Icons
|
187
|
+
|
188
|
+
By default, this gem overrides standard Bootstraps's Glyphicons with Font Awesome (http://fortawesome.github.com/Font-Awesome/).
|
189
|
+
|
190
|
+
This should appear inside _bootstrap_and_overrides *(based on you twitter-bootstrap-rails version)*
|
191
|
+
|
192
|
+
**From 2.2.7**
|
193
|
+
|
194
|
+
```css
|
195
|
+
// Font Awesome
|
196
|
+
@fontAwesomeEotPath: asset-url("fontawesome-webfont.eot");
|
197
|
+
@fontAwesomeEotPath_iefix: asset-url("fontawesome-webfont.eot?#iefix");
|
198
|
+
@fontAwesomeWoffPath: asset-url("fontawesome-webfont.woff");
|
199
|
+
@fontAwesomeTtfPath: asset-url("fontawesome-webfont.ttf");
|
200
|
+
@fontAwesomeSvgPath: asset-url("fontawesome-webfont.svg#fontawesomeregular");
|
201
|
+
@import "fontawesome/font-awesome";
|
202
|
+
```
|
203
|
+
|
204
|
+
**Before 2.2.7**
|
205
|
+
|
206
|
+
```css
|
207
|
+
// Font Awesome
|
208
|
+
@fontAwesomeEotPath: "/assets/fontawesome-webfont.eot";
|
209
|
+
@fontAwesomeEotPath_iefix: "/assets/fontawesome-webfont.eot?#iefix";
|
210
|
+
@fontAwesomeWoffPath: "/assets/fontawesome-webfont.woff";
|
211
|
+
@fontAwesomeTtfPath: "/assets/fontawesome-webfont.ttf";
|
212
|
+
@fontAwesomeSvgPath: "/assets/fontawesome-webfont.svg#fontawesomeregular";
|
213
|
+
@import "fontawesome";
|
214
|
+
```
|
215
|
+
|
216
|
+
If you would like to restore the default Glyphicons, inside the _bootstrap_and_overrides.css.less_ remove the FontAwesome declaration and uncomment the line:
|
217
|
+
|
218
|
+
```less
|
219
|
+
// Font Awesome
|
220
|
+
// @fontAwesomeEotPath: asset-url("fontawesome-webfont.eot");
|
221
|
+
// @fontAwesomeEotPath_iefix: asset-url("fontawesome-webfont.eot?#iefix");
|
222
|
+
// @fontAwesomeWoffPath: asset-url("fontawesome-webfont.woff");
|
223
|
+
// @fontAwesomeTtfPath: asset-url("fontawesome-webfont.ttf");
|
224
|
+
// @fontAwesomeSvgPath: asset-url("fontawesome-webfont.svg#fontawesomeregular");
|
225
|
+
// @import "fontawesome/font-awesome";
|
226
|
+
|
227
|
+
// Glyphicons
|
228
|
+
@import "twitter/bootstrap/sprites.less";
|
229
|
+
```
|
161
230
|
|
162
231
|
## Using Javascripts
|
163
232
|
|
164
|
-
|
233
|
+
Require Bootstrap JS (bootstrap.js) in your application.js
|
165
234
|
|
166
235
|
```js
|
167
236
|
//= require twitter/bootstrap
|
168
237
|
|
169
|
-
$(
|
238
|
+
$(function(){
|
170
239
|
/* Your javascripts goes here... */
|
171
240
|
});
|
172
241
|
```
|
@@ -193,15 +262,348 @@ to /app/assets/javascripts/ folder.
|
|
193
262
|
|
194
263
|
```coffee
|
195
264
|
jQuery ->
|
196
|
-
$("a[rel
|
197
|
-
$(".tooltip").tooltip()
|
198
|
-
$("a[rel=tooltip]").tooltip()
|
265
|
+
$("a[rel~=popover], .has-popover").popover()
|
266
|
+
$("a[rel~=tooltip], .has-tooltip").tooltip()
|
199
267
|
```
|
200
268
|
|
201
269
|
## Using Helpers
|
202
270
|
|
271
|
+
### Modal Helper
|
272
|
+
You can create modals easily using the following example. The header, body, and footer all accept content_tag or plain html.
|
273
|
+
The href of the button to launch the modal must matche the id of the modal dialog.
|
274
|
+
|
275
|
+
````
|
276
|
+
<%= content_tag :a, "Modal", :href => "#modal", :class => 'btn', :data => {:toggle => 'modal'} %>
|
277
|
+
|
278
|
+
<%= modal_dialog :id => "modal",
|
279
|
+
:header => { :show_close => true, :dismiss => 'modal', :title => 'Modal header' },
|
280
|
+
:body => 'This is the body',
|
281
|
+
:footer => content_tag(:button, 'Save', :class => 'btn') %>
|
282
|
+
````
|
283
|
+
|
284
|
+
### Navbar Helper
|
285
|
+
It should let you write things like:
|
286
|
+
|
287
|
+
````
|
288
|
+
<%= nav_bar :fixed => :top, :brand => "Fashionable Clicheizr 2.0", :responsive => true do %>
|
289
|
+
<%= menu_group do %>
|
290
|
+
<%= menu_item "Home", root_path %>
|
291
|
+
<%= menu_divider %>
|
292
|
+
<%= drop_down "Products" do %>
|
293
|
+
<%= menu_item "Things you can't afford", expensive_products_path %>
|
294
|
+
<%= menu_item "Things that won't suit you anyway", harem_pants_path %>
|
295
|
+
<%= menu_item "Things you're not even cool enough to buy anyway", hipster_products_path %>
|
296
|
+
<% if current_user.lives_in_hackney? %>
|
297
|
+
<%= menu_item "Bikes", fixed_wheel_bikes_path %>
|
298
|
+
<% end %>
|
299
|
+
<% end %>
|
300
|
+
<%= menu_item "About Us", about_us_path %>
|
301
|
+
<%= menu_item "Contact", contact_path %>
|
302
|
+
<% end %>
|
303
|
+
<%= menu_group :pull => :right do %>
|
304
|
+
<% if current_user %>
|
305
|
+
<%= menu_item "Log Out", log_out_path %>
|
306
|
+
<% else %>
|
307
|
+
<%= form_for @user, :url => session_path(:user), html => {:class=> "navbar-form pull-right"} do |f| -%>
|
308
|
+
<p><%= f.text_field :email %></p>
|
309
|
+
<p><%= f.password_field :password %></p>
|
310
|
+
<p><%= f.submit "Sign in" %></p>
|
311
|
+
<% end -%>
|
312
|
+
<% end %>
|
313
|
+
<% end %>
|
314
|
+
<% end %>
|
315
|
+
````
|
316
|
+
|
317
|
+
### Navbar scaffolding
|
318
|
+
|
319
|
+
In your view file (most likely application.html.erb) to get a basic navbar set up you need to do this:
|
320
|
+
|
321
|
+
````
|
322
|
+
<%= nav_bar %>
|
323
|
+
````
|
324
|
+
|
325
|
+
Which will render:
|
326
|
+
|
327
|
+
<div class="navbar">
|
328
|
+
<div class="navbar-inner">
|
329
|
+
<div class="container">
|
330
|
+
</div>
|
331
|
+
</div>
|
332
|
+
</div>
|
333
|
+
|
334
|
+
|
335
|
+
### Fixed navbar
|
336
|
+
|
337
|
+
If you want the navbar to stick to the top of the screen, pass in the option like this:
|
338
|
+
|
339
|
+
````
|
340
|
+
<%= nav_bar :fixed => :top %>
|
341
|
+
````
|
342
|
+
|
343
|
+
To render:
|
344
|
+
|
345
|
+
<div class="navbar navbar-fixed-top">
|
346
|
+
<div class="navbar-inner">
|
347
|
+
<div class="container">
|
348
|
+
</div>
|
349
|
+
</div>
|
350
|
+
</div>
|
351
|
+
|
352
|
+
### Static navbar
|
353
|
+
|
354
|
+
If you want a full-width navbar that scrolls away with the page, pass in the option like this:
|
355
|
+
|
356
|
+
````
|
357
|
+
<%= nav_bar :static => :top %>
|
358
|
+
````
|
359
|
+
|
360
|
+
To render:
|
361
|
+
|
362
|
+
<div class="navbar navbar-static-top">
|
363
|
+
<div class="navbar-inner">
|
364
|
+
<div class="container">
|
365
|
+
</div>
|
366
|
+
</div>
|
367
|
+
</div>
|
368
|
+
|
369
|
+
|
370
|
+
### Brand name
|
371
|
+
|
372
|
+
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.
|
373
|
+
|
374
|
+
````
|
375
|
+
<%= nav_bar :brand => "We're sooo web 2.0alizr", :brand_link => account_dashboard_path %>
|
376
|
+
````
|
377
|
+
|
378
|
+
Which will render:
|
379
|
+
|
380
|
+
<div class="navbar">
|
381
|
+
<div class="navbar-inner">
|
382
|
+
<div class="container">
|
383
|
+
<a class="brand" href="/accounts/dashboard">
|
384
|
+
We're sooo web 2.0alizr
|
385
|
+
</a>
|
386
|
+
</div>
|
387
|
+
</div>
|
388
|
+
</div>
|
389
|
+
|
390
|
+
|
391
|
+
### Optional responsive variation
|
392
|
+
|
393
|
+
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:
|
394
|
+
|
395
|
+
````
|
396
|
+
<%= nav_bar :responsive => true %>
|
397
|
+
````
|
398
|
+
Which renders the html quite differently:
|
399
|
+
|
400
|
+
|
401
|
+
<div class="navbar">
|
402
|
+
<div class="navbar-inner">
|
403
|
+
<div class="container">
|
404
|
+
<!-- .btn-navbar is used as the toggle for collapsed navbar content -->
|
405
|
+
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
|
406
|
+
<span class="icon-bar"></span>
|
407
|
+
<span class="icon-bar"></span>
|
408
|
+
<span class="icon-bar"></span>
|
409
|
+
</a>
|
410
|
+
<!-- Everything in here gets hidden at 940px or less -->
|
411
|
+
<div class="nav-collapse">
|
412
|
+
<!-- menu items gets rendered here instead -->
|
413
|
+
</div>
|
414
|
+
</div>
|
415
|
+
</div>
|
416
|
+
</div>
|
417
|
+
|
418
|
+
|
419
|
+
### Nav links
|
420
|
+
|
421
|
+
This is the 'meat' of the code where you define your menu items.
|
422
|
+
|
423
|
+
You can group menu items in theoretical boxes which you can apply logic to - e.g. show different collections for logged in users/logged out users, or simply right align a group.
|
424
|
+
|
425
|
+
The active menu item will be inferred from the link for now.
|
426
|
+
|
427
|
+
The important methods here are menu_group and menu_item.
|
428
|
+
|
429
|
+
menu_group only takes one argument - :pull - this moves the group left or right when passed :left or :right.
|
430
|
+
|
431
|
+
menu_item generates a link wrapped in an li tag. It takes two arguments and an options hash. The first argument is the name (the text that will appear in the menu), and the path (which defaults to "#" if left blank). The rest of the options are passed straight through to the link_to helper, so that you can add classes, ids, methods or data tags etc.
|
432
|
+
|
433
|
+
````
|
434
|
+
<%= nav_bar :fixed => :top, :brand => "Ninety Ten" do %>
|
435
|
+
<% menu_group do %>
|
436
|
+
<%= menu_item "Home", root_path %>
|
437
|
+
<%= menu_item "About Us", about_us_path %>
|
438
|
+
<%= menu_item "Contact", contact_path %>
|
439
|
+
<% end %>
|
440
|
+
<% if current_user %>
|
441
|
+
<%= menu_item "Log Out", log_out_path %>
|
442
|
+
<% else %>
|
443
|
+
<% menu_group :pull => :right do %>
|
444
|
+
<%= menu_item "Sign Up", registration_path %>
|
445
|
+
<% form_for @user, :url => session_path(:user) do |f| -%>
|
446
|
+
<p><%= f.text_field :email %></p>
|
447
|
+
<p><%= f.password_field :password %></p>
|
448
|
+
<p><%= f.submit "Sign in" %></p>
|
449
|
+
<% end -%>
|
450
|
+
<% end %>
|
451
|
+
<% end %>
|
452
|
+
<% end %>
|
453
|
+
````
|
454
|
+
|
455
|
+
### Dropdown menus
|
456
|
+
|
457
|
+
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:
|
458
|
+
|
459
|
+
````
|
460
|
+
<%= nav_bar do %>
|
461
|
+
<%= menu_item "Home", root_path %>
|
462
|
+
|
463
|
+
<%= drop_down "Products" do %>
|
464
|
+
<%= menu_item "Latest", latest_products_path %>
|
465
|
+
<%= menu_item "Top Sellers", popular_products_path %>
|
466
|
+
<%= drop_down_divider %>
|
467
|
+
<%= menu_item "Discount Items", discounted_products_path %>
|
468
|
+
<% end %>
|
469
|
+
|
470
|
+
<%= menu_item "About Us", about_us_path %>
|
471
|
+
<%= menu_item "Contact", contact_path %>
|
472
|
+
<% end %>
|
473
|
+
````
|
474
|
+
|
475
|
+
### Dividers
|
476
|
+
|
477
|
+
Dividers are just vertical bars that visually separate logically disparate groups of menu items
|
478
|
+
|
479
|
+
````
|
480
|
+
<%= nav_bar :fixed => :bottom do %>
|
481
|
+
<%= menu_item "Home", root_path %>
|
482
|
+
<%= menu_item "About Us", about_us_path %>
|
483
|
+
<%= menu_item "Contact", contact_path %>
|
484
|
+
|
485
|
+
<%= menu_divider %>
|
486
|
+
|
487
|
+
<%= menu_item "Edit Profile", edit_user_path(current_user) %>
|
488
|
+
<%= menu_item "Account Settings", edit_user_account_path(current_user, @account) %>
|
489
|
+
<%= menu_item "Log Out", log_out_path %>
|
490
|
+
<% end %>
|
491
|
+
````
|
492
|
+
|
493
|
+
### Forms in navbar
|
494
|
+
|
495
|
+
At the moment - this is just a how to...
|
496
|
+
|
497
|
+
You need to add this class to the form itself (Different form builders do this in different ways - please check out the relevant docs)
|
498
|
+
|
499
|
+
````css
|
500
|
+
.navbar-form
|
501
|
+
````
|
502
|
+
To pull the form left or right, add either of these classes:
|
503
|
+
````css
|
504
|
+
.pull-left
|
505
|
+
.pull-right
|
506
|
+
````
|
507
|
+
|
508
|
+
If you want the Bootstrap search box (I think it just rounds the corners), use:
|
509
|
+
````css
|
510
|
+
.navbar-search
|
511
|
+
````
|
512
|
+
Instead of:
|
513
|
+
````css
|
514
|
+
.navbar-form
|
515
|
+
````
|
516
|
+
|
517
|
+
To change the size of the form fields, use .span2 (or however many span widths you want) to the input itself.
|
518
|
+
|
519
|
+
### Component alignment
|
520
|
+
|
521
|
+
You can shift things to the left or the right across the nav bar. It's easiest to do this on grouped menu items:
|
522
|
+
|
523
|
+
````
|
524
|
+
<%= nav_bar :fixed => :bottom do %>
|
525
|
+
<% menu_group do %>
|
526
|
+
<%= menu_item "Home", root_path %>
|
527
|
+
<%= menu_item "About Us", about_us_path %>
|
528
|
+
<%= menu_item "Contact", contact_path %>
|
529
|
+
<% end %>
|
530
|
+
<% menu_group :pull => :right do %>
|
531
|
+
<%= menu_item "Edit Profile", edit_user_path(current_user) %>
|
532
|
+
<%= menu_item "Account Settings", edit_user_account_path(current_user, @account) %>
|
533
|
+
<%= menu_item "Log Out", log_out_path %>
|
534
|
+
<% end %>
|
535
|
+
<% end %>
|
536
|
+
````
|
537
|
+
|
538
|
+
### Text in the navbar
|
539
|
+
|
540
|
+
If you want to put regular plain text in the navbar anywhere, you do it like this:
|
541
|
+
|
542
|
+
````
|
543
|
+
<%= nav_bar :brand => "Apple" do %>
|
544
|
+
<%= menu_text "We make shiny things" %>
|
545
|
+
<%= menu_item "Home", root_path %>
|
546
|
+
<%= menu_item "About Us", about_us_path %>
|
547
|
+
<% end %>
|
548
|
+
````
|
549
|
+
It also takes the :pull option to drag it to the left or right.
|
550
|
+
|
551
|
+
|
203
552
|
### Flash helper
|
204
|
-
|
553
|
+
|
554
|
+
Add flash helper `<%= bootstrap_flash %>` to your layout (built-in with layout generator)
|
555
|
+
|
556
|
+
### Breadcrumbs Helpers
|
557
|
+
|
558
|
+
*Notice* If your application is using [breadcrumbs-on-rails](https://github.com/weppos/breadcrumbs_on_rails) you will have a namespace collision with the add_breadcrumb method.
|
559
|
+
You do not need to use these breadcrumb gems since this gem provides the same functionality out of the box without the additional dependency.
|
560
|
+
|
561
|
+
Add breadcrumbs helper `<%= render_breadcrumbs %>` to your layout.
|
562
|
+
|
563
|
+
```ruby
|
564
|
+
class ApplicationController
|
565
|
+
add_breadcrumb :index, :root_path
|
566
|
+
end
|
567
|
+
```
|
568
|
+
|
569
|
+
```ruby
|
570
|
+
class ExamplesController < ApplicationController
|
571
|
+
add_breadcrumb :index, :examples_path
|
572
|
+
|
573
|
+
def index
|
574
|
+
end
|
575
|
+
|
576
|
+
def show
|
577
|
+
@example = Example.find params[:id]
|
578
|
+
add_breadcrumb @example.name, example_path(@example)
|
579
|
+
# add_breadcrumb :show, example_path(@example)
|
580
|
+
end
|
581
|
+
end
|
582
|
+
```
|
583
|
+
|
584
|
+
### Element utility helpers
|
585
|
+
|
586
|
+
Badge:
|
587
|
+
```erb
|
588
|
+
<%= badge(12, :warning) %> <span class="badge badge-warning">12</span>
|
589
|
+
```
|
590
|
+
|
591
|
+
Label:
|
592
|
+
```erb
|
593
|
+
<%= label('Gut!', :success) %> <span class="badge badge-success">Gut!</span>
|
594
|
+
```
|
595
|
+
|
596
|
+
Glyph:
|
597
|
+
```erb
|
598
|
+
<%= glyph(:pencil) %> <i class="icon-pencil"></i>
|
599
|
+
```
|
600
|
+
|
601
|
+
###i18n Internationalization Support
|
602
|
+
The installer creates an english translation file for you and copies it to config/locales/en.bootstrap.yml
|
603
|
+
|
604
|
+
|
605
|
+
NOTE: If you are using Devise in your project, you must have a devise locale file
|
606
|
+
for handling flash messages, even if those messages are blank. See https://github.com/plataformatec/devise/wiki/I18n
|
205
607
|
|
206
608
|
## Changelog
|
207
609
|
<ul>
|
@@ -245,11 +647,23 @@ Add flash helper <%= bootstrap_flash %> to your layout (built-in with layout gen
|
|
245
647
|
<li>Released gem v.2.1.5 (minor fixes, install generator detects javascript template engine, updated to Twitter Bootstrap 2.2.1)</li>
|
246
648
|
<li>Released gem v.2.1.6 (minor fixes)</li>
|
247
649
|
<li>Added static stylesheets support</li>
|
650
|
+
<li>Released gem v.2.1.8 and updated to Twitter Bootstrap 2.2.2</li>
|
651
|
+
<li>Released gem v.2.1.9</li>
|
652
|
+
<li>Released gem v.2.2.0 (Font Awesome 3)</li>
|
653
|
+
<li>Released gem v.2.2.1 (minor fixes and updates)</li>
|
654
|
+
<li>Released gem v.2.2.2 (Bootstrap 2.3.0)</li>
|
655
|
+
<li>Released gem v.2.2.3 (Minor fixes)</li>
|
656
|
+
<li>Released gem v.2.2.4 (Minor fixes)</li>
|
657
|
+
<li>Released gem v.2.2.5 (Bootstrap 2.3.1)</li>
|
658
|
+
<li>Released gem v.2.2.6</li>
|
659
|
+
<li>Released gem v.2.2.7 (Fixes)</li>
|
660
|
+
<li>Releases gem v.2.2.8</li>
|
248
661
|
</ul>
|
249
662
|
|
250
663
|
|
251
664
|
## Contributors & Patches & Forks
|
252
665
|
<ul>
|
666
|
+
<li>Ben Lovell</li>
|
253
667
|
<li>Daniel Morris</li>
|
254
668
|
<li>Bradly Feeley</li>
|
255
669
|
<li>Guilherme Moreira</li>
|
@@ -269,13 +683,6 @@ Add flash helper <%= bootstrap_flash %> to your layout (built-in with layout gen
|
|
269
683
|
<li>Leonid Shevtsov</li>
|
270
684
|
</ul>
|
271
685
|
|
272
|
-
|
273
|
-
### Future
|
274
|
-
<ul>
|
275
|
-
<li>Writing tests (not implemented yet)</li>
|
276
|
-
<li>Markup Helpers (alert, tabs, pagination, breadcrumbs etc.)</li>
|
277
|
-
</ul>
|
278
|
-
|
279
686
|
## About Me
|
280
687
|
Lead/ Senior Developer - Programmer @useful (Usefulideas) Istanbul / Turkey
|
281
688
|
|
@@ -307,7 +714,7 @@ http://klout.com/#/seyhunak
|
|
307
714
|
### Want to donate?
|
308
715
|
<img src="https://www.paypalobjects.com/en_US/i/logo/PayPal_mark_50x34.gif"></img>
|
309
716
|
|
310
|
-
[Want to donate for my efforts
|
717
|
+
[Want to donate for my efforts? Show your love](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=W8ZLWQBREFP4U
|
311
718
|
"Donate")
|
312
719
|
|
313
720
|
|
data/Rakefile
CHANGED
@@ -3,13 +3,17 @@ require 'bundler'
|
|
3
3
|
Bundler::GemHelper.install_tasks
|
4
4
|
|
5
5
|
desc "Bundle the gem"
|
6
|
-
task :bundle do
|
7
|
-
sh('bundle install')
|
6
|
+
task :bundle => [:bundle_install, :build_static_stylesheets] do
|
8
7
|
sh 'gem build *.gemspec'
|
9
8
|
sh 'gem install *.gem'
|
10
9
|
sh 'rm *.gem'
|
11
10
|
end
|
12
11
|
|
12
|
+
desc "Runs bundle install"
|
13
|
+
task :bundle_install do
|
14
|
+
sh('bundle install')
|
15
|
+
end
|
16
|
+
|
13
17
|
desc "Build the static precompiled stylesheets from Less sources"
|
14
18
|
task :build_static_stylesheets do
|
15
19
|
require 'less'
|
@@ -18,7 +22,7 @@ task :build_static_stylesheets do
|
|
18
22
|
|
19
23
|
parser = Less::Parser.new :paths => [toolkit_path]
|
20
24
|
|
21
|
-
target_directory = File.expand_path('
|
25
|
+
target_directory = File.expand_path('app/assets/stylesheets/twitter-bootstrap-static')
|
22
26
|
|
23
27
|
sh "rm -rf #{target_directory}"
|
24
28
|
sh "mkdir -p #{target_directory}"
|
@@ -32,3 +36,11 @@ end
|
|
32
36
|
|
33
37
|
task(:default).clear
|
34
38
|
task :default => :bundle
|
39
|
+
|
40
|
+
require 'rake/testtask'
|
41
|
+
|
42
|
+
Rake::TestTask.new do |t|
|
43
|
+
t.libs << "test"
|
44
|
+
t.test_files = FileList['test/lib/*_test.rb']
|
45
|
+
t.verbose = true
|
46
|
+
end
|
Binary file
|