twitter-bootstrap-rails 2.0.2 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +34 -23
- data/lib/generators/bootstrap/install/install_generator.rb +36 -12
- data/lib/generators/bootstrap/install/templates/application.css +0 -1
- data/lib/generators/bootstrap/install/templates/bootstrap.coffee +1 -10
- data/lib/generators/bootstrap/install/templates/bootstrap_and_overrides.less +19 -0
- data/lib/generators/bootstrap/layout/templates/layout.html.erb +18 -23
- data/lib/generators/bootstrap/layout/templates/layout.html.haml +4 -9
- data/lib/generators/bootstrap/layout/templates/layout.html.slim +4 -9
- data/lib/generators/bootstrap/themed/templates/_form.html.erb +19 -12
- data/lib/generators/bootstrap/themed/templates/_form.html.haml +13 -11
- data/lib/generators/bootstrap/themed/templates/edit.html.erb +1 -4
- data/lib/generators/bootstrap/themed/templates/edit.html.haml +1 -2
- data/lib/generators/bootstrap/themed/templates/edit.html.slim +1 -1
- data/lib/generators/bootstrap/themed/templates/index.html.erb +24 -28
- data/lib/generators/bootstrap/themed/templates/index.html.haml +3 -3
- data/lib/generators/bootstrap/themed/templates/new.html.erb +1 -3
- data/lib/generators/bootstrap/themed/templates/new.html.haml +1 -1
- data/lib/generators/bootstrap/themed/templates/new.html.slim +1 -1
- data/lib/generators/bootstrap/themed/templates/show.html.erb +11 -7
- data/lib/generators/bootstrap/themed/templates/show.html.haml +1 -1
- data/lib/generators/bootstrap/themed/themed_generator.rb +4 -4
- data/lib/twitter/bootstrap/rails/engine.rb +9 -3
- data/lib/twitter/bootstrap/rails/twitter-bootstrap-breadcrumbs.rb +25 -0
- data/lib/twitter/bootstrap/rails/version.rb +1 -1
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-alert.js +8 -5
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-button.js +5 -3
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-carousel.js +9 -2
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-collapse.js +5 -3
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-dropdown.js +2 -2
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-modal.js +6 -5
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-popover.js +2 -2
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-scrollspy.js +2 -2
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-tab.js +2 -2
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-tooltip.js +3 -3
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-transition.js +3 -3
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-typeahead.js +8 -8
- data/vendor/toolkit/twitter/bootstrap/alerts.less +2 -14
- data/vendor/toolkit/twitter/bootstrap/badges.less +36 -0
- data/vendor/toolkit/twitter/bootstrap/bootstrap.less +2 -1
- data/vendor/toolkit/twitter/bootstrap/breadcrumbs.less +3 -1
- data/vendor/toolkit/twitter/bootstrap/button-groups.less +34 -8
- data/vendor/toolkit/twitter/bootstrap/buttons.less +38 -16
- data/vendor/toolkit/twitter/bootstrap/code.less +15 -2
- data/vendor/toolkit/twitter/bootstrap/component-animations.less +4 -2
- data/vendor/toolkit/twitter/bootstrap/dropdowns.less +46 -29
- data/vendor/toolkit/twitter/bootstrap/forms.less +120 -80
- data/vendor/toolkit/twitter/bootstrap/grid.less +2 -5
- data/vendor/toolkit/twitter/bootstrap/hero-unit.less +3 -1
- data/vendor/toolkit/twitter/bootstrap/labels.less +29 -7
- data/vendor/toolkit/twitter/bootstrap/mixins.less +233 -156
- data/vendor/toolkit/twitter/bootstrap/modals.less +22 -4
- data/vendor/toolkit/twitter/bootstrap/navbar.less +90 -41
- data/vendor/toolkit/twitter/bootstrap/navs.less +39 -20
- data/vendor/toolkit/twitter/bootstrap/pager.less +6 -0
- data/vendor/toolkit/twitter/bootstrap/pagination.less +1 -0
- data/vendor/toolkit/twitter/bootstrap/progress-bars.less +15 -1
- data/vendor/toolkit/twitter/bootstrap/reset.less +2 -2
- data/vendor/toolkit/twitter/bootstrap/responsive.less +80 -32
- data/vendor/toolkit/twitter/bootstrap/scaffolding.less +4 -4
- data/vendor/toolkit/twitter/bootstrap/sprites.less +10 -8
- data/vendor/toolkit/twitter/bootstrap/tables.less +39 -19
- data/vendor/toolkit/twitter/bootstrap/thumbnails.less +2 -2
- data/vendor/toolkit/twitter/bootstrap/type.less +25 -8
- data/vendor/toolkit/twitter/bootstrap/variables.less +114 -12
- data/vendor/toolkit/twitter/bootstrap/wells.less +10 -0
- data/vendor/toolkit/twitter/bootstrap_base.less +2 -0
- metadata +15 -14
- data/lib/generators/bootstrap/install/templates/bootstrap.less +0 -6
- data/vendor/assets/stylesheets/twitter/bootstrap.css.less +0 -1
- data/vendor/toolkit/twitter/bootstrap.less +0 -1
data/README.md
CHANGED
|
@@ -6,11 +6,24 @@ twitter-bootstrap-rails project integrates Bootstrap CSS toolkit for Rails 3.1 A
|
|
|
6
6
|
[](http://travis-ci.org/seyhunak/twitter-bootstrap-rails)
|
|
7
7
|
[](https://gemnasium.com/seyhunak/twitter-bootstrap-rails)
|
|
8
8
|
|
|
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
|
+
|
|
9
22
|
## Installing Gem
|
|
10
23
|
|
|
11
24
|
Include Bootstrap in Gemfile;
|
|
12
25
|
|
|
13
|
-
gem
|
|
26
|
+
gem "twitter-bootstrap-rails"
|
|
14
27
|
|
|
15
28
|
or you can install from latest build;
|
|
16
29
|
|
|
@@ -74,24 +87,20 @@ Bootstrap was built with Preboot, an open-source pack of mixins and variables to
|
|
|
74
87
|
|
|
75
88
|
## Using stylesheets with Less
|
|
76
89
|
|
|
77
|
-
You have to require Bootstrap LESS (
|
|
90
|
+
You have to require Bootstrap LESS (bootstrap_and_overrides.css.less) in your application.css
|
|
78
91
|
|
|
79
92
|
/*
|
|
80
|
-
*= require
|
|
81
|
-
|
|
93
|
+
*= require bootstrap_and_overrides
|
|
94
|
+
*/
|
|
82
95
|
|
|
83
96
|
/* Your stylesheets goes here... */
|
|
84
97
|
|
|
85
98
|
|
|
86
|
-
|
|
87
|
-
|
|
99
|
+
If you'd like to alter Bootstrap's own variables, or define your LESS
|
|
100
|
+
styles inheriting Bootstrap's mixins, you can do so inside bootstrap_and_overrides.css.less:
|
|
88
101
|
|
|
89
|
-
@
|
|
102
|
+
@linkColor: #ff0000;
|
|
90
103
|
|
|
91
|
-
// import responsive layout
|
|
92
|
-
@import "twitter/bootstrap/responsive";
|
|
93
|
-
|
|
94
|
-
// Your custom stylesheets goes here (override Less here)
|
|
95
104
|
|
|
96
105
|
|
|
97
106
|
## Using Javascripts
|
|
@@ -112,17 +121,9 @@ twitter-bootstrap-rails generates a "bootstrap.js.coffee" file for you
|
|
|
112
121
|
to /app/assets/javascripts/ folder.
|
|
113
122
|
|
|
114
123
|
jQuery ->
|
|
115
|
-
$("
|
|
116
|
-
$(".tabs").button()
|
|
117
|
-
$(".carousel").carousel()
|
|
118
|
-
$(".collapse").collapse()
|
|
119
|
-
$(".dropdown-toggle").dropdown()
|
|
120
|
-
$(".modal").modal()
|
|
121
|
-
$("a[rel]").popover()
|
|
122
|
-
$(".navbar").scrollspy()
|
|
123
|
-
$(".tab").tab "show"
|
|
124
|
+
$("a[rel=popover]").popover()
|
|
124
125
|
$(".tooltip").tooltip()
|
|
125
|
-
$("
|
|
126
|
+
$("a[rel=tooltip]").tooltip()
|
|
126
127
|
|
|
127
128
|
|
|
128
129
|
## Using Static CSS, JS (w/o Less)
|
|
@@ -157,6 +158,9 @@ twitter-bootstrap-rails has seperate branch (w/o Less) that just serves latest s
|
|
|
157
158
|
<li>Added Haml and Slim support</li>
|
|
158
159
|
<li>Added Responsive layout support</li>
|
|
159
160
|
<li>Fixes and release 2.0.0</li>
|
|
161
|
+
<li>Updated to v2.0.1, versioned v2.0.1.0</li>
|
|
162
|
+
<li>Released gem v.2.0.3</li>
|
|
163
|
+
<li>Released gem v.2.0.4</li>
|
|
160
164
|
</ul>
|
|
161
165
|
|
|
162
166
|
|
|
@@ -173,6 +177,7 @@ twitter-bootstrap-rails has seperate branch (w/o Less) that just serves latest s
|
|
|
173
177
|
<li>Masakuni Kato</li>
|
|
174
178
|
<li>Gudleik Rasch</li>
|
|
175
179
|
<li>Thomas Volkmar Worm</li>
|
|
180
|
+
<li>Thiago Almeida</li>
|
|
176
181
|
</ul>
|
|
177
182
|
|
|
178
183
|
|
|
@@ -186,9 +191,15 @@ twitter-bootstrap-rails has seperate branch (w/o Less) that just serves latest s
|
|
|
186
191
|
## Credits
|
|
187
192
|
Seyhun Akyürek - seyhunak [at] gmail com
|
|
188
193
|
|
|
189
|
-
[
|
|
194
|
+
[Add Me On Twitter](http://twitter.com/seyhunak "Add Me On Twitter")
|
|
195
|
+
|
|
196
|
+
[Add Me On Linkedin](http://tr.linkedin.com/in/seyhunak "Add Me On Linkedin")
|
|
197
|
+
|
|
198
|
+
[Add Me On Facebook](https://www.facebook.com/seyhunak "Add Me On Facebook")
|
|
199
|
+
|
|
200
|
+
[Add Me On Google+](http://plus.ly/seyhunak "Add Me On Google+")
|
|
190
201
|
|
|
191
|
-
[
|
|
202
|
+
[Visit My Blog](http://www.seyhunakyurek.com/ "Visit My Blog")
|
|
192
203
|
|
|
193
204
|
|
|
194
205
|
## Thanks
|
|
@@ -3,25 +3,49 @@ require 'rails/generators'
|
|
|
3
3
|
module Bootstrap
|
|
4
4
|
module Generators
|
|
5
5
|
class InstallGenerator < ::Rails::Generators::Base
|
|
6
|
+
|
|
6
7
|
source_root File.expand_path("../templates", __FILE__)
|
|
7
8
|
desc "This generator installs Twitter Bootstrap to Asset Pipeline"
|
|
8
9
|
|
|
9
10
|
def add_assets
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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+\./)
|
|
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
|
|
21
32
|
|
|
22
33
|
def add_bootstrap
|
|
23
34
|
copy_file "bootstrap.coffee", "app/assets/javascripts/bootstrap.js.coffee"
|
|
24
|
-
copy_file "
|
|
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
|
|
25
49
|
end
|
|
26
50
|
|
|
27
51
|
end
|
|
@@ -3,6 +3,5 @@
|
|
|
3
3
|
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
|
|
4
4
|
* the top of the compiled file, but it's generally better to create a new file per style scope.
|
|
5
5
|
*= require_self
|
|
6
|
-
*= require twitter/bootstrap
|
|
7
6
|
*= require_tree .
|
|
8
7
|
*/
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
jQuery ->
|
|
2
|
-
$(".alert-message").alert()
|
|
3
|
-
$(".tabs").button()
|
|
4
|
-
$(".carousel").carousel()
|
|
5
|
-
$(".collapse").collapse()
|
|
6
|
-
$(".dropdown-toggle").dropdown()
|
|
7
|
-
$(".modal").modal()
|
|
8
2
|
$("a[rel=popover]").popover()
|
|
9
|
-
$(".navbar").scrollspy()
|
|
10
|
-
$(".tab").tab "show"
|
|
11
3
|
$(".tooltip").tooltip()
|
|
12
|
-
$("
|
|
13
|
-
$("a[rel=tooltip]").tooltip()
|
|
4
|
+
$("a[rel=tooltip]").tooltip()
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
@import "twitter/bootstrap/bootstrap";
|
|
2
|
+
body { padding-top: 60px; }
|
|
3
|
+
|
|
4
|
+
@import "twitter/bootstrap/responsive";
|
|
5
|
+
|
|
6
|
+
// Set the correct sprite paths
|
|
7
|
+
@iconSpritePath: asset-path('twitter/bootstrap/glyphicons-halflings.png');
|
|
8
|
+
@iconWhiteSpritePath: asset-path('twitter/bootstrap/glyphicons-halflings-white.png');
|
|
9
|
+
|
|
10
|
+
// Your custom LESS stylesheets goes here
|
|
11
|
+
//
|
|
12
|
+
// Since bootstrap was imported above you have access to its mixins which
|
|
13
|
+
// you may use and inherit here
|
|
14
|
+
//
|
|
15
|
+
// If you'd like to override bootstrap's own variables, you can do so here as well
|
|
16
|
+
// See http://twitter.github.com/bootstrap/less.html for their names and documentation
|
|
17
|
+
//
|
|
18
|
+
// Example:
|
|
19
|
+
// @linkColor: #ff0000;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
<html lang="en">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
5
6
|
<title><%= app_name %></title>
|
|
6
7
|
<%%= csrf_meta_tags %>
|
|
7
8
|
|
|
@@ -11,12 +12,7 @@
|
|
|
11
12
|
<![endif]-->
|
|
12
13
|
|
|
13
14
|
<!-- Le styles -->
|
|
14
|
-
<%%= stylesheet_link_tag
|
|
15
|
-
<style>
|
|
16
|
-
body {
|
|
17
|
-
padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
|
|
18
|
-
}
|
|
19
|
-
</style>
|
|
15
|
+
<%%= stylesheet_link_tag "application", :media => "all" %>
|
|
20
16
|
|
|
21
17
|
<!-- Le fav and touch icons -->
|
|
22
18
|
<link href="images/favicon.ico" rel="shortcut icon">
|
|
@@ -34,9 +30,9 @@
|
|
|
34
30
|
<div class="container">
|
|
35
31
|
<%- end -%>
|
|
36
32
|
<a class="btn btn-navbar" data-target=".nav-collapse" data-toggle="collapse">
|
|
37
|
-
<span class="
|
|
38
|
-
<span class="
|
|
39
|
-
<span class="
|
|
33
|
+
<span class="icon-bar"></span>
|
|
34
|
+
<span class="icon-bar"></span>
|
|
35
|
+
<span class="icon-bar"></span>
|
|
40
36
|
</a>
|
|
41
37
|
<a class="brand" href="#"><%= app_name %></a>
|
|
42
38
|
<div class="<%= container_class %> nav-collapse">
|
|
@@ -52,14 +48,14 @@
|
|
|
52
48
|
|
|
53
49
|
<div class="<%= container_class %>">
|
|
54
50
|
<%- if layout_type == "fluid" -%>
|
|
55
|
-
|
|
51
|
+
<div class="row-fluid">
|
|
56
52
|
<div class="span3">
|
|
57
53
|
<div class="well sidebar-nav">
|
|
58
54
|
<ul class="nav nav-list">
|
|
59
55
|
<li class="nav-header">Sidebar</li>
|
|
60
56
|
<%- (1..3).each do |i| -%>
|
|
61
|
-
|
|
62
|
-
|
|
57
|
+
<li><%%= link_to "Link<%= i %>", "/path<%= i %>" %></li>
|
|
58
|
+
<%- end -%>
|
|
63
59
|
</ul>
|
|
64
60
|
</div><!--/.well -->
|
|
65
61
|
</div><!--/span-->
|
|
@@ -68,25 +64,24 @@
|
|
|
68
64
|
</div>
|
|
69
65
|
</div><!--/row-->
|
|
70
66
|
<%- else -%>
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
67
|
+
<div class="content">
|
|
68
|
+
<div class="row">
|
|
69
|
+
<div class="span9">
|
|
70
|
+
<%%= yield %>
|
|
75
71
|
</div>
|
|
76
|
-
<div class="span1"> </div>
|
|
77
72
|
<div class="span3">
|
|
78
73
|
<div class="well sidebar-nav">
|
|
79
74
|
<h3>Sidebar</h3>
|
|
80
|
-
|
|
81
|
-
|
|
75
|
+
<ul class="nav nav-list">
|
|
76
|
+
<li class="nav-header">Sidebar</li>
|
|
82
77
|
<%- (1..3).each do |i| -%>
|
|
83
78
|
<li><%%= link_to "Link<%= i %>", "/path<%= i %>" %></li>
|
|
84
79
|
<%- end -%>
|
|
85
80
|
</ul>
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
81
|
+
</div><!--/.well -->
|
|
82
|
+
</div><!--/span-->
|
|
83
|
+
</div><!--/row-->
|
|
84
|
+
</div><!--/content-->
|
|
90
85
|
<%- end -%>
|
|
91
86
|
|
|
92
87
|
<footer>
|
|
@@ -8,11 +8,7 @@
|
|
|
8
8
|
/[if lt IE 9]
|
|
9
9
|
= javascript_include_tag "http://html5shim.googlecode.com/svn/trunk/html5.js"
|
|
10
10
|
/ Le styles
|
|
11
|
-
= stylesheet_link_tag
|
|
12
|
-
:css
|
|
13
|
-
body {
|
|
14
|
-
padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
|
|
15
|
-
}
|
|
11
|
+
= stylesheet_link_tag "application", :media => "all"
|
|
16
12
|
/ Le fav and touch icons
|
|
17
13
|
%link{:href => "images/favicon.ico", :rel => "shortcut icon"}/
|
|
18
14
|
%link{:href => "images/apple-touch-icon.png", :rel => "apple-touch-icon"}/
|
|
@@ -29,9 +25,9 @@
|
|
|
29
25
|
.container
|
|
30
26
|
<%- end -%>
|
|
31
27
|
%a.btn.btn-navbar{"data-target" => ".nav-collapse", "data-toggle" => "collapse"}
|
|
32
|
-
%span.
|
|
33
|
-
%span.
|
|
34
|
-
%span.
|
|
28
|
+
%span.icon-bar
|
|
29
|
+
%span.icon-bar
|
|
30
|
+
%span.icon-bar
|
|
35
31
|
%a.brand{:href => "#"}<%= app_name %>
|
|
36
32
|
.<%=container_class%>.nav-collapse
|
|
37
33
|
%ul.nav
|
|
@@ -57,7 +53,6 @@
|
|
|
57
53
|
.row
|
|
58
54
|
.span9
|
|
59
55
|
= yield
|
|
60
|
-
.span1
|
|
61
56
|
.span3
|
|
62
57
|
.well.sidebar-nav
|
|
63
58
|
%h3 Sidebar
|
|
@@ -9,11 +9,7 @@ html lang="en"
|
|
|
9
9
|
/[if lt IE 9]
|
|
10
10
|
= javascript_include_tag "http://html5shim.googlecode.com/svn/trunk/html5.js"
|
|
11
11
|
/! Le styles
|
|
12
|
-
|
|
13
|
-
css:
|
|
14
|
-
body {
|
|
15
|
-
padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
|
|
16
|
-
}
|
|
12
|
+
= stylesheet_link_tag "application", :media => "all"
|
|
17
13
|
/ Le fav and touch icons
|
|
18
14
|
link href="images/favicon.ico" rel="shortcut icon"
|
|
19
15
|
link href="images/apple-touch-icon.png" rel="apple-touch-icon"
|
|
@@ -30,9 +26,9 @@ html lang="en"
|
|
|
30
26
|
.container
|
|
31
27
|
<%- end -%>
|
|
32
28
|
a.btn.btn-navbar data-target=".nav-collapse" data-toggle="collapse"
|
|
33
|
-
span.
|
|
34
|
-
span.
|
|
35
|
-
span.
|
|
29
|
+
span.icon-bar
|
|
30
|
+
span.icon-bar
|
|
31
|
+
span.icon-bar
|
|
36
32
|
a.brand href="#"<%= app_name %>
|
|
37
33
|
.<%=container_class%>.nav-collapse
|
|
38
34
|
ul.nav
|
|
@@ -58,7 +54,6 @@ html lang="en"
|
|
|
58
54
|
.row
|
|
59
55
|
.span9
|
|
60
56
|
= yield
|
|
61
|
-
.span1
|
|
62
57
|
.span3
|
|
63
58
|
.well.sidebar-nav
|
|
64
59
|
h3 Sidebar
|
|
@@ -1,12 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
<%%= form_for @<%= resource_name %>, :html => { :class => 'form-horizontal' } do |f| %>
|
|
2
|
+
<fieldset>
|
|
3
|
+
<legend><%%= controller.action_name.capitalize %> <%= model_name.titleize %></legend>
|
|
4
|
+
|
|
5
|
+
<%- columns.each do |column| -%>
|
|
6
|
+
<div class="control-group">
|
|
7
|
+
<%%= f.label :<%= column.name %>, :class => 'control-label' %>
|
|
8
|
+
<div class="controls">
|
|
9
|
+
<%%= f.<%= column.field_type %> :<%= column.name %>, :class => '<%= column.field_type %>' %>
|
|
10
|
+
</div>
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
<%- end -%>
|
|
14
|
+
<div class="form-actions">
|
|
15
|
+
<%%= f.submit nil, :class => 'btn btn-primary' %>
|
|
16
|
+
<%%= link_to 'Cancel', <%= controller_routing_path %>_path, :class => 'btn' %>
|
|
17
|
+
</div>
|
|
18
|
+
</fieldset>
|
|
19
|
+
<%% end %>
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
%fieldset
|
|
2
|
+
%legend
|
|
3
|
+
= controller.action_name.capitalize
|
|
4
|
+
<%= model_name.titleize %>
|
|
5
|
+
<%- columns.each do |column| -%>
|
|
6
|
+
.control-group
|
|
7
|
+
= f.label :<%= column.name %>, :class => 'control-label'
|
|
8
|
+
.controls
|
|
9
|
+
= f.<%= column.field_type %> :<%= column.name %>, :class => '<%= column.field_type %>'
|
|
10
|
+
<%- end -%>
|
|
11
|
+
.form-actions
|
|
12
|
+
= f.submit nil, :class => 'btn btn-primary'
|
|
13
|
+
= link_to "Cancel", <%= controller_routing_path %>_path, :class => 'btn'
|
|
@@ -1,4 +1 @@
|
|
|
1
|
-
<%%=
|
|
2
|
-
<input name="_method" type="hidden" value="put" />
|
|
3
|
-
<%%= render :partial => "form", :locals => {:f => f} %>
|
|
4
|
-
<%% end -%>
|
|
1
|
+
<%%= render :partial => 'form' %>
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
= form_for @<%=
|
|
2
|
-
%input{:name => "_method", :type => "hidden", :value =>"put"}
|
|
1
|
+
= form_for @<%= resource_name %>, :html => { :class => "edit_<%= resource_name %> form-horizontal", :id => "edit_<%= resource_name %>" } do |f|
|
|
3
2
|
= render :partial => "form", :locals => {:f => f}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
= form_for @<%=
|
|
1
|
+
= form_for @<%= resource_name %>, :url => <%= singular_controller_routing_path %>_path(@<%= resource_name %>), :html => { :class => "edit_<%= resource_name %>", :id => "edit_<%= resource_name %>" } do |f|
|
|
2
2
|
input name="_method" type="hidden" value="put"
|
|
3
3
|
= render :partial => "form", :locals => {:f => f}
|
|
@@ -1,34 +1,30 @@
|
|
|
1
1
|
<h1><%= resource_name.titleize %>s</h1>
|
|
2
2
|
<table class="table table-striped">
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
<th>Actions</th>
|
|
13
|
-
</tr>
|
|
3
|
+
<thead>
|
|
4
|
+
<tr>
|
|
5
|
+
<th>ID</th>
|
|
6
|
+
<%- unless columns.empty? -%>
|
|
7
|
+
<th><%= columns.first.name.humanize %></th>
|
|
8
|
+
<%- end -%>
|
|
9
|
+
<th>Created at</th>
|
|
10
|
+
<th>Actions</th>
|
|
11
|
+
</tr>
|
|
14
12
|
</thead>
|
|
15
13
|
<tbody>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
<%% end -%>
|
|
31
|
-
</tbody>
|
|
14
|
+
<%% @<%= plural_resource_name %>.each do |<%= resource_name %>| %>
|
|
15
|
+
<tr>
|
|
16
|
+
<td><%%= <%= resource_name %>.id %></td>
|
|
17
|
+
<%- unless columns.empty? -%>
|
|
18
|
+
<td><%%= link_to <%= resource_name %>.<%= columns.first.name %>, <%= singular_controller_routing_path %>_path(<%= resource_name %>) %></td>
|
|
19
|
+
<%- end -%>
|
|
20
|
+
<td><%%= <%= resource_name %>.created_at %></td>
|
|
21
|
+
<td>
|
|
22
|
+
<%%= link_to 'Edit', edit_<%= singular_controller_routing_path %>_path(<%= resource_name %>), :class => 'btn btn-mini' %>
|
|
23
|
+
<%%= link_to 'Destroy', <%= singular_controller_routing_path %>_path(<%= resource_name %>), :method => :delete, :confirm => 'Are you sure?', :class => 'btn btn-mini btn-danger' %>
|
|
24
|
+
</td>
|
|
25
|
+
</tr>
|
|
26
|
+
<%% end %>
|
|
27
|
+
</tbody>
|
|
32
28
|
</table>
|
|
33
29
|
|
|
34
|
-
<%%= link_to
|
|
30
|
+
<%%= link_to 'New', new_<%= singular_controller_routing_path %>_path, :class => 'btn btn-primary' %>
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
<%- end -%>
|
|
19
19
|
%td= <%= resource_name %>.created_at
|
|
20
20
|
%td
|
|
21
|
-
= link_to "Show", <%= singular_controller_routing_path %>_path(<%= resource_name %>)
|
|
22
|
-
= link_to "Edit", edit_<%= singular_controller_routing_path %>_path(<%= resource_name %>)
|
|
23
|
-
= link_to "Destroy", <%= singular_controller_routing_path %>_path(<%= resource_name %>), :method => :delete, :confirm => "#{t("web-app-theme.confirm", :default => "Are you sure?")}"
|
|
21
|
+
= link_to "Show", <%= singular_controller_routing_path %>_path(<%= resource_name %>), :class => 'btn btn-mini'
|
|
22
|
+
= link_to "Edit", edit_<%= singular_controller_routing_path %>_path(<%= resource_name %>), :class => 'btn btn-mini'
|
|
23
|
+
= link_to "Destroy", <%= singular_controller_routing_path %>_path(<%= resource_name %>), :method => :delete, :confirm => "#{t("web-app-theme.confirm", :default => "Are you sure?")}", :class => 'btn btn-mini btn-danger'
|
|
24
24
|
|
|
25
25
|
= link_to "New", new_<%= singular_controller_routing_path %>_path, :class => 'btn btn-primary'
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
= form_for @<%=
|
|
1
|
+
= form_for @<%= resource_name %>, :html => { :class => 'form-horizontal' } do |f|
|
|
2
2
|
= render :partial => "form", :locals => {:f => f}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
= form_for @<%=
|
|
1
|
+
= form_for @<%= resource_name %>, :url => <%= controller_routing_path %>_path, :html => { :class => :form } do |f|
|
|
2
2
|
= render :partial => "form", :locals => {:f => f}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
<h1><%= model_name.titleize %></h1>
|
|
2
|
+
|
|
3
|
+
<%- columns.each do |column| -%>
|
|
4
|
+
<p>
|
|
5
|
+
<b><%= column.name.humanize %></b><br>
|
|
6
|
+
<%%= @<%= resource_name %>.<%= column.name %> %>
|
|
7
|
+
</p>
|
|
5
8
|
|
|
9
|
+
<%- end -%>
|
|
6
10
|
<div class="form-actions">
|
|
7
|
-
<%%= link_to
|
|
8
|
-
<%%= link_to
|
|
9
|
-
<%%= link_to
|
|
11
|
+
<%%= link_to 'Back', <%= controller_routing_path %>_path, :class => 'btn' %>
|
|
12
|
+
<%%= link_to 'Edit', edit_<%= singular_controller_routing_path %>_path(@<%= resource_name %>), :class => 'btn' %>
|
|
13
|
+
<%%= link_to 'Delete', <%= singular_controller_routing_path %>_path(@<%= resource_name %>), :method => 'delete', :confirm => 'Are you sure?', :class => 'btn btn-danger' %>
|
|
10
14
|
</div>
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
.form-actions
|
|
7
7
|
= link_to "Back", <%= controller_routing_path %>_path, :class => 'btn'
|
|
8
8
|
= link_to "Edit", edit_<%= singular_controller_routing_path %>_path(@<%= resource_name %>), :class => 'btn'
|
|
9
|
-
= link_to "Delete", <%= singular_controller_routing_path %>_path(@<%= resource_name %>), :method => "delete", :confirm => "#{t("web-app-theme.confirm", :default => "Are you sure?")}", :class => 'btn'
|
|
9
|
+
= link_to "Delete", <%= singular_controller_routing_path %>_path(@<%= resource_name %>), :method => "delete", :confirm => "#{t("web-app-theme.confirm", :default => "Are you sure?")}", :class => 'btn btn-danger'
|
|
@@ -24,7 +24,7 @@ module Bootstrap
|
|
|
24
24
|
def initialize_views_variables
|
|
25
25
|
@base_name, @controller_class_path, @controller_file_path, @controller_class_nesting, @controller_class_nesting_depth = extract_modules(controller_path)
|
|
26
26
|
@controller_routing_path = @controller_file_path.gsub(/\//, '_')
|
|
27
|
-
@model_name = @base_name.singularize unless @model_name
|
|
27
|
+
@model_name = @controller_class_nesting + "::#{@base_name.singularize}" unless @model_name
|
|
28
28
|
@model_name = @model_name.camelize
|
|
29
29
|
end
|
|
30
30
|
|
|
@@ -45,7 +45,7 @@ module Bootstrap
|
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
def resource_name
|
|
48
|
-
@model_name.underscore
|
|
48
|
+
@model_name.demodulize.underscore
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
def plural_resource_name
|
|
@@ -55,9 +55,9 @@ module Bootstrap
|
|
|
55
55
|
def columns
|
|
56
56
|
begin
|
|
57
57
|
excluded_column_names = %w[id created_at updated_at]
|
|
58
|
-
|
|
58
|
+
@model_name.constantize.columns.reject{|c| excluded_column_names.include?(c.name) }.collect{|c| ::Rails::Generators::GeneratedAttribute.new(c.name, c.type)}
|
|
59
59
|
rescue NoMethodError
|
|
60
|
-
|
|
60
|
+
@model_name.constantize.fields.collect{|c| c[1]}.reject{|c| excluded_column_names.include?(c.name) }.collect{|c| ::Rails::Generators::GeneratedAttribute.new(c.name, c.type.to_s)}
|
|
61
61
|
end
|
|
62
62
|
end
|
|
63
63
|
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
require 'rails'
|
|
2
|
+
require File.dirname(__FILE__) + '/twitter-bootstrap-breadcrumbs.rb'
|
|
2
3
|
|
|
3
4
|
module Twitter
|
|
4
5
|
module Bootstrap
|
|
5
6
|
module Rails
|
|
6
7
|
class Engine < ::Rails::Engine
|
|
7
|
-
|
|
8
|
+
|
|
8
9
|
initializer 'twitter-bootstrap-rails.setup',
|
|
9
10
|
:after => 'less-rails.after.load_config_initializers',
|
|
10
11
|
:group => :all do |app|
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
app.config.less.paths << File.join(config.root, 'vendor', 'toolkit')
|
|
13
|
+
end
|
|
13
14
|
|
|
15
|
+
initializer 'twitter-bootstrap-rails.setup_helpers' do |app|
|
|
16
|
+
app.config.to_prepare do
|
|
17
|
+
ActionController::Base.send(:include, BreadCrumbs)
|
|
18
|
+
end
|
|
19
|
+
end
|
|
14
20
|
end
|
|
15
21
|
end
|
|
16
22
|
end
|