rbootstrap 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. data/README.md +282 -0
  2. data/Rakefile +14 -0
  3. data/app/helpers/bootstrap_flash_helper.rb +17 -0
  4. data/app/helpers/flash_block_helper.rb +17 -0
  5. data/app/helpers/glyph_helper.rb +12 -0
  6. data/app/helpers/modal_helper.rb +42 -0
  7. data/app/helpers/twitter_breadcrumbs_helper.rb +5 -0
  8. data/app/views/twitter-bootstrap/_breadcrumbs.html.erb +14 -0
  9. data/lib/generators/bootstrap/install/install_generator.rb +57 -0
  10. data/lib/generators/bootstrap/install/templates/application.css +7 -0
  11. data/lib/generators/bootstrap/install/templates/application.js +10 -0
  12. data/lib/generators/bootstrap/install/templates/bootstrap.coffee +4 -0
  13. data/lib/generators/bootstrap/install/templates/bootstrap.js +5 -0
  14. data/lib/generators/bootstrap/install/templates/bootstrap_and_overrides.less +31 -0
  15. data/lib/generators/bootstrap/layout/layout_generator.rb +23 -0
  16. data/lib/generators/bootstrap/layout/templates/layout.html.erb +108 -0
  17. data/lib/generators/bootstrap/layout/templates/layout.html.haml +68 -0
  18. data/lib/generators/bootstrap/layout/templates/layout.html.slim +68 -0
  19. data/lib/generators/bootstrap/partial/partial_generator.rb +20 -0
  20. data/lib/generators/bootstrap/partial/templates/_login.html.erb +29 -0
  21. data/lib/generators/bootstrap/partial/templates/_navbar.html.erb +13 -0
  22. data/lib/generators/bootstrap/themed/templates/_form.html.erb +16 -0
  23. data/lib/generators/bootstrap/themed/templates/_form.html.haml +10 -0
  24. data/lib/generators/bootstrap/themed/templates/_form.html.slim +11 -0
  25. data/lib/generators/bootstrap/themed/templates/edit.html.erb +6 -0
  26. data/lib/generators/bootstrap/themed/templates/edit.html.haml +4 -0
  27. data/lib/generators/bootstrap/themed/templates/edit.html.slim +4 -0
  28. data/lib/generators/bootstrap/themed/templates/index.html.erb +40 -0
  29. data/lib/generators/bootstrap/themed/templates/index.html.haml +25 -0
  30. data/lib/generators/bootstrap/themed/templates/index.html.slim +27 -0
  31. data/lib/generators/bootstrap/themed/templates/new.html.erb +6 -0
  32. data/lib/generators/bootstrap/themed/templates/new.html.haml +4 -0
  33. data/lib/generators/bootstrap/themed/templates/new.html.slim +4 -0
  34. data/lib/generators/bootstrap/themed/templates/show.html.erb +23 -0
  35. data/lib/generators/bootstrap/themed/templates/show.html.haml +15 -0
  36. data/lib/generators/bootstrap/themed/templates/show.html.slim +17 -0
  37. data/lib/generators/bootstrap/themed/templates/simple_form/_form.html.erb +14 -0
  38. data/lib/generators/bootstrap/themed/templates/simple_form/_form.html.haml +11 -0
  39. data/lib/generators/bootstrap/themed/templates/simple_form/_form.html.slim +12 -0
  40. data/lib/generators/bootstrap/themed/themed_generator.rb +110 -0
  41. data/lib/twitter-bootstrap-rails.rb +10 -0
  42. data/lib/twitter/bootstrap/rails/bootstrap.rb +2 -0
  43. data/lib/twitter/bootstrap/rails/engine.rb +29 -0
  44. data/lib/twitter/bootstrap/rails/twitter-bootstrap-breadcrumbs.rb +30 -0
  45. data/lib/twitter/bootstrap/rails/version.rb +7 -0
  46. data/vendor/assets/fonts/fontawesome-webfont.eot +0 -0
  47. data/vendor/assets/fonts/fontawesome-webfont.svg +255 -0
  48. data/vendor/assets/fonts/fontawesome-webfont.ttf +0 -0
  49. data/vendor/assets/fonts/fontawesome-webfont.woff +0 -0
  50. data/vendor/assets/images/twitter/bootstrap/glyphicons-halflings-white.png +0 -0
  51. data/vendor/assets/images/twitter/bootstrap/glyphicons-halflings.png +0 -0
  52. data/vendor/assets/javascripts/twitter/bootstrap.js +13 -0
  53. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-affix.js +106 -0
  54. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-alert.js +88 -0
  55. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-button.js +94 -0
  56. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-carousel.js +176 -0
  57. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-collapse.js +156 -0
  58. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-dropdown.js +148 -0
  59. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-modal.js +234 -0
  60. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-popover.js +103 -0
  61. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-scrollspy.js +151 -0
  62. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-tab.js +133 -0
  63. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-tooltip.js +276 -0
  64. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-transition.js +60 -0
  65. data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-typeahead.js +311 -0
  66. data/vendor/assets/javascripts/twitter/bootstrap_ujs.js +11 -0
  67. data/vendor/toolkit/font-awesome-ie7.less +245 -0
  68. data/vendor/toolkit/fontawesome.less +328 -0
  69. data/vendor/toolkit/twitter/bootstrap/accordion.less +34 -0
  70. data/vendor/toolkit/twitter/bootstrap/alerts.less +65 -0
  71. data/vendor/toolkit/twitter/bootstrap/bootstrap.less +63 -0
  72. data/vendor/toolkit/twitter/bootstrap/breadcrumbs.less +24 -0
  73. data/vendor/toolkit/twitter/bootstrap/button-groups.less +242 -0
  74. data/vendor/toolkit/twitter/bootstrap/buttons.less +232 -0
  75. data/vendor/toolkit/twitter/bootstrap/carousel.less +131 -0
  76. data/vendor/toolkit/twitter/bootstrap/close.less +31 -0
  77. data/vendor/toolkit/twitter/bootstrap/code.less +59 -0
  78. data/vendor/toolkit/twitter/bootstrap/component-animations.less +22 -0
  79. data/vendor/toolkit/twitter/bootstrap/dropdowns.less +237 -0
  80. data/vendor/toolkit/twitter/bootstrap/forms.less +683 -0
  81. data/vendor/toolkit/twitter/bootstrap/grid.less +21 -0
  82. data/vendor/toolkit/twitter/bootstrap/hero-unit.less +25 -0
  83. data/vendor/toolkit/twitter/bootstrap/labels-badges.less +74 -0
  84. data/vendor/toolkit/twitter/bootstrap/layouts.less +16 -0
  85. data/vendor/toolkit/twitter/bootstrap/media.less +55 -0
  86. data/vendor/toolkit/twitter/bootstrap/mixins.less +686 -0
  87. data/vendor/toolkit/twitter/bootstrap/modals.less +94 -0
  88. data/vendor/toolkit/twitter/bootstrap/navbar.less +472 -0
  89. data/vendor/toolkit/twitter/bootstrap/navs.less +385 -0
  90. data/vendor/toolkit/twitter/bootstrap/pager.less +41 -0
  91. data/vendor/toolkit/twitter/bootstrap/pagination.less +121 -0
  92. data/vendor/toolkit/twitter/bootstrap/popovers.less +117 -0
  93. data/vendor/toolkit/twitter/bootstrap/progress-bars.less +122 -0
  94. data/vendor/toolkit/twitter/bootstrap/reset.less +138 -0
  95. data/vendor/toolkit/twitter/bootstrap/responsive-1200px-min.less +28 -0
  96. data/vendor/toolkit/twitter/bootstrap/responsive-767px-max.less +193 -0
  97. data/vendor/toolkit/twitter/bootstrap/responsive-768px-979px.less +19 -0
  98. data/vendor/toolkit/twitter/bootstrap/responsive-navbar.less +185 -0
  99. data/vendor/toolkit/twitter/bootstrap/responsive-utilities.less +43 -0
  100. data/vendor/toolkit/twitter/bootstrap/responsive.less +48 -0
  101. data/vendor/toolkit/twitter/bootstrap/scaffolding.less +52 -0
  102. data/vendor/toolkit/twitter/bootstrap/sprites.less +193 -0
  103. data/vendor/toolkit/twitter/bootstrap/tables.less +236 -0
  104. data/vendor/toolkit/twitter/bootstrap/thumbnails.less +52 -0
  105. data/vendor/toolkit/twitter/bootstrap/tooltip.less +70 -0
  106. data/vendor/toolkit/twitter/bootstrap/type.less +230 -0
  107. data/vendor/toolkit/twitter/bootstrap/utilities.less +30 -0
  108. data/vendor/toolkit/twitter/bootstrap/variables.less +301 -0
  109. data/vendor/toolkit/twitter/bootstrap/wells.less +29 -0
  110. data/vendor/toolkit/twitter/bootstrap_base.less +2 -0
  111. metadata +224 -0
