twitter-bootstrap3-rails 3.2.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (132) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +708 -0
  3. data/Rakefile +46 -0
  4. data/app/assets/fonts/fontawesome-webfont.eot +0 -0
  5. data/app/assets/fonts/fontawesome-webfont.svg +399 -0
  6. data/app/assets/fonts/fontawesome-webfont.ttf +0 -0
  7. data/app/assets/fonts/fontawesome-webfont.woff +0 -0
  8. data/app/assets/images/twitter/bootstrap/glyphicons-halflings-white.png +0 -0
  9. data/app/assets/images/twitter/bootstrap/glyphicons-halflings.png +0 -0
  10. data/app/assets/javascripts/twitter/bootstrap.js +12 -0
  11. data/app/assets/javascripts/twitter/bootstrap/affix.js +126 -0
  12. data/app/assets/javascripts/twitter/bootstrap/alert.js +98 -0
  13. data/app/assets/javascripts/twitter/bootstrap/button.js +109 -0
  14. data/app/assets/javascripts/twitter/bootstrap/carousel.js +217 -0
  15. data/app/assets/javascripts/twitter/bootstrap/collapse.js +179 -0
  16. data/app/assets/javascripts/twitter/bootstrap/dropdown.js +154 -0
  17. data/app/assets/javascripts/twitter/bootstrap/modal.js +244 -0
  18. data/app/assets/javascripts/twitter/bootstrap/popover.js +117 -0
  19. data/app/assets/javascripts/twitter/bootstrap/scrollspy.js +158 -0
  20. data/app/assets/javascripts/twitter/bootstrap/tab.js +135 -0
  21. data/app/assets/javascripts/twitter/bootstrap/tooltip.js +382 -0
  22. data/app/assets/javascripts/twitter/bootstrap/transition.js +56 -0
  23. data/app/assets/javascripts/twitter/bootstrap_ujs.js +11 -0
  24. data/app/assets/stylesheets/twitter-bootstrap-static/bootstrap.css.erb +5579 -0
  25. data/app/assets/stylesheets/twitter-bootstrap-static/fontawesome.css.erb +787 -0
  26. data/app/assets/stylesheets/twitter-bootstrap-static/sprites.css.erb +146 -0
  27. data/app/helpers/badge_label_helper.rb +16 -0
  28. data/app/helpers/bootstrap_flash_helper.rb +29 -0
  29. data/app/helpers/flash_block_helper.rb +17 -0
  30. data/app/helpers/glyph_helper.rb +17 -0
  31. data/app/helpers/modal_helper.rb +59 -0
  32. data/app/helpers/navbar_helper.rb +195 -0
  33. data/app/helpers/twitter_breadcrumbs_helper.rb +10 -0
  34. data/app/views/twitter-bootstrap/_breadcrumbs.html.erb +12 -0
  35. data/lib/generators/bootstrap/install/install_generator.rb +82 -0
  36. data/lib/generators/bootstrap/install/templates/application.css +7 -0
  37. data/lib/generators/bootstrap/install/templates/application.js +10 -0
  38. data/lib/generators/bootstrap/install/templates/bootstrap.coffee +3 -0
  39. data/lib/generators/bootstrap/install/templates/bootstrap.js +4 -0
  40. data/lib/generators/bootstrap/install/templates/bootstrap_and_overrides.css +7 -0
  41. data/lib/generators/bootstrap/install/templates/bootstrap_and_overrides.less +29 -0
  42. data/lib/generators/bootstrap/install/templates/en.bootstrap.yml +18 -0
  43. data/lib/generators/bootstrap/layout/layout_generator.rb +20 -0
  44. data/lib/generators/bootstrap/layout/templates/layout.html.erb +85 -0
  45. data/lib/generators/bootstrap/layout/templates/layout.html.haml +50 -0
  46. data/lib/generators/bootstrap/layout/templates/layout.html.slim +52 -0
  47. data/lib/generators/bootstrap/partial/partial_generator.rb +20 -0
  48. data/lib/generators/bootstrap/partial/templates/_login.html.erb +28 -0
  49. data/lib/generators/bootstrap/themed/templates/_form.html.erb +16 -0
  50. data/lib/generators/bootstrap/themed/templates/_form.html.haml +9 -0
  51. data/lib/generators/bootstrap/themed/templates/_form.html.slim +10 -0
  52. data/lib/generators/bootstrap/themed/templates/edit.html.erb +5 -0
  53. data/lib/generators/bootstrap/themed/templates/edit.html.haml +4 -0
  54. data/lib/generators/bootstrap/themed/templates/edit.html.slim +4 -0
  55. data/lib/generators/bootstrap/themed/templates/index.html.erb +40 -0
  56. data/lib/generators/bootstrap/themed/templates/index.html.haml +25 -0
  57. data/lib/generators/bootstrap/themed/templates/index.html.slim +27 -0
  58. data/lib/generators/bootstrap/themed/templates/new.html.erb +5 -0
  59. data/lib/generators/bootstrap/themed/templates/new.html.haml +4 -0
  60. data/lib/generators/bootstrap/themed/templates/new.html.slim +4 -0
  61. data/lib/generators/bootstrap/themed/templates/show.html.erb +21 -0
  62. data/lib/generators/bootstrap/themed/templates/show.html.haml +15 -0
  63. data/lib/generators/bootstrap/themed/templates/show.html.slim +16 -0
  64. data/lib/generators/bootstrap/themed/templates/simple_form/_form.html.erb +13 -0
  65. data/lib/generators/bootstrap/themed/templates/simple_form/_form.html.haml +10 -0
  66. data/lib/generators/bootstrap/themed/templates/simple_form/_form.html.slim +11 -0
  67. data/lib/generators/bootstrap/themed/themed_generator.rb +148 -0
  68. data/lib/twitter-bootstrap-rails.rb +10 -0
  69. data/lib/twitter/bootstrap/rails/bootstrap.rb +2 -0
  70. data/lib/twitter/bootstrap/rails/engine.rb +33 -0
  71. data/lib/twitter/bootstrap/rails/twitter-bootstrap-breadcrumbs.rb +42 -0
  72. data/lib/twitter/bootstrap/rails/version.rb +7 -0
  73. data/spec/lib/twitter_bootstrap_rails/badge_label_helper_spec.rb +22 -0
  74. data/spec/lib/twitter_bootstrap_rails/modal_helper_spec.rb +62 -0
  75. data/spec/lib/twitter_bootstrap_rails/navbar_helper_spec.rb +331 -0
  76. data/spec/lib/twitter_bootstrap_rails/uri_state_spec.rb +47 -0
  77. data/spec/spec_helper.rb +11 -0
  78. data/test/lib/breadcrumbs_test.rb +75 -0
  79. data/test/test_helper.rb +11 -0
  80. data/vendor/assets/stylesheets/twitter-bootstrap-static/bootstrap.css.erb +5579 -0
  81. data/vendor/static-source/bootstrap.less +1 -0
  82. data/vendor/static-source/fontawesome.less +9 -0
  83. data/vendor/static-source/sprites.less +6 -0
  84. data/vendor/toolkit/fontawesome/bootstrap.less +84 -0
  85. data/vendor/toolkit/fontawesome/core.less +129 -0
  86. data/vendor/toolkit/fontawesome/extras.less +93 -0
  87. data/vendor/toolkit/fontawesome/font-awesome-ie7.less +1953 -0
  88. data/vendor/toolkit/fontawesome/font-awesome.less +33 -0
  89. data/vendor/toolkit/fontawesome/icons.less +381 -0
  90. data/vendor/toolkit/fontawesome/mixins.less +48 -0
  91. data/vendor/toolkit/fontawesome/path.less +14 -0
  92. data/vendor/toolkit/fontawesome/variables.less +735 -0
  93. data/vendor/toolkit/twitter/bootstrap/alerts.less +71 -0
  94. data/vendor/toolkit/twitter/bootstrap/badges.less +51 -0
  95. data/vendor/toolkit/twitter/bootstrap/bootstrap.less +63 -0
  96. data/vendor/toolkit/twitter/bootstrap/breadcrumbs.less +23 -0
  97. data/vendor/toolkit/twitter/bootstrap/button-groups.less +244 -0
  98. data/vendor/toolkit/twitter/bootstrap/buttons.less +159 -0
  99. data/vendor/toolkit/twitter/bootstrap/carousel.less +204 -0
  100. data/vendor/toolkit/twitter/bootstrap/close.less +33 -0
  101. data/vendor/toolkit/twitter/bootstrap/code.less +56 -0
  102. data/vendor/toolkit/twitter/bootstrap/component-animations.less +29 -0
  103. data/vendor/toolkit/twitter/bootstrap/dropdowns.less +176 -0
  104. data/vendor/toolkit/twitter/bootstrap/forms.less +332 -0
  105. data/vendor/toolkit/twitter/bootstrap/grid.less +340 -0
  106. data/vendor/toolkit/twitter/bootstrap/input-groups.less +127 -0
  107. data/vendor/toolkit/twitter/bootstrap/jumbotron.less +29 -0
  108. data/vendor/toolkit/twitter/bootstrap/labels.less +54 -0
  109. data/vendor/toolkit/twitter/bootstrap/list-group.less +88 -0
  110. data/vendor/toolkit/twitter/bootstrap/media.less +56 -0
  111. data/vendor/toolkit/twitter/bootstrap/mixins.less +693 -0
  112. data/vendor/toolkit/twitter/bootstrap/modals.less +133 -0
  113. data/vendor/toolkit/twitter/bootstrap/navbar.less +559 -0
  114. data/vendor/toolkit/twitter/bootstrap/navs.less +228 -0
  115. data/vendor/toolkit/twitter/bootstrap/normalize.less +396 -0
  116. data/vendor/toolkit/twitter/bootstrap/pager.less +55 -0
  117. data/vendor/toolkit/twitter/bootstrap/pagination.less +72 -0
  118. data/vendor/toolkit/twitter/bootstrap/panels.less +128 -0
  119. data/vendor/toolkit/twitter/bootstrap/popovers.less +133 -0
  120. data/vendor/toolkit/twitter/bootstrap/print.less +100 -0
  121. data/vendor/toolkit/twitter/bootstrap/progress-bars.less +99 -0
  122. data/vendor/toolkit/twitter/bootstrap/responsive-utilities.less +149 -0
  123. data/vendor/toolkit/twitter/bootstrap/scaffolding.less +111 -0
  124. data/vendor/toolkit/twitter/bootstrap/tables.less +211 -0
  125. data/vendor/toolkit/twitter/bootstrap/thumbnails.less +42 -0
  126. data/vendor/toolkit/twitter/bootstrap/tooltip.less +95 -0
  127. data/vendor/toolkit/twitter/bootstrap/type.less +238 -0
  128. data/vendor/toolkit/twitter/bootstrap/utilities.less +42 -0
  129. data/vendor/toolkit/twitter/bootstrap/variables.less +607 -0
  130. data/vendor/toolkit/twitter/bootstrap/wells.less +29 -0
  131. data/vendor/toolkit/twitter/bootstrap_base.less +2 -0
  132. metadata +297 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5223b382520f0b18374ed306e9da45afe2c19b51
