twitter-bootstrap-rails 2.1.6 → 2.1.7
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 +94 -51
- data/Rakefile +20 -0
- data/app/helpers/bootstrap_flash_helper.rb +2 -1
- data/lib/generators/bootstrap/install/install_generator.rb +15 -2
- data/lib/generators/bootstrap/install/templates/bootstrap_and_overrides.css +7 -0
- data/lib/generators/bootstrap/install/templates/bootstrap_and_overrides.less +2 -1
- data/lib/generators/bootstrap/layout/templates/layout.html.erb +1 -1
- data/lib/generators/bootstrap/layout/templates/layout.html.haml +1 -1
- data/lib/generators/bootstrap/layout/templates/layout.html.slim +1 -1
- data/lib/generators/bootstrap/themed/themed_generator.rb +45 -7
- data/lib/twitter/bootstrap/rails/engine.rb +5 -4
- data/lib/twitter/bootstrap/rails/version.rb +1 -1
- data/vendor/assets/stylesheets/twitter-bootstrap-static/bootstrap.css.erb +867 -0
- data/vendor/assets/stylesheets/twitter-bootstrap-static/fontawesome.css.erb +218 -0
- data/vendor/assets/stylesheets/twitter-bootstrap-static/sprites.css.erb +146 -0
- data/vendor/static-source/bootstrap.less +2 -0
- data/vendor/static-source/fontawesome.less +7 -0
- data/vendor/static-source/sprites.less +5 -0
- data/vendor/toolkit/fontawesome.less +0 -1
- metadata +39 -10
data/README.md
CHANGED
@@ -6,32 +6,41 @@ twitter-bootstrap-rails project integrates Bootstrap CSS toolkit for Rails 3.1 A
|
|
6
6
|
[![Build Status](https://secure.travis-ci.org/seyhunak/twitter-bootstrap-rails.png)](http://travis-ci.org/seyhunak/twitter-bootstrap-rails)
|
7
7
|
[![Dependency Status](https://gemnasium.com/seyhunak/twitter-bootstrap-rails.png)](https://gemnasium.com/seyhunak/twitter-bootstrap-rails)
|
8
8
|
[![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/seyhunak/twitter-bootstrap-rails)
|
9
|
+
[![Still Maintained](https://a248.e.akamai.net/camo.github.com/9c977523be7fce95c026a1b7d9673903f82e59cd/687474703a2f2f7374696c6c6d61696e7461696e65642e636f6d2f7374696c6c6d61696e7461696e65642f7374696c6c6d61696e7461696e65642e706e67)](http://stillmaintained.com/seyhunak/twitter-bootstrap-rails)
|
10
|
+
|
9
11
|
|
10
12
|
## Screencasts
|
11
13
|
#### Installing twitter-bootstrap-rails, generators, usage and more
|
12
|
-
|
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)
|
13
17
|
|
14
18
|
[Twitter Bootstrap Basics](http://railscasts.com/episodes/328-twitter-bootstrap-basics "Twitter Bootstrap Basics")
|
15
19
|
in this episode you will learn how to include Twitter Bootstrap into Rails application with the twitter-bootstrap-rails gem.
|
16
20
|
|
17
|
-
[More on Twitter Bootstrap](http://railscasts.com/episodes/329-more-on-twitter-bootstrap "More on Twitter Bootstrap")
|
21
|
+
[More on Twitter Bootstrap](http://railscasts.com/episodes/329-more-on-twitter-bootstrap "More on Twitter Bootstrap")
|
18
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.
|
19
23
|
(Note: This episode is pro episode)
|
20
24
|
|
21
25
|
|
22
|
-
##
|
23
|
-
|
24
|
-
|
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 the Gem
|
31
|
+
|
32
|
+
The [Twitter Bootstrap Rails gem](http://rubygems.org/gems/twitter-bootstrap-rails) can provide the Twitter Bootstrap stylesheets in two ways.
|
33
|
+
|
34
|
+
The plain CSS way is how Twitter Bootstrap is provided on [the official website](http://twitter.github.com/bootstrap/).
|
25
35
|
|
26
|
-
|
27
|
-
|
28
|
-
* [therubyrhino](https://github.com/cowboyd/therubyrhino) - Mozilla
|
29
|
-
Rhino embedded within JRuby
|
30
|
-
* [Node.js](http://nodejs.org/)
|
31
|
-
* Apple JavaScriptCore - Included with Mac OS X
|
32
|
-
* [Microsoft Windows Script Host](http://msdn.microsoft.com/en-us/library/9bbdkx3k.aspx) (JScript)
|
36
|
+
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
|
37
|
+
Less gem and the Ruby Racer Javascript runtime (not available on Microsoft Windows).
|
33
38
|
|
34
|
-
|
39
|
+
### Installing the Less stylesheets
|
40
|
+
|
41
|
+
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).
|
42
|
+
|
43
|
+
Include these lines in the Gemfile to install the gems from [RubyGems.org](http://rubygems.org):
|
35
44
|
|
36
45
|
```ruby
|
37
46
|
gem "therubyracer"
|
@@ -45,23 +54,29 @@ or you can install from latest build;
|
|
45
54
|
gem 'twitter-bootstrap-rails', :git => 'git://github.com/seyhunak/twitter-bootstrap-rails.git'
|
46
55
|
```
|
47
56
|
|
48
|
-
|
57
|
+
Then run `bundle install` from the command line:
|
49
58
|
|
50
59
|
bundle install
|
51
60
|
|
61
|
+
Then run the boostrap generator to add Bootstrap includes into your assets:
|
52
62
|
|
53
|
-
|
63
|
+
rails generate bootstrap:install less
|
54
64
|
|
55
|
-
|
65
|
+
### Installing the CSS stylesheets
|
56
66
|
|
67
|
+
If you don't need to customize the stylesheets using Less, the only gem you need is the `twitter-bootstrap-rails` gem:
|
57
68
|
|
58
|
-
|
69
|
+
```ruby
|
70
|
+
gem "twitter-bootstrap-rails"
|
71
|
+
```
|
59
72
|
|
73
|
+
After running `bundle install`, run the generator:
|
60
74
|
|
61
|
-
|
75
|
+
rails generate bootstrap:install static
|
62
76
|
|
77
|
+
## Generating layouts and views
|
63
78
|
|
64
|
-
|
79
|
+
You can run following generators to get started with Twitter Bootstrap quickly.
|
65
80
|
|
66
81
|
|
67
82
|
Layout (generates Twitter Bootstrap compatible layout) - (Haml and Slim supported)
|
@@ -113,6 +128,29 @@ You have to require Bootstrap LESS (bootstrap_and_overrides.css.less) in your ap
|
|
113
128
|
/* Your stylesheets goes here... */
|
114
129
|
```
|
115
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
|
+
@import "twitter/bootstrap/responsive";
|
152
|
+
```
|
153
|
+
|
116
154
|
If you'd like to alter Bootstrap's own variables, or define your LESS
|
117
155
|
styles inheriting Bootstrap's mixins, you can do so inside bootstrap_and_overrides.css.less:
|
118
156
|
|
@@ -133,6 +171,20 @@ $(document).ready(function(){
|
|
133
171
|
});
|
134
172
|
```
|
135
173
|
|
174
|
+
If you want to customize what is loaded, your application.js would look something like this
|
175
|
+
|
176
|
+
```js
|
177
|
+
#= require jquery
|
178
|
+
#= require jquery_ujs
|
179
|
+
#= require twitter/bootstrap/bootstrap-transition
|
180
|
+
#= require twitter/bootstrap/bootstrap-alert
|
181
|
+
#= require twitter/bootstrap/bootstrap-modal
|
182
|
+
#= require twitter/bootstrap/bootstrap-button
|
183
|
+
#= require twitter/bootstrap/bootstrap-collapse
|
184
|
+
```
|
185
|
+
|
186
|
+
...and so on for each bootstrap js component.
|
187
|
+
|
136
188
|
## Using Coffeescript (optionally)
|
137
189
|
|
138
190
|
Using Twitter Bootstrap with the CoffeeScript is easy.
|
@@ -151,19 +203,6 @@ jQuery ->
|
|
151
203
|
### Flash helper
|
152
204
|
Add flash helper <%= bootstrap_flash %> to your layout (built-in with layout generator)
|
153
205
|
|
154
|
-
|
155
|
-
## Using Static CSS, JS (w/o Less)
|
156
|
-
|
157
|
-
twitter-bootstrap-rails has seperate branch (w/o Less) that just serves latest static CSS, JS files.
|
158
|
-
|
159
|
-
You can install from latest build (from branch);
|
160
|
-
|
161
|
-
```ruby
|
162
|
-
gem 'twitter-bootstrap-rails', :git => 'git://github.com/seyhunak/twitter-bootstrap-rails.git',
|
163
|
-
:branch => 'static'
|
164
|
-
```
|
165
|
-
|
166
|
-
|
167
206
|
## Changelog
|
168
207
|
<ul>
|
169
208
|
<li>Version 0.0.5 deprecated</li>
|
@@ -205,6 +244,7 @@ gem 'twitter-bootstrap-rails', :git => 'git://github.com/seyhunak/twitter-bootst
|
|
205
244
|
<li>Released gem v.2.1.4 (minor fixes)</li>
|
206
245
|
<li>Released gem v.2.1.5 (minor fixes, install generator detects javascript template engine, updated to Twitter Bootstrap 2.2.1)</li>
|
207
246
|
<li>Released gem v.2.1.6 (minor fixes)</li>
|
247
|
+
<li>Added static stylesheets support</li>
|
208
248
|
</ul>
|
209
249
|
|
210
250
|
|
@@ -226,55 +266,58 @@ gem 'twitter-bootstrap-rails', :git => 'git://github.com/seyhunak/twitter-bootst
|
|
226
266
|
<li>Nick DeSteffen</li>
|
227
267
|
<li>Christian Joudrey</li>
|
228
268
|
<li>Todd Baur</li>
|
269
|
+
<li>Leonid Shevtsov</li>
|
229
270
|
</ul>
|
230
271
|
|
231
272
|
|
232
|
-
|
273
|
+
### Future
|
233
274
|
<ul>
|
234
275
|
<li>Writing tests (not implemented yet)</li>
|
235
276
|
<li>Markup Helpers (alert, tabs, pagination, breadcrumbs etc.)</li>
|
236
277
|
</ul>
|
237
278
|
|
279
|
+
## About Me
|
280
|
+
Lead/ Senior Developer - Programmer @useful (Usefulideas) Istanbul / Turkey
|
238
281
|
|
239
|
-
|
282
|
+
### Contact me
|
240
283
|
Seyhun Akyürek - seyhunak [at] gmail com
|
241
284
|
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
[Add Me On Facebook](https://www.facebook.com/seyhunak "Add Me On Facebook")
|
285
|
+
### Follow me
|
286
|
+
<a href="http://zerply.com/seyhunak">
|
287
|
+
<img width="110" height="40" src="http://zerply.com/img/welcomesteps/zerply_logo.png" />
|
288
|
+
</a>
|
247
289
|
|
248
|
-
|
290
|
+
(Twitter, Facebook, Linkedin, Google+, Github)
|
249
291
|
|
250
|
-
|
292
|
+
http://zerply.com/seyhunak
|
251
293
|
|
252
|
-
|
294
|
+
### Endorse me
|
253
295
|
<a href="http://coderwall.com/seyhunak">
|
254
296
|
<img src="http://api.coderwall.com/seyhunak/endorsecount.png" />
|
255
297
|
</a>
|
256
298
|
|
257
|
-
|
258
|
-
<img src="https://www.paypalobjects.com/en_US/i/logo/PayPal_mark_50x34.gif"></img>
|
259
|
-
|
260
|
-
[Want to donate for my efforts?. Show your love](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=W8ZLWQBREFP4U
|
261
|
-
"Donate")
|
262
|
-
|
263
|
-
|
264
|
-
## Score me
|
299
|
+
### Klout me
|
265
300
|
<img src="https://addons.opera.com/media/extensions/55/14355/1.0.1-rev1/icons/icon_64x64.png"></img>
|
266
301
|
|
267
302
|
Please +K my influence in Ruby on Rails on @klout
|
268
303
|
|
269
304
|
http://klout.com/#/seyhunak
|
270
305
|
|
306
|
+
|
307
|
+
### Want to donate?
|
308
|
+
<img src="https://www.paypalobjects.com/en_US/i/logo/PayPal_mark_50x34.gif"></img>
|
309
|
+
|
310
|
+
[Want to donate for my efforts?. Show your love](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=W8ZLWQBREFP4U
|
311
|
+
"Donate")
|
312
|
+
|
313
|
+
|
271
314
|
## Thanks
|
272
315
|
Twitter Bootstrap and all twitter-bootstrap-rails contributors
|
273
316
|
http://twitter.github.com/bootstrap
|
274
317
|
|
275
318
|
|
276
319
|
## License
|
277
|
-
Copyright (c)
|
320
|
+
Copyright (c) 2012 Seyhun Akyürek
|
278
321
|
|
279
322
|
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:
|
280
323
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
data/Rakefile
CHANGED
@@ -10,5 +10,25 @@ task :bundle do
|
|
10
10
|
sh 'rm *.gem'
|
11
11
|
end
|
12
12
|
|
13
|
+
desc "Build the static precompiled stylesheets from Less sources"
|
14
|
+
task :build_static_stylesheets do
|
15
|
+
require 'less'
|
16
|
+
|
17
|
+
toolkit_path = File.join('vendor', 'toolkit')
|
18
|
+
|
19
|
+
parser = Less::Parser.new :paths => [toolkit_path]
|
20
|
+
|
21
|
+
target_directory = File.expand_path('vendor/assets/stylesheets/twitter-bootstrap-static')
|
22
|
+
|
23
|
+
sh "rm -rf #{target_directory}"
|
24
|
+
sh "mkdir -p #{target_directory}"
|
25
|
+
Dir['vendor/static-source/*.less'].each do |source_file|
|
26
|
+
puts "Compiling #{source_file}"
|
27
|
+
target_file = File.join(target_directory, File.basename(source_file, '.less')+'.css.erb')
|
28
|
+
tree = parser.parse(File.read(source_file))
|
29
|
+
File.open(target_file, 'w') {|f| f.puts tree.to_css(:compress => true) }
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
13
33
|
task(:default).clear
|
14
34
|
task :default => :bundle
|
@@ -2,8 +2,9 @@ module BootstrapFlashHelper
|
|
2
2
|
def bootstrap_flash
|
3
3
|
flash_messages = []
|
4
4
|
flash.each do |type, message|
|
5
|
-
# Skip Devise :timeout
|
5
|
+
# Skip Devise :timeout and :timedout flags
|
6
6
|
next if type == :timeout
|
7
|
+
next if type == :timedout
|
7
8
|
type = :success if type == :notice
|
8
9
|
type = :error if type == :alert
|
9
10
|
text = content_tag(:div,
|
@@ -6,6 +6,7 @@ module Bootstrap
|
|
6
6
|
|
7
7
|
source_root File.expand_path("../templates", __FILE__)
|
8
8
|
desc "This generator installs Twitter Bootstrap to Asset Pipeline"
|
9
|
+
argument :stylesheets_type, :type => :string, :default => 'less', :banner => '*less or static'
|
9
10
|
|
10
11
|
def add_assets
|
11
12
|
|
@@ -31,12 +32,16 @@ module Bootstrap
|
|
31
32
|
end
|
32
33
|
|
33
34
|
def add_bootstrap
|
34
|
-
if
|
35
|
+
if use_coffeescript?
|
35
36
|
copy_file "bootstrap.coffee", "app/assets/javascripts/bootstrap.js.coffee"
|
36
37
|
else
|
37
38
|
copy_file "bootstrap.js", "app/assets/javascripts/bootstrap.js"
|
38
39
|
end
|
39
|
-
|
40
|
+
if use_less?
|
41
|
+
copy_file "bootstrap_and_overrides.less", "app/assets/stylesheets/bootstrap_and_overrides.css.less"
|
42
|
+
else
|
43
|
+
copy_file "bootstrap_and_overrides.css", "app/assets/stylesheets/bootstrap_and_overrides.css"
|
44
|
+
end
|
40
45
|
end
|
41
46
|
|
42
47
|
def cleanup_legacy
|
@@ -52,6 +57,14 @@ module Bootstrap
|
|
52
57
|
end
|
53
58
|
end
|
54
59
|
|
60
|
+
private
|
61
|
+
def use_less?
|
62
|
+
(defined?(Less) && (stylesheets_type!='static') ) || (stylesheets_type=='less')
|
63
|
+
end
|
64
|
+
|
65
|
+
def use_coffeescript?
|
66
|
+
::Rails.configuration.app_generators.rails[:javascript_engine] == :coffee
|
67
|
+
end
|
55
68
|
end
|
56
69
|
end
|
57
70
|
end
|
@@ -6,9 +6,10 @@
|
|
6
6
|
@iconWhiteSpritePath: asset-path("twitter/bootstrap/glyphicons-halflings-white");
|
7
7
|
|
8
8
|
// Set the Font Awesome (Font Awesome is default. You can disable by commenting below lines)
|
9
|
-
// Note: If you use asset_path() here, your compiled
|
9
|
+
// Note: If you use asset_path() here, your compiled bootstrap_and_overrides.css will not
|
10
10
|
// have the proper paths. So for now we use the absolute path.
|
11
11
|
@fontAwesomeEotPath: asset-path("fontawesome-webfont.eot");
|
12
|
+
@fontAwesomeEotPath_iefix: asset-path("fontawesome-webfont.eot#iefix");
|
12
13
|
@fontAwesomeWoffPath: asset-path("fontawesome-webfont.woff");
|
13
14
|
@fontAwesomeTtfPath: asset-path("fontawesome-webfont.ttf");
|
14
15
|
@fontAwesomeSvgPath: asset-path("fontawesome-webfont.svg");
|
@@ -9,7 +9,7 @@
|
|
9
9
|
|
10
10
|
<!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
|
11
11
|
<!--[if lt IE 9]>
|
12
|
-
<script src="
|
12
|
+
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.6.1/html5shiv.js" type="text/javascript"></script>
|
13
13
|
<![endif]-->
|
14
14
|
|
15
15
|
<%%= stylesheet_link_tag "application", :media => "all" %>
|
@@ -8,7 +8,7 @@
|
|
8
8
|
= csrf_meta_tags
|
9
9
|
/ Le HTML5 shim, for IE6-8 support of HTML elements
|
10
10
|
/[if lt IE 9]
|
11
|
-
= javascript_include_tag "
|
11
|
+
= javascript_include_tag "//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.6.1/html5shiv.js"
|
12
12
|
= stylesheet_link_tag "application", :media => "all"
|
13
13
|
%link(href="images/apple-touch-icon-144x144.png" rel="apple-touch-icon-precomposed" sizes="144x144")
|
14
14
|
%link(href="images/apple-touch-icon-114x114.png" rel="apple-touch-icon-precomposed" sizes="114x114")
|
@@ -9,7 +9,7 @@ html lang="en"
|
|
9
9
|
|
10
10
|
/! Le HTML5 shim, for IE6-8 support of HTML elements
|
11
11
|
/[if lt IE 9]
|
12
|
-
= javascript_include_tag "
|
12
|
+
= javascript_include_tag "//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.6.1/html5shiv.js"
|
13
13
|
= stylesheet_link_tag "application", :media => "all"
|
14
14
|
link href="images/apple-touch-icon-144x144.png" rel="apple-touch-icon-precomposed" sizes="144x144"
|
15
15
|
link href="images/apple-touch-icon-114x114.png" rel="apple-touch-icon-precomposed" sizes="114x114"
|
@@ -10,6 +10,8 @@ module Bootstrap
|
|
10
10
|
argument :layout, :type => :string, :default => "application",
|
11
11
|
:banner => "Specify application layout"
|
12
12
|
|
13
|
+
class_option :excluded_columns, :type => :array, :required => false
|
14
|
+
|
13
15
|
def initialize(args, *options)
|
14
16
|
super(args, *options)
|
15
17
|
initialize_views_variables
|
@@ -53,18 +55,48 @@ module Bootstrap
|
|
53
55
|
end
|
54
56
|
|
55
57
|
def columns
|
56
|
-
|
58
|
+
retrieve_columns.reject {|c| excluded?(c.name) }.map do |c|
|
59
|
+
new_attribute(c.name, c.type.to_s)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def excluded_columns_names
|
64
|
+
%w[id created_at updated_at]
|
65
|
+
end
|
66
|
+
|
67
|
+
def excluded_columns_pattern
|
68
|
+
[
|
69
|
+
/.*_checksum/,
|
70
|
+
/.*_count/,
|
71
|
+
]
|
72
|
+
end
|
73
|
+
|
74
|
+
def excluded_columns
|
75
|
+
options['excluded_columns']||[]
|
76
|
+
end
|
77
|
+
|
78
|
+
def excluded?(name)
|
79
|
+
excluded_columns_names.include?(name) ||
|
80
|
+
excluded_columns_pattern.any? {|p| name =~ p } ||
|
81
|
+
excluded_columns.include?(name)
|
82
|
+
end
|
83
|
+
|
84
|
+
def retrieve_columns
|
57
85
|
if defined?(ActiveRecord)
|
58
86
|
rescue_block ActiveRecord::StatementInvalid do
|
59
|
-
@model_name.constantize.columns
|
87
|
+
@model_name.constantize.columns
|
60
88
|
end
|
61
89
|
else
|
62
90
|
rescue_block do
|
63
|
-
@model_name.constantize.fields.
|
91
|
+
@model_name.constantize.fields.map {|c| c[1] }
|
64
92
|
end
|
65
93
|
end
|
66
94
|
end
|
67
95
|
|
96
|
+
def new_attribute(name, type)
|
97
|
+
::Rails::Generators::GeneratedAttribute.new(name, type)
|
98
|
+
end
|
99
|
+
|
68
100
|
def rescue_block(exception=Exception)
|
69
101
|
yield if block_given?
|
70
102
|
rescue exception => e
|
@@ -82,14 +114,17 @@ module Bootstrap
|
|
82
114
|
end
|
83
115
|
|
84
116
|
def generate_views
|
85
|
-
|
117
|
+
options.engine == generate_erb(selected_views)
|
118
|
+
end
|
119
|
+
|
120
|
+
def selected_views
|
121
|
+
{
|
86
122
|
"index.html.#{ext}" => File.join('app/views', @controller_file_path, "index.html.#{ext}"),
|
87
123
|
"new.html.#{ext}" => File.join('app/views', @controller_file_path, "new.html.#{ext}"),
|
88
124
|
"edit.html.#{ext}" => File.join('app/views', @controller_file_path, "edit.html.#{ext}"),
|
89
125
|
"#{form_builder}_form.html.#{ext}" => File.join('app/views', @controller_file_path, "_form.html.#{ext}"),
|
90
|
-
"show.html.#{ext}" => File.join('app/views', @controller_file_path, "show.html.#{ext}")
|
91
|
-
|
92
|
-
options.engine == generate_erb(selected_views)
|
126
|
+
"show.html.#{ext}" => File.join('app/views', @controller_file_path, "show.html.#{ext}")
|
127
|
+
}
|
93
128
|
end
|
94
129
|
|
95
130
|
def generate_erb(views)
|
@@ -108,3 +143,6 @@ module Bootstrap
|
|
108
143
|
end
|
109
144
|
end
|
110
145
|
end
|
146
|
+
|
147
|
+
|
148
|
+
|
@@ -8,11 +8,12 @@ module Twitter
|
|
8
8
|
module Bootstrap
|
9
9
|
module Rails
|
10
10
|
class Engine < ::Rails::Engine
|
11
|
-
|
12
|
-
|
13
|
-
:after => 'less-rails.after.load_config_initializers',
|
11
|
+
initializer 'twitter-bootstrap-rails.setup',
|
12
|
+
:after => 'less-rails.after.load_config_initializers',
|
14
13
|
:group => :all do |app|
|
15
|
-
|
14
|
+
if defined?(Less)
|
15
|
+
app.config.less.paths << File.join(config.root, 'vendor', 'toolkit')
|
16
|
+
end
|
16
17
|
end
|
17
18
|
|
18
19
|
initializer 'twitter-bootstrap-rails.setup_helpers' do |app|
|