twitter-bootstrap-turbo 2.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +266 -0
- data/Rakefile +14 -0
- data/app/helpers/bootstrap_flash_helper.rb +14 -0
- data/app/helpers/flash_block_helper.rb +17 -0
- data/app/helpers/glyph_helper.rb +12 -0
- data/app/helpers/modal_helper.rb +42 -0
- data/app/helpers/twitter_breadcrumbs_helper.rb +5 -0
- data/app/views/twitter-bootstrap/_breadcrumbs.html.erb +14 -0
- data/lib/generators/bootstrap/install/install_generator.rb +53 -0
- data/lib/generators/bootstrap/install/templates/application.css +7 -0
- data/lib/generators/bootstrap/install/templates/application.js +10 -0
- data/lib/generators/bootstrap/install/templates/bootstrap.coffee +9 -0
- data/lib/generators/bootstrap/install/templates/bootstrap_and_overrides.less +28 -0
- data/lib/generators/bootstrap/layout/layout_generator.rb +23 -0
- data/lib/generators/bootstrap/layout/templates/layout.html.erb +108 -0
- data/lib/generators/bootstrap/layout/templates/layout.html.haml +68 -0
- data/lib/generators/bootstrap/layout/templates/layout.html.slim +68 -0
- data/lib/generators/bootstrap/partial/partial_generator.rb +20 -0
- data/lib/generators/bootstrap/partial/templates/_login.html.erb +29 -0
- data/lib/generators/bootstrap/partial/templates/_navbar.html.erb +13 -0
- data/lib/generators/bootstrap/themed/templates/_form.html.erb +16 -0
- data/lib/generators/bootstrap/themed/templates/_form.html.haml +10 -0
- data/lib/generators/bootstrap/themed/templates/_form.html.slim +11 -0
- data/lib/generators/bootstrap/themed/templates/edit.html.erb +6 -0
- data/lib/generators/bootstrap/themed/templates/edit.html.haml +4 -0
- data/lib/generators/bootstrap/themed/templates/edit.html.slim +4 -0
- data/lib/generators/bootstrap/themed/templates/index.html.erb +40 -0
- data/lib/generators/bootstrap/themed/templates/index.html.haml +25 -0
- data/lib/generators/bootstrap/themed/templates/index.html.slim +27 -0
- data/lib/generators/bootstrap/themed/templates/new.html.erb +6 -0
- data/lib/generators/bootstrap/themed/templates/new.html.haml +4 -0
- data/lib/generators/bootstrap/themed/templates/new.html.slim +4 -0
- data/lib/generators/bootstrap/themed/templates/show.html.erb +23 -0
- data/lib/generators/bootstrap/themed/templates/show.html.haml +15 -0
- data/lib/generators/bootstrap/themed/templates/show.html.slim +17 -0
- data/lib/generators/bootstrap/themed/templates/simple_form/_form.html.erb +14 -0
- data/lib/generators/bootstrap/themed/templates/simple_form/_form.html.haml +11 -0
- data/lib/generators/bootstrap/themed/templates/simple_form/_form.html.slim +12 -0
- data/lib/generators/bootstrap/themed/themed_generator.rb +99 -0
- data/lib/twitter-bootstrap-turbo.rb +10 -0
- data/lib/twitter/bootstrap/rails/bootstrap.rb +2 -0
- data/lib/twitter/bootstrap/rails/engine.rb +29 -0
- data/lib/twitter/bootstrap/rails/twitter-bootstrap-breadcrumbs.rb +30 -0
- data/lib/twitter/bootstrap/rails/version.rb +7 -0
- data/vendor/assets/fonts/fontawesome-webfont.eot +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.svg +255 -0
- data/vendor/assets/fonts/fontawesome-webfont.ttf +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.woff +0 -0
- data/vendor/assets/images/twitter/bootstrap/glyphicons-halflings-white.png +0 -0
- data/vendor/assets/images/twitter/bootstrap/glyphicons-halflings.png +0 -0
- data/vendor/assets/javascripts/twitter/bootstrap.js +13 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-affix.js +105 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-alert.js +92 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-button.js +98 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-carousel.js +178 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-collapse.js +159 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-dropdown.js +151 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-modal.js +241 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-popover.js +103 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-scrollspy.js +152 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-tab.js +137 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-tooltip.js +275 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-transition.js +60 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-typeahead.js +302 -0
- data/vendor/assets/javascripts/twitter/bootstrap_ujs.js +11 -0
- data/vendor/toolkit/font-awesome-ie7.less +245 -0
- data/vendor/toolkit/fontawesome.less +327 -0
- data/vendor/toolkit/twitter/bootstrap/accordion.less +34 -0
- data/vendor/toolkit/twitter/bootstrap/alerts.less +65 -0
- data/vendor/toolkit/twitter/bootstrap/bootstrap.less +62 -0
- data/vendor/toolkit/twitter/bootstrap/breadcrumbs.less +24 -0
- data/vendor/toolkit/twitter/bootstrap/button-groups.less +245 -0
- data/vendor/toolkit/twitter/bootstrap/buttons.less +231 -0
- data/vendor/toolkit/twitter/bootstrap/carousel.less +131 -0
- data/vendor/toolkit/twitter/bootstrap/close.less +31 -0
- data/vendor/toolkit/twitter/bootstrap/code.less +58 -0
- data/vendor/toolkit/twitter/bootstrap/component-animations.less +22 -0
- data/vendor/toolkit/twitter/bootstrap/dropdowns.less +210 -0
- data/vendor/toolkit/twitter/bootstrap/forms.less +650 -0
- data/vendor/toolkit/twitter/bootstrap/grid.less +21 -0
- data/vendor/toolkit/twitter/bootstrap/hero-unit.less +24 -0
- data/vendor/toolkit/twitter/bootstrap/labels-badges.less +72 -0
- data/vendor/toolkit/twitter/bootstrap/layouts.less +16 -0
- data/vendor/toolkit/twitter/bootstrap/mixins.less +681 -0
- data/vendor/toolkit/twitter/bootstrap/modals.less +98 -0
- data/vendor/toolkit/twitter/bootstrap/navbar.less +475 -0
- data/vendor/toolkit/twitter/bootstrap/navs.less +384 -0
- data/vendor/toolkit/twitter/bootstrap/pager.less +40 -0
- data/vendor/toolkit/twitter/bootstrap/pagination.less +64 -0
- data/vendor/toolkit/twitter/bootstrap/popovers.less +117 -0
- data/vendor/toolkit/twitter/bootstrap/progress-bars.less +122 -0
- data/vendor/toolkit/twitter/bootstrap/reset.less +137 -0
- data/vendor/toolkit/twitter/bootstrap/responsive-1200px-min.less +28 -0
- data/vendor/toolkit/twitter/bootstrap/responsive-767px-max.less +174 -0
- data/vendor/toolkit/twitter/bootstrap/responsive-768px-979px.less +19 -0
- data/vendor/toolkit/twitter/bootstrap/responsive-navbar.less +177 -0
- data/vendor/toolkit/twitter/bootstrap/responsive-utilities.less +43 -0
- data/vendor/toolkit/twitter/bootstrap/responsive.less +48 -0
- data/vendor/toolkit/twitter/bootstrap/scaffolding.less +52 -0
- data/vendor/toolkit/twitter/bootstrap/sprites.less +193 -0
- data/vendor/toolkit/twitter/bootstrap/tables.less +245 -0
- data/vendor/toolkit/twitter/bootstrap/thumbnails.less +52 -0
- data/vendor/toolkit/twitter/bootstrap/tooltip.less +70 -0
- data/vendor/toolkit/twitter/bootstrap/type.less +221 -0
- data/vendor/toolkit/twitter/bootstrap/utilities.less +30 -0
- data/vendor/toolkit/twitter/bootstrap/variables.less +279 -0
- data/vendor/toolkit/twitter/bootstrap/wells.less +29 -0
- data/vendor/toolkit/twitter/bootstrap_base.less +2 -0
- metadata +235 -0
data/README.md
ADDED
@@ -0,0 +1,266 @@
|
|
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
|
+
[![Build Status](https://secure.travis-ci.org/seyhunak/twitter-bootstrap-rails.png)](http://travis-ci.org/seyhunak/twitter-bootstrap-rails)
|
7
|
+
[![Dependency Status](https://gemnasium.com/seyhunak/twitter-bootstrap-rails.png)](https://gemnasium.com/seyhunak/twitter-bootstrap-rails)
|
8
|
+
[![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/seyhunak/twitter-bootstrap-rails)
|
9
|
+
|
10
|
+
## Screencasts
|
11
|
+
#### Installing twitter-bootstrap-rails, generators, usage and more
|
12
|
+
Screencasts provided by Railscasts (Ryan Bates)
|
13
|
+
|
14
|
+
[Twitter Bootstrap Basics](http://railscasts.com/episodes/328-twitter-bootstrap-basics "Twitter Bootstrap Basics")
|
15
|
+
in this episode you will learn how to include Twitter Bootstrap into Rails application with the twitter-bootstrap-rails gem.
|
16
|
+
|
17
|
+
[More on Twitter Bootstrap](http://railscasts.com/episodes/329-more-on-twitter-bootstrap "More on Twitter Bootstrap")
|
18
|
+
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
|
+
(Note: This episode is pro episode)
|
20
|
+
|
21
|
+
|
22
|
+
## Installing Gem
|
23
|
+
|
24
|
+
Include the [Twitter Bootstrap Rails gem](http://rubygems.org/gems/twitter-bootstrap-rails) in Gemfile to install it from [RubyGems.org](http://rubygems.org);
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
gem "twitter-bootstrap-rails"
|
28
|
+
```
|
29
|
+
|
30
|
+
or you can install from latest build;
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
gem 'twitter-bootstrap-rails', :git => 'git://github.com/seyhunak/twitter-bootstrap-rails.git'
|
34
|
+
```
|
35
|
+
|
36
|
+
You can run bundle from command line
|
37
|
+
|
38
|
+
bundle install
|
39
|
+
|
40
|
+
|
41
|
+
## Installing to App (using Generators)
|
42
|
+
|
43
|
+
You can run following generators to get started with Twitter Bootstrap quickly.
|
44
|
+
|
45
|
+
|
46
|
+
Install (requires directives to Asset pipeline.)
|
47
|
+
|
48
|
+
|
49
|
+
Usage:
|
50
|
+
|
51
|
+
|
52
|
+
rails g bootstrap:install
|
53
|
+
|
54
|
+
|
55
|
+
Layout (generates Twitter Bootstrap compatible layout) - (Haml and Slim supported)
|
56
|
+
|
57
|
+
|
58
|
+
Usage:
|
59
|
+
|
60
|
+
|
61
|
+
rails g bootstrap:layout [LAYOUT_NAME] [*fixed or fluid]
|
62
|
+
|
63
|
+
|
64
|
+
Example:
|
65
|
+
|
66
|
+
|
67
|
+
rails g bootstrap:layout application fixed
|
68
|
+
|
69
|
+
|
70
|
+
Themed (generates Twitter Bootstrap compatible scaffold views.) - (Haml and Slim supported)
|
71
|
+
|
72
|
+
|
73
|
+
Usage:
|
74
|
+
|
75
|
+
|
76
|
+
rails g bootstrap:themed [RESOURCE_NAME]
|
77
|
+
|
78
|
+
|
79
|
+
Example:
|
80
|
+
|
81
|
+
|
82
|
+
rails g scaffold Post title:string description:text
|
83
|
+
rake db:migrate
|
84
|
+
rails g bootstrap:themed Posts
|
85
|
+
|
86
|
+
Notice the plural usage of the resource to generate bootstrap:themed.
|
87
|
+
|
88
|
+
## Using with Less
|
89
|
+
|
90
|
+
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.
|
91
|
+
|
92
|
+
## Using stylesheets with Less
|
93
|
+
|
94
|
+
You have to require Bootstrap LESS (bootstrap_and_overrides.css.less) in your application.css
|
95
|
+
|
96
|
+
```css
|
97
|
+
/*
|
98
|
+
*= require bootstrap_and_overrides
|
99
|
+
*/
|
100
|
+
|
101
|
+
/* Your stylesheets goes here... */
|
102
|
+
```
|
103
|
+
|
104
|
+
If you'd like to alter Bootstrap's own variables, or define your LESS
|
105
|
+
styles inheriting Bootstrap's mixins, you can do so inside bootstrap_and_overrides.css.less:
|
106
|
+
|
107
|
+
```css
|
108
|
+
@linkColor: #ff0000;
|
109
|
+
```
|
110
|
+
|
111
|
+
|
112
|
+
## Using Javascripts
|
113
|
+
|
114
|
+
You have to require Bootstrap JS (bootstrap.js) in your application.js
|
115
|
+
|
116
|
+
```js
|
117
|
+
//= require twitter/bootstrap
|
118
|
+
|
119
|
+
$(document).ready(function(){
|
120
|
+
/* Your javascripts goes here... */
|
121
|
+
});
|
122
|
+
```
|
123
|
+
|
124
|
+
## Using Coffeescript (optionally)
|
125
|
+
|
126
|
+
Using Twitter Bootstrap with the CoffeeScript is easy.
|
127
|
+
twitter-bootstrap-rails generates a "bootstrap.js.coffee" file for you
|
128
|
+
to /app/assets/javascripts/ folder.
|
129
|
+
|
130
|
+
```coffee
|
131
|
+
jQuery ->
|
132
|
+
$("a[rel=popover]").popover()
|
133
|
+
$(".tooltip").tooltip()
|
134
|
+
$("a[rel=tooltip]").tooltip()
|
135
|
+
```
|
136
|
+
|
137
|
+
## Using Helpers
|
138
|
+
|
139
|
+
### Flash helper
|
140
|
+
Add flash helper <%= bootstrap_flash %> to your layout (built-in with layout generator)
|
141
|
+
|
142
|
+
|
143
|
+
## Using Static CSS, JS (w/o Less)
|
144
|
+
|
145
|
+
twitter-bootstrap-rails has seperate branch (w/o Less) that just serves latest static CSS, JS files.
|
146
|
+
|
147
|
+
You can install from latest build (from branch);
|
148
|
+
|
149
|
+
```ruby
|
150
|
+
gem 'twitter-bootstrap-rails', :git => 'git://github.com/seyhunak/twitter-bootstrap-rails.git',
|
151
|
+
:branch => 'static'
|
152
|
+
```
|
153
|
+
|
154
|
+
|
155
|
+
## Changelog
|
156
|
+
<ul>
|
157
|
+
<li>Version 0.0.5 deprecated</li>
|
158
|
+
<li>Asset files updated to latest and removed version numbers</li>
|
159
|
+
<li>Implemented Less::Rails Railtie to use with LESS</li>
|
160
|
+
<li>Fixed railtie to only initialize Less when installed</li>
|
161
|
+
<li>New branch for the static version of Bootstrap (w/o Less) - check static branch</li>
|
162
|
+
<li>Added path to support heroku deploy</li>
|
163
|
+
<li>Rake precompile issue fixed</li>
|
164
|
+
<li>Updated asset files to 1.4.0</li>
|
165
|
+
<li>Updated dependency less-rails (now requires 2.1.0)</li>
|
166
|
+
<li>Added generators</li>
|
167
|
+
<li>Fixed generators</li>
|
168
|
+
<li>Fixed class name conflicts from (bootstrap.js.coffee)</li>
|
169
|
+
<li>Fixed jquery-rails gem version dependency</li>
|
170
|
+
<li>Updated asset files</li>
|
171
|
+
<li>Added new generators (install, layout and themed)</li>
|
172
|
+
<li>Compability to Rails 3.2</li>
|
173
|
+
<li>Transitioning to 2.0</li>
|
174
|
+
<li>Released gem v.2.0rc0</li>
|
175
|
+
<li>Added Haml and Slim support</li>
|
176
|
+
<li>Added Responsive layout support</li>
|
177
|
+
<li>Fixes and release 2.0.0</li>
|
178
|
+
<li>Updated to v2.0.1, versioned v2.0.1.0</li>
|
179
|
+
<li>Released gem v.2.0.3</li>
|
180
|
+
<li>Released gem v.2.0.4</li>
|
181
|
+
<li>Released gem v.2.0.5</li>
|
182
|
+
<li>Added SimpleForm support</li>
|
183
|
+
<li>Added FontAwesome support</li>
|
184
|
+
<li>Released gem v.2.0.6</li>
|
185
|
+
<li>Released gem v.2.0.7</li>
|
186
|
+
<li>Released gem v.2.0.8</li>
|
187
|
+
<li>Released gem v.2.0.9 (Bootstrap 2.0.4 and FontAwesome 2.0 support)</li>
|
188
|
+
<li>Released gem v.2.1.0 (JRuby support)</li>
|
189
|
+
<li>Released gem v.2.1.1 (minor fixes)</li>
|
190
|
+
<li>Flash block message helper added</li>
|
191
|
+
<li>Released gem v.2.1.2 (minor fixes and updated to Twitter Bootstrap 2.1.0)</li>
|
192
|
+
<li>Released gem v.2.1.3 (minor fixes and updated to Twitter Bootstrap 2.1.1)</li>
|
193
|
+
</ul>
|
194
|
+
|
195
|
+
|
196
|
+
## Contributors & Patches & Forks
|
197
|
+
<ul>
|
198
|
+
<li>Daniel Morris</li>
|
199
|
+
<li>Bradly Feeley</li>
|
200
|
+
<li>Guilherme Moreira</li>
|
201
|
+
<li>Alex Behar</li>
|
202
|
+
<li>Brandon Keene</li>
|
203
|
+
<li>Anthony Corcutt</li>
|
204
|
+
<li>Colin Warren</li>
|
205
|
+
<li>Giovanni Cappellotto</li>
|
206
|
+
<li>Masakuni Kato</li>
|
207
|
+
<li>Gudleik Rasch</li>
|
208
|
+
<li>Thomas Volkmar Worm</li>
|
209
|
+
<li>Thiago Almeida</li>
|
210
|
+
<li>Sébastien Grosjean</li>
|
211
|
+
<li>Nick DeSteffen</li>
|
212
|
+
<li>Christian Joudrey</li>
|
213
|
+
<li>Todd Baur</li>
|
214
|
+
</ul>
|
215
|
+
|
216
|
+
|
217
|
+
## Future
|
218
|
+
<ul>
|
219
|
+
<li>Writing tests (not implemented yet)</li>
|
220
|
+
<li>Markup Helpers (alert, tabs, pagination, breadcrumbs etc.)</li>
|
221
|
+
</ul>
|
222
|
+
|
223
|
+
|
224
|
+
## Credits
|
225
|
+
Seyhun Akyürek - seyhunak [at] gmail com
|
226
|
+
|
227
|
+
[Add Me On Twitter](http://twitter.com/seyhunak "Add Me On Twitter")
|
228
|
+
|
229
|
+
[Add Me On Linkedin](http://tr.linkedin.com/in/seyhunak "Add Me On Linkedin")
|
230
|
+
|
231
|
+
[Add Me On Facebook](https://www.facebook.com/seyhunak "Add Me On Facebook")
|
232
|
+
|
233
|
+
[Add Me On Google+](http://plus.ly/seyhunak "Add Me On Google+")
|
234
|
+
|
235
|
+
[Visit My Blog](http://www.seyhunakyurek.com/ "Visit My Blog")
|
236
|
+
|
237
|
+
## Endorse My Skills
|
238
|
+
<a href="http://coderwall.com/seyhunak">
|
239
|
+
<img src="http://api.coderwall.com/seyhunak/endorsecount.png" />
|
240
|
+
</a>
|
241
|
+
|
242
|
+
## Want to Donate?
|
243
|
+
<img src="https://www.paypalobjects.com/en_US/i/logo/PayPal_mark_50x34.gif"></img>
|
244
|
+
|
245
|
+
[Want to donate for my efforts?. Show your love](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=W8ZLWQBREFP4U
|
246
|
+
"Donate")
|
247
|
+
|
248
|
+
|
249
|
+
## Score me
|
250
|
+
<img src="https://addons.opera.com/media/extensions/55/14355/1.0.1-rev1/icons/icon_64x64.png"></img>
|
251
|
+
|
252
|
+
Please +K my influence in Ruby on Rails on @klout
|
253
|
+
|
254
|
+
http://klout.com/#/seyhunak
|
255
|
+
|
256
|
+
## Thanks
|
257
|
+
Twitter Bootstrap and all twitter-bootstrap-rails contributors
|
258
|
+
http://twitter.github.com/bootstrap
|
259
|
+
|
260
|
+
|
261
|
+
## License
|
262
|
+
Copyright (c) 2011 Seyhun Akyürek
|
263
|
+
|
264
|
+
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:
|
265
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
266
|
+
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,14 @@
|
|
1
|
+
module BootstrapFlashHelper
|
2
|
+
def bootstrap_flash
|
3
|
+
flash_messages = []
|
4
|
+
flash.each do |type, message|
|
5
|
+
type = :success if type == :notice
|
6
|
+
type = :error if type == :alert
|
7
|
+
text = content_tag(:div,
|
8
|
+
content_tag(:button, raw("×"), :class => "close", "data-dismiss" => "alert") +
|
9
|
+
message, :class => "alert fade in alert-#{type}")
|
10
|
+
flash_messages << text if message
|
11
|
+
end
|
12
|
+
flash_messages.join("\n").html_safe
|
13
|
+
end
|
14
|
+
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("×"),: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\">×</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,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,53 @@
|
|
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
|
+
copy_file "bootstrap.coffee", "app/assets/javascripts/bootstrap.js.coffee"
|
35
|
+
copy_file "bootstrap_and_overrides.less", "app/assets/stylesheets/bootstrap_and_overrides.css.less"
|
36
|
+
end
|
37
|
+
|
38
|
+
def cleanup_legacy
|
39
|
+
# Remove old requires (if any) that included twitter/bootstrap directly:
|
40
|
+
gsub_file("app/assets/stylesheets/application.css", %r|\s*\*=\s*twitter/bootstrap\s*\n|, "")
|
41
|
+
gsub_file("app/assets/stylesheets/application.css", %r|\s*\*=\s*twitter/bootstrap_responsive\s*\n|, "")
|
42
|
+
if File.exist?('app/assets/stylesheets/bootstrap_override.css.less')
|
43
|
+
puts <<-EOM
|
44
|
+
Warning:
|
45
|
+
app/assets/stylesheets/bootstrap_override.css.less exists
|
46
|
+
It should be removed, as it has been superceded by app/assets/stylesheets/bootstrap_and_overrides.css.less
|
47
|
+
EOM
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|