4
+ data.tar.gz: e95c6e52c7d5b3ef2b37aab6681358765abdd4cf
5
+ SHA512:
6
+ metadata.gz: 9eb9013a33f966ef9979d3abfe2a6ff756986ab484f419c90b7c2e51b69b54c3f0a4bc304e6b2d4013120d2316d1228091a3c4253248a0fbf5bb92d56979cc97
7
+ data.tar.gz: 1433658dc536bf78509e284d3fda4eac170332687ed969b62de15f172f98cc6d627af0fb3414adbe08baf06d415c81814114f8f6eb8ccaf33ddcc7520b98d95f
data/README.md ADDED
@@ -0,0 +1,708 @@
1
+ # Twitter Bootstrap for Rails 3.1 Asset Pipeline
2
+ Bootstrap is a toolkit from Twitter designed to kickstart development of webapps and sites. It includes base CSS and HTML for typography, forms, buttons, tables, grids, navigation, and more.
3
+
4
+ twitter-bootstrap-rails project integrates Bootstrap CSS toolkit for Rails 3.1 Asset Pipeline (Rails 3.2 supported)
5
+
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
17
+
18
+ ## Screencasts
19
+ #### Installing twitter-bootstrap-rails, generators, usage and more
20
+ <img width="180" height="35" src="http://oi49.tinypic.com/s5wn05.jpg"></img>
21
+
22
+ Screencasts provided by <a href="http://railscasts.com">Railscasts</a> (Ryan Bates)
23
+
24
+ [Twitter Bootstrap Basics](http://railscasts.com/episodes/328-twitter-bootstrap-basics "Twitter Bootstrap Basics")
25
+ in this episode you will learn how to include Twitter Bootstrap into Rails application with the twitter-bootstrap-rails gem.
26
+
27
+ [More on Twitter Bootstrap](http://railscasts.com/episodes/329-more-on-twitter-bootstrap "More on Twitter Bootstrap")
28
+ in this episode continues on the Twitter Bootstrap project showing how to display flash messages, add form validations with SimpleForm, customize layout with variables, and switch to using Sass.
29
+ (Note: This episode is pro episode)
30
+
31
+
32
+ ## Example Application
33
+ An example application is available at [toadkicker/teststrap](https://github.com/toadkicker/teststrap). You can view it running on heroku [here.](http://teststrap.herokuapp.com/) Contributions welcome.
34
+
35
+
36
+ ## Installing the Gem
37
+
38
+ The [Twitter Bootstrap Rails gem](http://rubygems.org/gems/twitter-bootstrap-rails) can provide the Twitter Bootstrap stylesheets in two ways.
39
+
40
+ The plain CSS way is how Twitter Bootstrap is provided on [the official website](http://twitter.github.com/bootstrap/).
41
+
42
+ The [Less](http://lesscss.org/) way provides more customisation options, like changing theme colors, and provides useful Less mixins for your code, but requires the
43
+ Less gem and the Ruby Racer Javascript runtime (not available on Microsoft Windows).
44
+
45
+ ### Installing the Less stylesheets
46
+
47
+ To use Less stylesheets, you'll need the [less-rails gem](http://rubygems.org/gems/less-rails), and one of [Javascript runtimes supported by CommonJS](https://github.com/cowboyd/commonjs.rb#supported-runtimes).
48
+
49
+ Include these lines in the Gemfile to install the gems from [RubyGems.org](http://rubygems.org):
50
+
51
+ ```ruby
52
+ gem "therubyracer"
53
+ gem "less-rails" #Sprockets (what Rails 3.1 uses for its asset pipeline) supports LESS
54
+ gem "twitter-bootstrap-rails"
55
+ ```
56
+
57
+ or you can install from latest build;
58
+
59
+ ```ruby
60
+ gem 'twitter-bootstrap-rails', :git => 'git://github.com/seyhunak/twitter-bootstrap-rails.git'
61
+ ```
62
+
63
+ Then run `bundle install` from the command line:
64
+
65
+ bundle install
66
+
67
+ Then run the bootstrap generator to add Bootstrap includes into your assets:
68
+
69
+ rails generate bootstrap:install less
70
+
71
+ ### Installing the CSS stylesheets
72
+
73
+ If you don't need to customize the stylesheets using Less, the only gem you need is the `twitter-bootstrap-rails` gem:
74
+
75
+ ```ruby
76
+ gem "twitter-bootstrap-rails"
77
+ ```
78
+
79
+ After running `bundle install`, run the generator:
80
+
81
+ rails generate bootstrap:install static
82
+
83
+ ## Generating layouts and views
84
+
85
+ You can run following generators to get started with Twitter Bootstrap quickly.
86
+
87
+
88
+ Layout (generates Twitter Bootstrap compatible layout) - (Haml and Slim supported)
89
+
90
+
91
+ Usage:
92
+
93
+
94
+ rails g bootstrap:layout [LAYOUT_NAME]
95
+
96
+
97
+ Themed (generates Twitter Bootstrap compatible scaffold views.) - (Haml and Slim supported)
98
+
99
+
100
+ Usage:
101
+
102
+
103
+ rails g bootstrap:themed [RESOURCE_NAME]
104
+
105
+
106
+ Example:
107
+
108
+
109
+ rails g scaffold Post title:string description:text
110
+ rake db:migrate
111
+ rails g bootstrap:themed Posts
112
+
113
+ Notice the plural usage of the resource to generate bootstrap:themed.
114
+
115
+ ## Using with Less
116
+
117
+ Bootstrap was built with Preboot, an open-source pack of mixins and variables to be used in conjunction with Less, a CSS preprocessor for faster and easier web development.
118
+
119
+ ## Using stylesheets with Less
120
+
121
+ You have to require Bootstrap LESS (bootstrap_and_overrides.css.less) in your application.css
122
+
123
+ ```css
124
+ /*
125
+ *= require bootstrap_and_overrides
126
+ */
127
+
128
+ /* Your stylesheets goes here... */
129
+ ```
130
+
131
+ To use individual components from bootstrap, your bootstrap_and_overrides.less could look like this:
132
+
133
+ ```css
134
+ @import "twitter/bootstrap/reset.less";
135
+ @import "twitter/bootstrap/variables.less";
136
+ @import "twitter/bootstrap/mixins.less";
137
+ @import "twitter/bootstrap/scaffolding.less";
138
+ @import "twitter/bootstrap/grid.less";
139
+ @import "twitter/bootstrap/layouts.less";
140
+ @import "twitter/bootstrap/type.less";
141
+ @import "twitter/bootstrap/forms.less";
142
+ @import "twitter/bootstrap/wells.less";
143
+ @import "twitter/bootstrap/component-animations.less";
144
+ @import "twitter/bootstrap/buttons.less";
145
+ @import "twitter/bootstrap/close.less";
146
+ @import "twitter/bootstrap/navs.less";
147
+ @import "twitter/bootstrap/navbar.less";
148
+ @import "twitter/bootstrap/labels-badges.less";
149
+ @import "twitter/bootstrap/hero-unit.less";
150
+ @import "twitter/bootstrap/utilities.less";
151
+ ```
152
+
153
+ If you'd like to alter Bootstrap's own variables, or define your LESS
154
+ styles inheriting Bootstrap's mixins, you can do so inside bootstrap_and_overrides.css.less:
155
+
156
+
157
+ ```css
158
+ @linkColor: #ff0000;
159
+ ```
160
+
161
+ ### SASS
162
+
163
+ 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:
164
+
165
+ ```
166
+ Invalid CSS after "*": expected "{", was "= require twitt..."
167
+ (in app/assets/stylesheets/application.css)
168
+ (sass)
169
+ ```
170
+
171
+ If this is the case, you **must** use @import instead of `*=` in your manifest file, or don't compile your manifest with SASS.
172
+
173
+ ### Icons
174
+
175
+ By default, this gem overrides standard Bootstraps's Glyphicons with Font Awesome (http://fortawesome.github.com/Font-Awesome/).
176
+
177
+ This should appear inside _bootstrap_and_overrides *(based on you twitter-bootstrap-rails version)*
178
+
179
+ **From 2.2.7**
180
+
181
+ ```css
182
+ // Font Awesome
183
+ @fontAwesomeEotPath: asset-url("fontawesome-webfont.eot");
184
+ @fontAwesomeEotPath_iefix: asset-url("fontawesome-webfont.eot?#iefix");
185
+ @fontAwesomeWoffPath: asset-url("fontawesome-webfont.woff");
186
+ @fontAwesomeTtfPath: asset-url("fontawesome-webfont.ttf");
187
+ @fontAwesomeSvgPath: asset-url("fontawesome-webfont.svg#fontawesomeregular");
188
+ @import "fontawesome/font-awesome";
189
+ ```
190
+
191
+ **Before 2.2.7**
192
+
193
+ ```css
194
+ // Font Awesome
195
+ @fontAwesomeEotPath: "/assets/fontawesome-webfont.eot";
196
+ @fontAwesomeEotPath_iefix: "/assets/fontawesome-webfont.eot?#iefix";
197
+ @fontAwesomeWoffPath: "/assets/fontawesome-webfont.woff";
198
+ @fontAwesomeTtfPath: "/assets/fontawesome-webfont.ttf";
199
+ @fontAwesomeSvgPath: "/assets/fontawesome-webfont.svg#fontawesomeregular";
200
+ @import "fontawesome";
201
+ ```
202
+
203
+ If you would like to restore the default Glyphicons, inside the _bootstrap_and_overrides.css.less_ remove the FontAwesome declaration and uncomment the line:
204
+
205
+ ```less
206
+ // Font Awesome
207
+ // @fontAwesomeEotPath: asset-url("fontawesome-webfont.eot");
208
+ // @fontAwesomeEotPath_iefix: asset-url("fontawesome-webfont.eot?#iefix");
209
+ // @fontAwesomeWoffPath: asset-url("fontawesome-webfont.woff");
210
+ // @fontAwesomeTtfPath: asset-url("fontawesome-webfont.ttf");
211
+ // @fontAwesomeSvgPath: asset-url("fontawesome-webfont.svg#fontawesomeregular");
212
+ // @import "fontawesome/font-awesome";
213
+
214
+ // Glyphicons
215
+ @import "twitter/bootstrap/sprites.less";
216
+ ```
217
+
218
+ ## Using Javascripts
219
+
220
+ Require Bootstrap JS (bootstrap.js) in your application.js
221
+
222
+ ```js
223
+ //= require twitter/bootstrap
224
+
225
+ $(function(){
226
+ /* Your javascripts goes here... */
227
+ });
228
+ ```
229
+
230
+ If you want to customize what is loaded, your application.js would look something like this
231
+
232
+ ```js
233
+ #= require jquery
234
+ #= require jquery_ujs
235
+ #= require twitter/bootstrap/bootstrap-transition
236
+ #= require twitter/bootstrap/bootstrap-alert
237
+ #= require twitter/bootstrap/bootstrap-modal
238
+ #= require twitter/bootstrap/bootstrap-button
239
+ #= require twitter/bootstrap/bootstrap-collapse
240
+ ```
241
+
242
+ ...and so on for each bootstrap js component.
243
+
244
+ ## Using Coffeescript (optionally)
245
+
246
+ Using Twitter Bootstrap with the CoffeeScript is easy.
247
+ twitter-bootstrap-rails generates a "bootstrap.js.coffee" file for you
248
+ to /app/assets/javascripts/ folder.
249
+
250
+ ```coffee
251
+ jQuery ->
252
+ $("a[rel~=popover], .has-popover").popover()
253
+ $("a[rel~=tooltip], .has-tooltip").tooltip()
254
+ ```
255
+
256
+ ## Using Helpers
257
+
258
+ ### Modal Helper
259
+ You can create modals easily using the following example. The header, body, and footer all accept content_tag or plain html.
260
+ The href of the button to launch the modal must matche the id of the modal dialog.
261
+
262
+ ````
263
+ <%= content_tag :a, "Modal", :href => "#modal", :class => 'btn', :data => {:toggle => 'modal'} %>
264
+
265
+ <%= modal_dialog :id => "modal",
266
+ :header => { :show_close => true, :dismiss => 'modal', :title => 'Modal header' },
267
+ :body => 'This is the body',
268
+ :footer => content_tag(:button, 'Save', :class => 'btn') %>
269
+ ````
270
+
271
+ ### Navbar Helper
272
+ It should let you write things like:
273
+
274
+ ````
275
+ <%= nav_bar :fixed => :top, :brand => "Fashionable Clicheizr 2.0", :responsive => true do %>
276
+ <%= menu_group do %>
277
+ <%= menu_item "Home", root_path %>
278
+ <%= menu_divider %>
279
+ <%= drop_down "Products" do %>
280
+ <%= menu_item "Things you can't afford", expensive_products_path %>
281
+ <%= menu_item "Things that won't suit you anyway", harem_pants_path %>
282
+ <%= menu_item "Things you're not even cool enough to buy anyway", hipster_products_path %>
283
+ <% if current_user.lives_in_hackney? %>
284
+ <%= menu_item "Bikes", fixed_wheel_bikes_path %>
285
+ <% end %>
286
+ <% end %>
287
+ <%= menu_item "About Us", about_us_path %>
288
+ <%= menu_item "Contact", contact_path %>
289
+ <% end %>
290
+ <%= menu_group :pull => :right do %>
291
+ <% if current_user %>
292
+ <%= menu_item "Log Out", log_out_path %>
293
+ <% else %>
294
+ <%= form_for @user, :url => session_path(:user), html => {:class=> "navbar-form pull-right"} do |f| -%>
295
+ <p><%= f.text_field :email %></p>
296
+ <p><%= f.password_field :password %></p>
297
+ <p><%= f.submit "Sign in" %></p>
298
+ <% end -%>
299
+ <% end %>
300
+ <% end %>
301
+ <% end %>
302
+ ````
303
+
304
+ ### Navbar scaffolding
305
+
306
+ In your view file (most likely application.html.erb) to get a basic navbar set up you need to do this:
307
+
308
+ ````
309
+ <%= nav_bar %>
310
+ ````
311
+
312
+ Which will render:
313
+
314
+ <div class="navbar">
315
+ <div class="container">
316
+ </div>
317
+ </div>
318
+
319
+
320
+ ### Fixed navbar
321
+
322
+ If you want the navbar to stick to the top of the screen, pass in the option like this:
323
+
324
+ ````
325
+ <%= nav_bar :fixed => :top %>
326
+ ````
327
+
328
+ To render:
329
+
330
+ <div class="navbar navbar-fixed-top">
331
+ <div class="container">
332
+ </div>
333
+ </div>
334
+
335
+ ### Static navbar
336
+
337
+ If you want a full-width navbar that scrolls away with the page, pass in the option like this:
338
+
339
+ ````
340
+ <%= nav_bar :static => :top %>
341
+ ````
342
+
343
+ To render:
344
+
345
+ <div class="navbar navbar-static-top">
346
+ <div class="container">
347
+ </div>
348
+ </div>
349
+
350
+
351
+ ### Brand name
352
+
353
+ 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.
354
+
355
+ ````
356
+ <%= nav_bar :brand => "We're sooo web 2.0alizr", :brand_link => account_dashboard_path %>
357
+ ````
358
+
359
+ Which will render:
360
+
361
+ <div class="navbar">
362
+ <div class="container">
363
+ <a class="navbar-brand" href="/accounts/dashboard">
364
+ We're sooo web 2.0alizr
365
+ </a>
366
+ </div>
367
+ </div>
368
+
369
+
370
+ ### Optional responsive variation
371
+
372
+ 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:
373
+
374
+ ````
375
+ <%= nav_bar :responsive => true %>
376
+ ````
377
+ Which renders the html quite differently:
378
+
379
+
380
+ <div class="navbar">
381
+ <div class="container">
382
+ <!-- .navbar-toggle is used as the toggle for collapsed navbar content -->
383
+ <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
384
+ <span class="icon-bar"></span>
385
+ <span class="icon-bar"></span>
386
+ <span class="icon-bar"></span>
387
+ </button>
388
+ <!-- Everything in here gets hidden at 940px or less -->
389
+ <div class="nav-collapse collapse">
390
+ <!-- menu items gets rendered here instead -->
391
+ </div>
392
+ </div>
393
+ </div>
394
+
395
+
396
+ ### Nav links
397
+
398
+ This is the 'meat' of the code where you define your menu items.
399
+
400
+ 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.
401
+
402
+ The active menu item will be inferred from the link for now.
403
+
404
+ The important methods here are menu_group and menu_item.
405
+
406
+ menu_group only takes one argument - :pull - this moves the group left or right when passed :left or :right.
407
+
408
+ 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.
409
+
410
+ ````
411
+ <%= nav_bar :fixed => :top, :brand => "Ninety Ten" do %>
412
+ <% menu_group do %>
413
+ <%= menu_item "Home", root_path %>
414
+ <%= menu_item "About Us", about_us_path %>
415
+ <%= menu_item "Contact", contact_path %>
416
+ <% end %>
417
+ <% if current_user %>
418
+ <%= menu_item "Log Out", log_out_path %>
419
+ <% else %>
420
+ <% menu_group :pull => :right do %>
421
+ <%= menu_item "Sign Up", registration_path %>
422
+ <% form_for @user, :url => session_path(:user) do |f| -%>
423
+ <p><%= f.text_field :email %></p>
424
+ <p><%= f.password_field :password %></p>
425
+ <p><%= f.submit "Sign in" %></p>
426
+ <% end -%>
427
+ <% end %>
428
+ <% end %>
429
+ <% end %>
430
+ ````
431
+
432
+ ### Dropdown menus
433
+
434
+ 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:
435
+
436
+ ````
437
+ <%= nav_bar do %>
438
+ <%= menu_item "Home", root_path %>
439
+
440
+ <%= drop_down "Products" do %>
441
+ <%= menu_item "Latest", latest_products_path %>
442
+ <%= menu_item "Top Sellers", popular_products_path %>
443
+ <%= drop_down_divider %>
444
+ <%= menu_item "Discount Items", discounted_products_path %>
445
+ <% end %>
446
+
447
+ <%= menu_item "About Us", about_us_path %>
448
+ <%= menu_item "Contact", contact_path %>
449
+ <% end %>
450
+ ````
451
+
452
+ ### Dividers
453
+
454
+ Dividers are just vertical bars that visually separate logically disparate groups of menu items
455
+
456
+ ````
457
+ <%= nav_bar :fixed => :bottom do %>
458
+ <%= menu_item "Home", root_path %>
459
+ <%= menu_item "About Us", about_us_path %>
460
+ <%= menu_item "Contact", contact_path %>
461
+
462
+ <%= menu_divider %>
463
+
464
+ <%= menu_item "Edit Profile", edit_user_path(current_user) %>
465
+ <%= menu_item "Account Settings", edit_user_account_path(current_user, @account) %>
466
+ <%= menu_item "Log Out", log_out_path %>
467
+ <% end %>
468
+ ````
469
+
470
+ ### Forms in navbar
471
+
472
+ At the moment - this is just a how to...
473
+
474
+ You need to add this class to the form itself (Different form builders do this in different ways - please check out the relevant docs)
475
+
476
+ ````css
477
+ .navbar-form
478
+ ````
479
+ To pull the form left or right, add either of these classes:
480
+ ````css
481
+ .pull-left
482
+ .pull-right
483
+ ````
484
+
485
+ If you want the Bootstrap search box (I think it just rounds the corners), use:
486
+ ````css
487
+ .navbar-search
488
+ ````
489
+ Instead of:
490
+ ````css
491
+ .navbar-form
492
+ ````
493
+
494
+ To change the size of the form fields, use .span2 (or however many span widths you want) to the input itself.
495
+
496
+ ### Component alignment
497
+
498
+ You can shift things to the left or the right across the nav bar. It's easiest to do this on grouped menu items:
499
+
500
+ ````
501
+ <%= nav_bar :fixed => :bottom do %>
502
+ <% menu_group do %>
503
+ <%= menu_item "Home", root_path %>
504
+ <%= menu_item "About Us", about_us_path %>
505
+ <%= menu_item "Contact", contact_path %>
506
+ <% end %>
507
+ <% menu_group :pull => :right do %>
508
+ <%= menu_item "Edit Profile", edit_user_path(current_user) %>
509
+ <%= menu_item "Account Settings", edit_user_account_path(current_user, @account) %>
510
+ <%= menu_item "Log Out", log_out_path %>
511
+ <% end %>
512
+ <% end %>
513
+ ````
514
+
515
+ ### Text in the navbar
516
+
517
+ If you want to put regular plain text in the navbar anywhere, you do it like this:
518
+
519
+ ````
520
+ <%= nav_bar :brand => "Apple" do %>
521
+ <%= menu_text "We make shiny things" %>
522
+ <%= menu_item "Home", root_path %>
523
+ <%= menu_item "About Us", about_us_path %>
524
+ <% end %>
525
+ ````
526
+ It also takes the :pull option to drag it to the left or right.
527
+
528
+
529
+ ### Flash helper
530
+
531
+ Add flash helper `<%= bootstrap_flash %>` to your layout (built-in with layout generator)
532
+
533
+ ### Breadcrumbs Helpers
534
+
535
+ *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.
536
+ You do not need to use these breadcrumb gems since this gem provides the same functionality out of the box without the additional dependency.
537
+
538
+ Add breadcrumbs helper `<%= render_breadcrumbs %>` to your layout.
539
+
540
+ ```ruby
541
+ class ApplicationController
542
+ add_breadcrumb :index, :root_path
543
+ end
544
+ ```
545
+
546
+ ```ruby
547
+ class ExamplesController < ApplicationController
548
+ add_breadcrumb :index, :examples_path
549
+
550
+ def index
551
+ end
552
+
553
+ def show
554
+ @example = Example.find params[:id]
555
+ add_breadcrumb @example.name, example_path(@example)
556
+ # add_breadcrumb :show, example_path(@example)
557
+ end
558
+ end
559
+ ```
560
+
561
+ ### Element utility helpers
562
+
563
+ Badge:
564
+ ```erb
565
+ <%= badge(12, :warning) %> <span class="badge badge-warning">12</span>
566
+ ```
567
+
568
+ Label:
569
+ ```erb
570
+ <%= label('Gut!', :success) %> <span class="badge badge-success">Gut!</span>
571
+ ```
572
+
573
+ Glyph:
574
+ ```erb
575
+ <%= glyph(:pencil) %> <i class="icon-pencil"></i>
576
+ ```
577
+
578
+ ###i18n Internationalization Support
579
+ The installer creates an english translation file for you and copies it to config/locales/en.bootstrap.yml
580
+
581
+
582
+ NOTE: If you are using Devise in your project, you must have a devise locale file
583
+ for handling flash messages, even if those messages are blank. See https://github.com/plataformatec/devise/wiki/I18n
584
+
585
+ ## Changelog
586
+ <ul>
587
+ <li>Version 0.0.5 deprecated</li>
588
+ <li>Asset files updated to latest and removed version numbers</li>
589
+ <li>Implemented Less::Rails Railtie to use with LESS</li>
590
+ <li>Fixed railtie to only initialize Less when installed</li>
591
+ <li>New branch for the static version of Bootstrap (w/o Less) - check static branch</li>
592
+ <li>Added path to support heroku deploy</li>
593
+ <li>Rake precompile issue fixed</li>
594
+ <li>Updated asset files to 1.4.0</li>
595
+ <li>Updated dependency less-rails (now requires 2.1.0)</li>
596
+ <li>Added generators</li>
597
+ <li>Fixed generators</li>
598
+ <li>Fixed class name conflicts from (bootstrap.js.coffee)</li>
599
+ <li>Fixed jquery-rails gem version dependency</li>
600
+ <li>Updated asset files</li>
601
+ <li>Added new generators (install, layout and themed)</li>
602
+ <li>Compability to Rails 3.2</li>
603
+ <li>Transitioning to 2.0</li>
604
+ <li>Released gem v.2.0rc0</li>
605
+ <li>Added Haml and Slim support</li>
606
+ <li>Added Responsive layout support</li>
607
+ <li>Fixes and release 2.0.0</li>
608
+ <li>Updated to v2.0.1, versioned v2.0.1.0</li>
609
+ <li>Released gem v.2.0.3</li>
610
+ <li>Released gem v.2.0.4</li>
611
+ <li>Released gem v.2.0.5</li>
612
+ <li>Added SimpleForm support</li>
613
+ <li>Added FontAwesome support</li>
614
+ <li>Released gem v.2.0.6</li>
615
+ <li>Released gem v.2.0.7</li>
616
+ <li>Released gem v.2.0.8</li>
617
+ <li>Released gem v.2.0.9 (Bootstrap 2.0.4 and FontAwesome 2.0 support)</li>
618
+ <li>Released gem v.2.1.0 (JRuby support)</li>
619
+ <li>Released gem v.2.1.1 (minor fixes)</li>
620
+ <li>Flash block message helper added</li>
621
+ <li>Released gem v.2.1.2 (minor fixes and updated to Twitter Bootstrap 2.1.0)</li>
622
+ <li>Released gem v.2.1.3 (minor fixes and updated to Twitter Bootstrap 2.1.1)</li>
623
+ <li>Released gem v.2.1.4 (minor fixes)</li>
624
+ <li>Released gem v.2.1.5 (minor fixes, install generator detects javascript template engine, updated to Twitter Bootstrap 2.2.1)</li>
625
+ <li>Released gem v.2.1.6 (minor fixes)</li>
626
+ <li>Added static stylesheets support</li>
627
+ <li>Released gem v.2.1.8 and updated to Twitter Bootstrap 2.2.2</li>
628
+ <li>Released gem v.2.1.9</li>
629
+ <li>Released gem v.2.2.0 (Font Awesome 3)</li>
630
+ <li>Released gem v.2.2.1 (minor fixes and updates)</li>
631
+ <li>Released gem v.2.2.2 (Bootstrap 2.3.0)</li>
632
+ <li>Released gem v.2.2.3 (Minor fixes)</li>
633
+ <li>Released gem v.2.2.4 (Minor fixes)</li>
634
+ <li>Released gem v.2.2.5 (Bootstrap 2.3.1)</li>
635
+ <li>Released gem v.2.2.6</li>
636
+ <li>Released gem v.2.2.7 (Fixes)</li>
637
+
638
+ </ul>
639
+
640
+
641
+ ## Contributors & Patches & Forks
642
+ <ul>
643
+ <li>Ben Lovell</li>
644
+ <li>Daniel Morris</li>
645
+ <li>Bradly Feeley</li>
646
+ <li>Guilherme Moreira</li>
647
+ <li>Alex Behar</li>
648
+ <li>Brandon Keene</li>
649
+ <li>Anthony Corcutt</li>
650
+ <li>Colin Warren</li>
651
+ <li>Giovanni Cappellotto</li>
652
+ <li>Masakuni Kato</li>
653
+ <li>Gudleik Rasch</li>
654
+ <li>Thomas Volkmar Worm</li>
655
+ <li>Thiago Almeida</li>
656
+ <li>Sébastien Grosjean</li>
657
+ <li>Nick DeSteffen</li>
658
+ <li>Christian Joudrey</li>
659
+ <li>Todd Baur</li>
660
+ <li>Leonid Shevtsov</li>
661
+ </ul>
662
+
663
+ ## About Me
664
+ Lead/ Senior Developer - Programmer @useful (Usefulideas) Istanbul / Turkey
665
+
666
+ ### Contact me
667
+ Seyhun Akyürek - seyhunak [at] gmail com
668
+
669
+ ### Follow me
670
+ <a href="http://zerply.com/seyhunak">
671
+ <img width="110" height="40" src="http://zerply.com/img/welcomesteps/zerply_logo.png" />
672
+ </a>
673
+
674
+ (Twitter, Facebook, Linkedin, Google+, Github)
675
+
676
+ http://zerply.com/seyhunak
677
+
678
+ ### Endorse me
679
+ <a href="http://coderwall.com/seyhunak">
680
+ <img src="http://api.coderwall.com/seyhunak/endorsecount.png" />
681
+ </a>
682
+
683
+ ### Klout me
684
+ <img src="https://addons.opera.com/media/extensions/55/14355/1.0.1-rev1/icons/icon_64x64.png"></img>
685
+
686
+ Please +K my influence in Ruby on Rails on @klout
687
+
688
+ http://klout.com/#/seyhunak
689
+
690
+
691
+ ### Want to donate?
692
+ <img src="https://www.paypalobjects.com/en_US/i/logo/PayPal_mark_50x34.gif"></img>
693
+
694
+ [Want to donate for my efforts? Show your love](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=W8ZLWQBREFP4U
695
+ "Donate")
696
+
697
+
698
+ ## Thanks
699
+ Twitter Bootstrap and all twitter-bootstrap-rails contributors
700
+ http://twitter.github.com/bootstrap
701
+
702
+
703
+ ## License
704
+ Copyright (c) 2012 Seyhun Akyürek
705
+
706
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
707
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
708
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.