data/README.md ADDED
@@ -0,0 +1,282 @@
1
+ # Twitter Bootstrap RTL(rbootstrap) 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
+ rbootstrap project integrates Bootstrap CSS toolkit for Rails 3.1 Asset Pipeline (Rails 3.2 supported)
5
+
6
+ [![Build Status](https://secure.travis-ci.org/jnaqsh/twitter-bootstrap-rails.png)](http://travis-ci.org/jnaqsh/twitter-bootstrap-rails)
7
+ [![Dependency Status](https://gemnasium.com/jnaqsh/twitter-bootstrap-rails.png)](https://gemnasium.com/jnaqsh/twitter-bootstrap-rails)
8
+ [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/jnaqsh/twitter-bootstrap-rails)
9
+ [![Still Maintained](https://a248.e.akamai.net/camo.github.com/9c977523be7fce95c026a1b7d9673903f82e59cd/687474703a2f2f7374696c6c6d61696e7461696e65642e636f6d2f7374696c6c6d61696e7461696e65642f7374696c6c6d61696e7461696e65642e706e67)](http://stillmaintained.com/jnaqsh/twitter-bootstrap-rails)
10
+
11
+
12
+ ## Screencasts
13
+ #### Installing twitter-bootstrap-rails, generators, usage and more
14
+ <img width="180" height="35" src="http://oi49.tinypic.com/s5wn05.jpg"></img>
15
+
16
+ Screencasts provided by <a href="http://railscasts.com">Railscasts</a> (Ryan Bates)
17
+
18
+ [Twitter Bootstrap Basics](http://railscasts.com/episodes/328-twitter-bootstrap-basics "Twitter Bootstrap Basics")
19
+ in this episode you will learn how to include Twitter Bootstrap into Rails application with the twitter-bootstrap-rails gem.
20
+
21
+ [More on Twitter Bootstrap](http://railscasts.com/episodes/329-more-on-twitter-bootstrap "More on Twitter Bootstrap")
22
+ 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.
23
+ (Note: This episode is pro episode)
24
+
25
+
26
+ ## Example Application
27
+ 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.
28
+
29
+
30
+ ## Installing Gem
31
+ The gem includes the source LESS and JS files. You'll need to choose a javascript runtime.
32
+ ExecJS supports these runtimes:
33
+
34
+ * [therubyracer](https://github.com/cowboyd/therubyracer) - Google V8
35
+ embedded within Ruby
36
+ * [therubyrhino](https://github.com/cowboyd/therubyrhino) - Mozilla
37
+ Rhino embedded within JRuby
38
+ * [Node.js](http://nodejs.org/)
39
+ * Apple JavaScriptCore - Included with Mac OS X
40
+ * [Microsoft Windows Script Host](http://msdn.microsoft.com/en-us/library/9bbdkx3k.aspx) (JScript)
41
+
42
+ Include the [Twitter Bootstrap Rails gem](http://rubygems.org/gems/rbootstrap) in Gemfile to install it from [RubyGems.org](http://rubygems.org):
43
+
44
+ ```ruby
45
+ gem "therubyracer"
46
+ gem "less-rails" #Sprockets (what Rails 3.1 uses for its asset pipeline) supports LESS
47
+ gem "rbootstrap"
48
+ ```
49
+
50
+ or you can install from latest build;
51
+
52
+ ```ruby
53
+ gem 'rbootstrap', :git => 'git://github.com/jnaqsh/twitter-bootstrap-rails.git'
54
+ ```
55
+
56
+ You can run bundle from command line
57
+
58
+ bundle install
59
+
60
+
61
+ ## Installing to App (using Generators)
62
+
63
+ You can run following generators to get started with Twitter Bootstrap quickly.
64
+
65
+
66
+ Install (requires directives to Asset pipeline.)
67
+
68
+
69
+ Usage:
70
+
71
+
72
+ rails g bootstrap:install
73
+
74
+
75
+ Layout (generates Twitter Bootstrap compatible layout) - (Haml and Slim supported)
76
+
77
+
78
+ Usage:
79
+
80
+
81
+ rails g bootstrap:layout [LAYOUT_NAME] [*fixed or fluid]
82
+
83
+
84
+ Example:
85
+
86
+
87
+ rails g bootstrap:layout application fixed
88
+
89
+
90
+ Themed (generates Twitter Bootstrap compatible scaffold views.) - (Haml and Slim supported)
91
+
92
+
93
+ Usage:
94
+
95
+
96
+ rails g bootstrap:themed [RESOURCE_NAME]
97
+
98
+
99
+ Example:
100
+
101
+
102
+ rails g scaffold Post title:string description:text
103
+ rake db:migrate
104
+ rails g bootstrap:themed Posts
105
+
106
+ Notice the plural usage of the resource to generate bootstrap:themed.
107
+
108
+ ## Using with Less
109
+
110
+ 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.
111
+
112
+ ## Using stylesheets with Less
113
+
114
+ You have to require Bootstrap LESS (bootstrap_and_overrides.css.less) in your application.css
115
+
116
+ ```css
117
+ /*
118
+ *= require bootstrap_and_overrides
119
+ */
120
+
121
+ /* Your stylesheets goes here... */
122
+ ```
123
+
124
+ To use individual components from bootstrap, your bootstrap_and_overrides.less could look like this:
125
+
126
+ ```css
127
+ @import "twitter/bootstrap/reset.less";
128
+ @import "twitter/bootstrap/variables.less";
129
+ @import "twitter/bootstrap/mixins.less";
130
+ @import "twitter/bootstrap/scaffolding.less";
131
+ @import "twitter/bootstrap/grid.less";
132
+ @import "twitter/bootstrap/layouts.less";
133
+ @import "twitter/bootstrap/type.less";
134
+ @import "twitter/bootstrap/forms.less";
135
+ @import "twitter/bootstrap/wells.less";
136
+ @import "twitter/bootstrap/component-animations.less";
137
+ @import "twitter/bootstrap/buttons.less";
138
+ @import "twitter/bootstrap/close.less";
139
+ @import "twitter/bootstrap/navs.less";
140
+ @import "twitter/bootstrap/navbar.less";
141
+ @import "twitter/bootstrap/labels-badges.less";
142
+ @import "twitter/bootstrap/hero-unit.less";
143
+ @import "twitter/bootstrap/utilities.less";
144
+ @import "twitter/bootstrap/responsive";
145
+ ```
146
+
147
+ If you'd like to alter Bootstrap's own variables, or define your LESS
148
+ styles inheriting Bootstrap's mixins, you can do so inside bootstrap_and_overrides.css.less:
149
+
150
+ ```css
151
+ @linkColor: #ff0000;
152
+ ```
153
+
154
+
155
+ ## Using Javascripts
156
+
157
+ You have to require Bootstrap JS (bootstrap.js) in your application.js
158
+
159
+ ```js
160
+ //= require twitter/bootstrap
161
+
162
+ $(document).ready(function(){
163
+ /* Your javascripts goes here... */
164
+ });
165
+ ```
166
+
167
+ If you want to customize what is loaded, your application.js would look something like this
168
+
169
+ ```js
170
+ #= require jquery
171
+ #= require jquery_ujs
172
+ #= require twitter/bootstrap/bootstrap-transition
173
+ #= require twitter/bootstrap/bootstrap-alert
174
+ #= require twitter/bootstrap/bootstrap-modal
175
+ #= require twitter/bootstrap/bootstrap-button
176
+ #= require twitter/bootstrap/bootstrap-collapse
177
+ ```
178
+
179
+ ...and so on for each bootstrap js component.
180
+
181
+ ## Using Coffeescript (optionally)
182
+
183
+ Using Twitter Bootstrap with the CoffeeScript is easy.
184
+ twitter-bootstrap-rails generates a "bootstrap.js.coffee" file for you
185
+ to /app/assets/javascripts/ folder.
186
+
187
+ ```coffee
188
+ jQuery ->
189
+ $("a[rel=popover]").popover()
190
+ $(".tooltip").tooltip()
191
+ $("a[rel=tooltip]").tooltip()
192
+ ```
193
+
194
+ ## Using Helpers
195
+
196
+ ### Flash helper
197
+ Add flash helper <%= bootstrap_flash %> to your layout (built-in with layout generator)
198
+
199
+
200
+ ## Changelog
201
+ <ul>
202
+ <li>Version 0.0.5 deprecated</li>
203
+ <li>Asset files updated to latest and removed version numbers</li>
204
+ <li>Implemented Less::Rails Railtie to use with LESS</li>
205
+ <li>Fixed railtie to only initialize Less when installed</li>
206
+ <li>New branch for the static version of Bootstrap (w/o Less) - check static branch</li>
207
+ <li>Added path to support heroku deploy</li>
208
+ <li>Rake precompile issue fixed</li>
209
+ <li>Updated asset files to 1.4.0</li>
210
+ <li>Updated dependency less-rails (now requires 2.1.0)</li>
211
+ <li>Added generators</li>
212
+ <li>Fixed generators</li>
213
+ <li>Fixed class name conflicts from (bootstrap.js.coffee)</li>
214
+ <li>Fixed jquery-rails gem version dependency</li>
215
+ <li>Updated asset files</li>
216
+ <li>Added new generators (install, layout and themed)</li>
217
+ <li>Compability to Rails 3.2</li>
218
+ <li>Transitioning to 2.0</li>
219
+ <li>Released gem v.2.0rc0</li>
220
+ <li>Added Haml and Slim support</li>
221
+ <li>Added Responsive layout support</li>
222
+ <li>Fixes and release 2.0.0</li>
223
+ <li>Updated to v2.0.1, versioned v2.0.1.0</li>
224
+ <li>Released gem v.2.0.3</li>
225
+ <li>Released gem v.2.0.4</li>
226
+ <li>Released gem v.2.0.5</li>
227
+ <li>Added SimpleForm support</li>
228
+ <li>Added FontAwesome support</li>
229
+ <li>Released gem v.2.0.6</li>
230
+ <li>Released gem v.2.0.7</li>
231
+ <li>Released gem v.2.0.8</li>
232
+ <li>Released gem v.2.0.9 (Bootstrap 2.0.4 and FontAwesome 2.0 support)</li>
233
+ <li>Released gem v.2.1.0 (JRuby support)</li>
234
+ <li>Released gem v.2.1.1 (minor fixes)</li>
235
+ <li>Flash block message helper added</li>
236
+ <li>Released gem v.2.1.2 (minor fixes and updated to Twitter Bootstrap 2.1.0)</li>
237
+ <li>Released gem v.2.1.3 (minor fixes and updated to Twitter Bootstrap 2.1.1)</li>
238
+ <li>Released gem v.2.1.4 (minor fixes)</li>
239
+ <li>Released gem v.2.1.5 (minor fixes, install generator detects javascript template engine, updated to Twitter Bootstrap 2.2.1)</li>
240
+ <li>Released gem v.2.1.6 (minor fixes)</li>
241
+ </ul>
242
+
243
+
244
+ ## Contributors & Patches & Forks
245
+ <ul>
246
+ <li>Daniel Morris</li>
247
+ <li>Bradly Feeley</li>
248
+ <li>Guilherme Moreira</li>
249
+ <li>Alex Behar</li>
250
+ <li>Brandon Keene</li>
251
+ <li>Anthony Corcutt</li>
252
+ <li>Colin Warren</li>
253
+ <li>Giovanni Cappellotto</li>
254
+ <li>Masakuni Kato</li>
255
+ <li>Gudleik Rasch</li>
256
+ <li>Thomas Volkmar Worm</li>
257
+ <li>Thiago Almeida</li>
258
+ <li>Sébastien Grosjean</li>
259
+ <li>Nick DeSteffen</li>
260
+ <li>Christian Joudrey</li>
261
+ <li>Todd Baur</li>
262
+ </ul>
263
+
264
+
265
+ ### Future
266
+ <ul>
267
+ <li>Writing tests (not implemented yet)</li>
268
+ <li>Markup Helpers (alert, tabs, pagination, breadcrumbs etc.)</li>
269
+ </ul>
270
+
271
+
272
+ ## Thanks
273
+ Twitter Bootstrap and all twitter-bootstrap-rails contributors
274
+ http://twitter.github.com/bootstrap
275
+
276
+
277
+ ## License
278
+ Copyright (c) 2012 Jnaqsh Inc.
279
+
280
+ 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:
281
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
282
+ 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.
data/Rakefile ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env rake
2
+ require 'bundler'
3
+ Bundler::GemHelper.install_tasks
4
+
5
+ desc "Bundle the gem"
6
+ task :bundle do
7
+ sh('bundle install')
8
+ sh 'gem build *.gemspec'
9
+ sh 'gem install *.gem'
10
+ sh 'rm *.gem'
11
+ end
12
+
13
+ task(:default).clear
14
+ task :default => :bundle
@@ -0,0 +1,17 @@
1
+ module BootstrapFlashHelper
2
+ def bootstrap_flash
3
+ flash_messages = []
4
+ flash.each do |type, message|
5
+ # Skip Devise :timeout and :timedout flags
6
+ next if type == :timeout
7
+ next if type == :timedout
8
+ type = :success if type == :notice
9
+ type = :error if type == :alert
10
+ text = content_tag(:div,
11
+ content_tag(:button, raw("&times;"), :class => "close", "data-dismiss" => "alert") +
12
+ message, :class => "alert fade in alert-#{type}")
13
+ flash_messages << text if message
14
+ end
15
+ flash_messages.join("\n").html_safe
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ module FlashBlockHelper
2
+ def flash_block
3
+ output = ''
4
+ flash.each do |type, message|
5
+ output += flash_container(type, message)
6
+ end
7
+
8
+ raw(output)
9
+ end
10
+
11
+ def flash_container(type, message)
12
+ raw(content_tag(:div, :class => "alert alert-#{type}") do
13
+ content_tag(:a, raw("&times;"),:class => 'close', :data => {:dismiss => 'alert'}) +
14
+ message
15
+ end)
16
+ end
17
+ end
@@ -0,0 +1,12 @@
1
+ module GlyphHelper
2
+ # ==== Examples
3
+ # glyph(:share_alt)
4
+ # # => <i class="icon-share-alt"></i>
5
+ # glyph(:lock, :white)
6
+ # # => <i class="icon-lock icon-white"></i>
7
+
8
+ def glyph(*names)
9
+ content_tag :i, nil, :class => names.map{|name| "icon-#{name.to_s.gsub('_','-')}" }
10
+ end
11
+ end
12
+
@@ -0,0 +1,42 @@
1
+ module ModalHelper
2
+ def modal_dialog(options = {}, escape = true, &block)
3
+ default_options = {:class => "bootstrap-modal modal"}
4
+ content_tag :div, nil, options.merge(default_options), escape, &block
5
+ end
6
+
7
+ def modal_header(options = {}, escape = true, &block)
8
+ default_options = {:class => 'modal-header'}
9
+ content_tag :div, nil, options.merge(default_options), escape do
10
+ raw("<button class=\"close\" data-dismiss=\"modal\">&times;</button>" + capture(&block))
11
+ end
12
+ end
13
+
14
+ def modal_body(options = {}, escape = true, &block)
15
+ default_options = {:class => 'modal-body'}
16
+ content_tag :div, nil, options.merge(default_options), escape, &block
17
+ end
18
+
19
+ def modal_footer(options = {}, escape = true, &block)
20
+ default_options = {:class => 'modal-footer'}
21
+ content_tag :div, nil, options.merge(default_options), escape, &block
22
+ end
23
+
24
+ def modal_toggle(content_or_options = nil, options = {}, &block)
25
+ if block_given?
26
+ options = content_or_options if content_or_options.is_a?(Hash)
27
+ default_options = {:class => 'btn', "data-toggle" => "modal", "href" => options[:dialog]}.merge(options)
28
+
29
+ content_tag :a, nil, default_options, true, &block
30
+ else
31
+ default_options = {:class => 'btn', "data-toggle" => "modal", "href" => options[:dialog]}.merge(options)
32
+ content_tag :a, content_or_options, default_options, true
33
+ end
34
+ end
35
+
36
+ def modal_cancel_button content, options = {}
37
+ default_options = {:class => "btn bootstrap-modal-cancel-button"}
38
+
39
+ content_tag_string "a", content, default_options.merge(options)
40
+ end
41
+ end
42
+
@@ -0,0 +1,5 @@
1
+ module TwitterBreadcrumbsHelper
2
+ def render_breadcrumbs(divider = '/')
3
+ render :partial => 'twitter-bootstrap/breadcrumbs', :locals => { :divider => divider }
4
+ end
5
+ end
@@ -0,0 +1,14 @@
1
+ <% if @breadcrumbs.present? %>
2
+ <ul class="breadcrumb">
3
+ <% separator = divider %>
4
+ <% @breadcrumbs[0..-2].each do |crumb| %>
5
+ <li>
6
+ <%= link_to crumb[:name], crumb[:url], crumb[:options] %>
7
+ <span class="divider"><%= separator %></span>
8
+ </li>
9
+ <% end %>
10
+ <li class="active">
11
+ <%= @breadcrumbs.last[:name] %>
12
+ </li>
13
+ </ul>
14
+ <% end %>
@@ -0,0 +1,57 @@
1
+ require 'rails/generators'
2
+
3
+ module Bootstrap
4
+ module Generators
5
+ class InstallGenerator < ::Rails::Generators::Base
6
+
7
+ source_root File.expand_path("../templates", __FILE__)
8
+ desc "This generator installs Twitter Bootstrap to Asset Pipeline"
9
+
10
+ def add_assets
11
+
12
+ if File.exist?('app/assets/javascripts/application.js')
13
+ insert_into_file "app/assets/javascripts/application.js", "//= require twitter/bootstrap\n", :after => "jquery_ujs\n"
14
+ else
15
+ copy_file "application.js", "app/assets/javascripts/application.js"
16
+ end
17
+
18
+ if File.exist?('app/assets/stylesheets/application.css')
19
+ # Add our own require:
20
+ content = File.read("app/assets/stylesheets/application.css")
21
+ if content.match(/require_tree\s+\.\s*$/)
22
+ # Good enough - that'll include our bootstrap_and_overrides.css.less
23
+ else
24
+ style_require_block = " *= require bootstrap_and_overrides\n"
25
+ insert_into_file "app/assets/stylesheets/application.css", style_require_block, :after => "require_self\n"
26
+ end
27
+ else
28
+ copy_file "application.css", "app/assets/stylesheets/application.css"
29
+ end
30
+
31
+ end
32
+
33
+ def add_bootstrap
34
+ if Rails.configuration.app_generators.rails[:javascript_engine] == :coffee
35
+ copy_file "bootstrap.coffee", "app/assets/javascripts/bootstrap.js.coffee"
36
+ else
37
+ copy_file "bootstrap.js", "app/assets/javascripts/bootstrap.js"
38
+ end
39
+ copy_file "bootstrap_and_overrides.less", "app/assets/stylesheets/bootstrap_and_overrides.css.less"
40
+ end
41
+
42
+ def cleanup_legacy
43
+ # Remove old requires (if any) that included twitter/bootstrap directly:
44
+ gsub_file("app/assets/stylesheets/application.css", %r|\s*\*=\s*twitter/bootstrap\s*\n|, "")
45
+ gsub_file("app/assets/stylesheets/application.css", %r|\s*\*=\s*twitter/bootstrap_responsive\s*\n|, "")
46
+ if File.exist?('app/assets/stylesheets/bootstrap_override.css.less')
47
+ puts <<-EOM
48
+ Warning:
49
+ app/assets/stylesheets/bootstrap_override.css.less exists
50
+ It should be removed, as it has been superceded by app/assets/stylesheets/bootstrap_and_overrides.css.less
51
+ EOM
52
+ end
53
+ end
54
+
55
+ end
56
+ end
57
+ end