twitter-bootstrap-rails 2.0rc0 → 2.0.0

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.

Potentially problematic release.


This version of twitter-bootstrap-rails might be problematic. Click here for more details.

Files changed (30) hide show
  1. data/README.md +20 -23
  2. data/Rakefile +1 -1
  3. data/lib/generators/bootstrap/install/install_generator.rb +1 -1
  4. data/lib/generators/bootstrap/install/templates/bootstrap.coffee +5 -15
  5. data/lib/generators/bootstrap/install/templates/bootstrap.less +4 -3
  6. data/lib/generators/bootstrap/layout/layout_generator.rb +13 -3
  7. data/lib/generators/bootstrap/layout/templates/layout.html.erb +25 -9
  8. data/lib/generators/bootstrap/layout/templates/layout.html.haml +76 -0
  9. data/lib/generators/bootstrap/layout/templates/layout.html.slim +60 -23
  10. data/lib/generators/bootstrap/themed/templates/_form.html.erb +1 -1
  11. data/lib/generators/bootstrap/themed/templates/_form.html.haml +11 -0
  12. data/lib/generators/bootstrap/themed/templates/_form.html.slim +11 -0
  13. data/lib/generators/bootstrap/themed/templates/edit.html.haml +3 -0
  14. data/lib/generators/bootstrap/themed/templates/edit.html.slim +3 -0
  15. data/lib/generators/bootstrap/themed/templates/index.html.erb +2 -2
  16. data/lib/generators/bootstrap/themed/templates/index.html.haml +25 -0
  17. data/lib/generators/bootstrap/themed/templates/index.html.slim +25 -0
  18. data/lib/generators/bootstrap/themed/templates/new.html.haml +2 -0
  19. data/lib/generators/bootstrap/themed/templates/new.html.slim +2 -0
  20. data/lib/generators/bootstrap/themed/templates/show.html.erb +5 -4
  21. data/lib/generators/bootstrap/themed/templates/show.html.haml +9 -0
  22. data/lib/generators/bootstrap/themed/templates/show.html.slim +9 -0
  23. data/lib/generators/bootstrap/themed/themed_generator.rb +13 -13
  24. data/lib/twitter/bootstrap/rails/version.rb +1 -1
  25. data/vendor/toolkit/twitter/bootstrap/button-groups.less +1 -2
  26. data/vendor/toolkit/twitter/bootstrap/forms.less +3 -3
  27. data/vendor/toolkit/twitter/bootstrap/navbar.less +2 -2
  28. data/vendor/toolkit/twitter/bootstrap/navs.less +1 -1
  29. data/vendor/toolkit/twitter/bootstrap/responsive.less +1 -1
  30. metadata +24 -13
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
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
3
 
4
4
 
5
- twitter-bootstrap-rails project integrates Bootstrap CSS toolkit for Rails 3.1 Asset Pipeline
5
+ twitter-bootstrap-rails project integrates Bootstrap CSS toolkit for Rails 3.1 Asset Pipeline (Rails 3.2 supported)
6
6
 
7
7
 
8
8
  ## Installing Gem
@@ -34,13 +34,13 @@ Usage:
34
34
  rails g bootstrap:install
35
35
 
36
36
 
37
- Layout (generates Twitter Bootstrap compatible layout.) - (Slim supported)
37
+ Layout (generates Twitter Bootstrap compatible layout with flash messages) - (Haml and Slim supported)
38
38
 
39
39
 
40
40
  Usage:
41
41
 
42
42
 
43
- rails g bootstrap:layout [LAYOUT_NAME] [*fixed or fluid] [options]
43
+ rails g bootstrap:layout [LAYOUT_NAME] [*fixed or fluid]
44
44
 
45
45
 
46
46
  Example:
@@ -49,13 +49,13 @@ Example:
49
49
  rails g bootstrap:layout application fixed
50
50
 
51
51
 
52
- Themed (generates Twitter Bootstrap compatible scaffold views.)
52
+ Themed (generates Twitter Bootstrap compatible scaffold views.) - (Haml and Slim supported)
53
53
 
54
54
 
55
55
  Usage:
56
56
 
57
57
 
58
- rails g bootstrap:themed [RESOURCE_NAME] [LAYOUT] [options]
58
+ rails g bootstrap:themed [RESOURCE_NAME]
59
59
 
60
60
 
61
61
  Example:
@@ -83,12 +83,14 @@ You have to require Bootstrap LESS (bootstrap.less) in your application.css
83
83
 
84
84
 
85
85
  Now, you can override LESS files provided by Twitter Bootstrap
86
+ Also, you can import additional files (.ie responsive)
86
87
 
87
- @import "twitter/bootstrap";
88
+ @import "twitter/bootstrap";
88
89
 
89
- // Baseline grid
90
- @basefont: 13px;
91
- @baseline: 18px;
90
+ // import responsive layout
91
+ @import "twitter/bootstrap/responsive";
92
+
93
+ // Your custom stylesheets goes here (override Less here)
92
94
 
93
95
 
94
96
  ## Using Javascripts
@@ -108,27 +110,17 @@ Using Twitter Bootstrap with the CoffeeScript is easy.
108
110
  twitter-bootstrap-rails generates a "bootstrap.js.coffee" file for you
109
111
  to /app/assets/javascripts/ folder.
110
112
 
111
- $ ->
113
+ jQuery ->
112
114
  $(".alert-message").alert()
113
- $ ->
114
115
  $(".tabs").button()
115
- $ ->
116
116
  $(".carousel").carousel()
117
- $ ->
118
117
  $(".collapse").collapse()
119
- $ ->
120
118
  $(".dropdown-toggle").dropdown()
121
- $ ->
122
- $(".modal").modal
123
- $ ->
124
- $("a[rel]").popover
125
- $ ->
119
+ $(".modal").modal()
120
+ $("a[rel]").popover()
126
121
  $(".navbar").scrollspy()
127
- $ ->
128
122
  $(".tab").tab "show"
129
- $ ->
130
- $(".tooltip").tooltip
131
- $ ->
123
+ $(".tooltip").tooltip()
132
124
  $(".typeahead").typeahead()
133
125
 
134
126
 
@@ -161,6 +153,10 @@ twitter-bootstrap-rails has seperate branch (w/o Less) that just serves latest s
161
153
  <li>Compability to Rails 3.2</li>
162
154
  <li>Transitioning to 2.0</li>
163
155
  <li>Released gem v.2.0rc0</li>
156
+ <li>Added Haml and Slim support</li>
157
+ <li>Added Twitter Bootstrap compatible flash messages</li>
158
+ <li>Added Responsive layout support</li>
159
+ <li>Fixes and release 2.0.0</li>
164
160
  </ul>
165
161
 
166
162
 
@@ -176,6 +172,7 @@ twitter-bootstrap-rails has seperate branch (w/o Less) that just serves latest s
176
172
  <li>Giovanni Cappellotto</li>
177
173
  <li>Masakuni Kato</li>
178
174
  <li>Gudleik Rasch</li>
175
+ <li>Thomas Volkmar Worm</li>
179
176
  </ul>
180
177
 
181
178
 
data/Rakefile CHANGED
@@ -1,3 +1,3 @@
1
+ #!/usr/bin/env rake
1
2
  require 'bundler'
2
3
  Bundler::GemHelper.install_tasks
3
-
@@ -2,7 +2,7 @@ require 'rails/generators'
2
2
 
3
3
  module Bootstrap
4
4
  module Generators
5
- class InstallGenerator < Rails::Generators::Base
5
+ class InstallGenerator < ::Rails::Generators::Base
6
6
  source_root File.expand_path("../templates", __FILE__)
7
7
  desc "This generator installs Twitter Bootstrap to Asset Pipeline"
8
8
 
@@ -1,22 +1,12 @@
1
- $ ->
1
+ jQuery ->
2
2
  $(".alert-message").alert()
3
- $ ->
4
3
  $(".tabs").button()
5
- $ ->
6
4
  $(".carousel").carousel()
7
- $ ->
8
5
  $(".collapse").collapse()
9
- $ ->
10
6
  $(".dropdown-toggle").dropdown()
11
- $ ->
12
- $(".modal").modal
13
- $ ->
14
- $("a[rel]").popover
15
- $ ->
7
+ $(".modal").modal()
8
+ $("a[rel]").popover()
16
9
  $(".navbar").scrollspy()
17
- $ ->
18
10
  $(".tab").tab "show"
19
- $ ->
20
- $(".tooltip").tooltip
21
- $ ->
22
- $(".typeahead").typeahead()
11
+ $(".tooltip").tooltip()
12
+ $(".typeahead").typeahead()
@@ -1,5 +1,6 @@
1
1
  @import "twitter/bootstrap";
2
2
 
3
- // Baseline grid
4
- @basefont: 13px;
5
- @baseline: 18px;
3
+ // import responsive layout
4
+ @import "twitter/bootstrap/responsive";
5
+
6
+ // Your custom stylesheets goes here (override Less here)
@@ -2,17 +2,27 @@ require 'rails/generators'
2
2
 
3
3
  module Bootstrap
4
4
  module Generators
5
- class LayoutGenerator < Rails::Generators::Base
5
+ class LayoutGenerator < ::Rails::Generators::Base
6
6
  source_root File.expand_path("../templates", __FILE__)
7
- desc "This generator creates layout file with navigation."
7
+ desc "This generator generates layout file with navigation."
8
8
  argument :layout_name, :type => :string, :default => "application"
9
9
  argument :layout_type, :type => :string, :default => "fixed",
10
10
  :banner => "*fixed or fluid"
11
11
 
12
12
  attr_reader :app_name, :container_class
13
13
 
14
+ def add_helper
15
+ if File.exists?(Rails.root.join("app/helpers/application_helper.rb"))
16
+ say "Bootstrap helpers installs to application_helper..."
17
+ insert_into_file "app/helpers/application_helper.rb",
18
+ " def flash_class(level)\n case level\n when :notice then 'info'\n when :error then 'error'\n when :alert then 'warning'\n end\n end\n", :after => "module ApplicationHelper\n"
19
+ else
20
+ say "Already installed"
21
+ end
22
+ end
23
+
14
24
  def generate_layout
15
- app = Rails.application
25
+ app = ::Rails.application
16
26
  @app_name = app.class.to_s.split("::").first
17
27
  @container_class = layout_type == "fluid" ? "container-fluid" : "container"
18
28
  ext = app.config.generators.options[:rails][:template_engine] || :erb
@@ -7,11 +7,11 @@
7
7
 
8
8
  <!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
9
9
  <!--[if lt IE 9]>
10
- <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
10
+ <script src="http://html5shim.googlecode.com/svn/trunk/html5.js" type="text/javascript"></script>
11
11
  <![endif]-->
12
12
 
13
13
  <!-- Le styles -->
14
- <%%= stylesheet_link_tag "application" %>
14
+ <%%= stylesheet_link_tag "application", :media => "all" %>
15
15
  <style>
16
16
  body {
17
17
  padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
@@ -19,10 +19,10 @@
19
19
  </style>
20
20
 
21
21
  <!-- Le fav and touch icons -->
22
- <link rel="shortcut icon" href="images/favicon.ico">
23
- <link rel="apple-touch-icon" href="images/apple-touch-icon.png">
24
- <link rel="apple-touch-icon" sizes="72x72" href="images/apple-touch-icon-72x72.png">
25
- <link rel="apple-touch-icon" sizes="114x114" href="images/apple-touch-icon-114x114.png">
22
+ <link href="images/favicon.ico" rel="shortcut icon">
23
+ <link href="images/apple-touch-icon.png" rel="apple-touch-icon">
24
+ <link href="images/apple-touch-icon-72x72.png" rel="apple-touch-icon" sizes="72x72">
25
+ <link href="images/apple-touch-icon-114x114.png" rel="apple-touch-icon" sizes="114x114">
26
26
  </head>
27
27
  <body>
28
28
 
@@ -33,7 +33,7 @@
33
33
  <%- else -%>
34
34
  <div class="container">
35
35
  <%- end -%>
36
- <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
36
+ <a class="btn btn-navbar" data-target=".nav-collapse" data-toggle="collapse">
37
37
  <span class="i-bar"></span>
38
38
  <span class="i-bar"></span>
39
39
  <span class="i-bar"></span>
@@ -64,6 +64,14 @@
64
64
  </div><!--/.well -->
65
65
  </div><!--/span-->
66
66
  <div class="span9">
67
+ <%% [:notice, :error, :alert].each do |level| %>
68
+ <%% unless flash[level].blank? %>
69
+ <div data-alert="alert" class="alert alert-<%%= flash_class(level) %> fade in">
70
+ <a class="close" data-dismiss="alert" href="#">&times;</a>
71
+ <%= content_tag :p, flash[level] %>
72
+ </div>
73
+ <%% end %>
74
+ <%% end %>
67
75
  <%%= yield %>
68
76
  </div>
69
77
  </div><!--/row-->
@@ -71,7 +79,15 @@
71
79
  <div class="content">
72
80
  <div class="row">
73
81
  <div class="span9">
74
- <%%= yield %>
82
+ <%% [:notice, :error, :alert].each do |level| %>
83
+ <%% unless flash[level].blank? %>
84
+ <div data-alert="alert" class="alert alert-<%%= flash_class(level) %> fade in">
85
+ <a class="close" data-dismiss="alert" href="#">&times;</a>
86
+ <%%= content_tag :p, flash[level] %>
87
+ </div>
88
+ <%% end %>
89
+ <%% end %>
90
+ <%%= yield %>
75
91
  </div>
76
92
  <div class="span1">&nbsp;</div>
77
93
  <div class="span3">
@@ -101,4 +117,4 @@
101
117
  <%%= javascript_include_tag "application" %>
102
118
 
103
119
  </body>
104
- </html>
120
+ </html>
@@ -0,0 +1,76 @@
1
+ !!! 5
2
+ %html{:lang => "en"}
3
+ %head
4
+ %meta{:charset => "utf-8"}/
5
+ %title= content_for?(:title) ? yield(:title) : "<%= app_name %>"
6
+ = csrf_meta_tags
7
+ / Le HTML5 shim, for IE6-8 support of HTML elements
8
+ /[if lt IE 9]
9
+ = javascript_include_tag "http://html5shim.googlecode.com/svn/trunk/html5.js"
10
+ / Le styles
11
+ = stylesheet_link_tag "application"
12
+ :css
13
+ body {
14
+ padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
15
+ }
16
+ / Le fav and touch icons
17
+ %link{:href => "images/favicon.ico", :rel => "shortcut icon"}/
18
+ %link{:href => "images/apple-touch-icon.png", :rel => "apple-touch-icon"}/
19
+ %link{:href => "images/apple-touch-icon-72x72.png", :rel => "apple-touch-icon", :sizes => "72x72"}/
20
+ %link{:href => "images/apple-touch-icon-114x114.png", :rel => "apple-touch-icon", :sizes => "114x114"}/
21
+
22
+
23
+ %body
24
+ .navbar.navbar-fixed-top
25
+ .navbar-inner
26
+ <%- if layout_type == "fluid" -%>
27
+ .container-fluid
28
+ <%- else -%>
29
+ .container
30
+ <%- end -%>
31
+ %a.btn.btn-navbar{"data-target" => ".nav-collapse", "data-toggle" => "collapse"}
32
+ %span.i-bar
33
+ %span.i-bar
34
+ %span.i-bar
35
+ %a.brand{:href => "#"}<%= app_name %>
36
+ .<%=container_class%>.nav-collapse
37
+ %ul.nav
38
+ %li= link_to "Link 1", "/path1"
39
+ %li= link_to "Link 2", "/path2"
40
+ %li= link_to "Link 3", "/path3"
41
+
42
+ .<%= container_class %>
43
+ <%- if layout_type == "fluid" -%>
44
+
45
+ .row-fluid
46
+ .span3
47
+ .well.sidebar-nav
48
+ %ul.nav.nav-list
49
+ %li.nav-header Sidebar
50
+ %li= link_to "Link 1", "/path1"
51
+ %li= link_to "Link 2", "/path2"
52
+ %li= link_to "Link 3", "/path3"
53
+ .span9
54
+ = yield
55
+ <% else %>
56
+ .content
57
+ .row
58
+ .span9
59
+ = yield
60
+ .span1 &nbsp;
61
+ .span3
62
+ .well.sidebar-nav
63
+ %h3 Sidebar
64
+ %ul.nav.nav-list
65
+ %li.nav-header Sidebar
66
+ %li= link_to "Link 1", "/path1"
67
+ %li= link_to "Link 2", "/path2"
68
+ %li= link_to "Link 3", "/path3"
69
+ <% end %>
70
+ %footer
71
+ %p &copy; Company 2012
72
+ /
73
+ Le javascript
74
+ \==================================================
75
+ / Placed at the end of the document so the pages load faster
76
+ = javascript_include_tag "application"
@@ -3,38 +3,75 @@ html lang="en"
3
3
  head
4
4
  meta charset="utf-8"
5
5
  title= content_for?(:title) ? yield(:title) : "<%= app_name %>"
6
- = javascript_include_tag "application"
6
+ = csrf_meta_tags
7
+
8
+ /! Le HTML5 shim, for IE6-8 support of HTML elements
9
+ /[if lt IE 9]
10
+ = javascript_include_tag "http://html5shim.googlecode.com/svn/trunk/html5.js"
11
+ /! Le styles
7
12
  = stylesheet_link_tag "application"
13
+ css:
14
+ body {
15
+ padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
16
+ }
17
+ / Le fav and touch icons
18
+ link href="images/favicon.ico" rel="shortcut icon"
19
+ link href="images/apple-touch-icon.png" rel="apple-touch-icon"
20
+ link href="images/apple-touch-icon-72x72.png" rel="apple-touch-icon" sizes="72x72"
21
+ link href="images/apple-touch-icon-114x114.png" rel="apple-touch-icon" sizes="114x114"
22
+
8
23
 
9
24
  body
10
- .navbar
25
+ .navbar.navbar-fixed-top
11
26
  .navbar-inner
12
- .<%= container_class %>
13
- h3= link_to "<%= app_name %>", root_path, :class => "brand"
14
- ul.nav
15
- li= link_to "Link 1", "/path1"
16
- li= link_to "Link 2", "/path2"
17
- li= link_to "Link 3", "/path3"
27
+ <%- if layout_type == "fluid" -%>
28
+ .container-fluid
29
+ <%- else -%>
30
+ .container
31
+ <%- end -%>
32
+ a.btn.btn-navbar data-target=".nav-collapse" data-toggle="collapse"
33
+ span.i-bar
34
+ span.i-bar
35
+ span.i-bar
36
+ a.brand href="#"<%= app_name %>
37
+ .<%=container_class%>.nav-collapse
38
+ ul.nav
39
+ li= link_to "Link 1", "/path1"
40
+ li= link_to "Link 2", "/path2"
41
+ li= link_to "Link 3", "/path3"
18
42
 
19
43
  .<%= container_class %>
20
44
  <%- if layout_type == "fluid" -%>
21
- .sidebar
22
- .well
23
- h5 Sidebar
24
- ul
25
- li= link_to "Link 1", "/path1"
26
- li= link_to "Link 2", "/path2"
27
- li= link_to "Link 3", "/path3"
28
- .content= yield
45
+
46
+ .row-fluid
47
+ .span3
48
+ .well.sidebar-nav
49
+ ul.nav.nav-list
50
+ li.nav-header Sidebar
51
+ li= link_to "Link 1", "/path1"
52
+ li= link_to "Link 2", "/path2"
53
+ li= link_to "Link 3", "/path3"
54
+ .span9
55
+ = yield
29
56
  <% else %>
30
57
  .content
31
58
  .row
32
- .span9= yield
59
+ .span9
60
+ = yield
33
61
  .span1 &nbsp;
34
62
  .span3
35
- h3 Sidebar
36
- ul
37
- li= link_to "Link 1", "/path1"
38
- li= link_to "Link 2", "/path2"
39
- li= link_to "Link 3", "/path3"
40
- <% end %>
63
+ .well.sidebar-nav
64
+ h3 Sidebar
65
+ ul.nav.nav-list
66
+ li.nav-header Sidebar
67
+ li= link_to "Link 1", "/path1"
68
+ li= link_to "Link 2", "/path2"
69
+ li= link_to "Link 3", "/path3"
70
+ <% end %>
71
+ footer
72
+ p &copy; Company 2012
73
+ /!
74
+ Le javascript
75
+ \==================================================
76
+ /! Placed at the end of the document so the pages load faster
77
+ = javascript_include_tag "application"
@@ -6,7 +6,7 @@
6
6
  </div>
7
7
  </div>
8
8
  <%- end -%>
9
- <div class="actions">
9
+ <div class="form-actions">
10
10
  <button class="btn primary" type="submit">Save</button> or
11
11
  <%%= link_to "Cancel", <%= controller_routing_path %>_path %>
12
12
  </div>
@@ -0,0 +1,11 @@
1
+ <%- columns.each do |column| -%>
2
+ .clearfix
3
+ = f.label :<%= column.name %>, t("activerecord.attributes.<%= model_name.underscore %>.<%= column.name %>", :default => "<%= column.name.humanize %>"), :class => :label
4
+ .input
5
+ = f.<%= column.field_type %> :<%= column.name %>, :class => '<%= column.field_type %>'
6
+ <%- end -%>
7
+
8
+ .form-actions
9
+ %button{:class => "btn primary", :type => "submit"} Save
10
+ or
11
+ = link_to "Cancel", <%= controller_routing_path %>_path
@@ -0,0 +1,11 @@
1
+ <%- columns.each do |column| -%>
2
+ .clearfix
3
+ = f.label :<%= column.name %>, t("activerecord.attributes.<%= model_name.underscore %>.<%= column.name %>", :default => "<%= column.name.humanize %>"), :class => :label
4
+ .input
5
+ = f.<%= column.field_type %> :<%= column.name %>, :class => '<%= column.field_type %>'
6
+ <%- end -%>
7
+
8
+ .form-actions
9
+ button class="btn primary" type="submit" Save
10
+ | or
11
+ = link_to "Cancel", <%= controller_routing_path %>_path
@@ -0,0 +1,3 @@
1
+ = form_for @<%= model_name.underscore %>, :url => <%= singular_controller_routing_path %>_path(@<%= resource_name %>), :html => { :class => "edit_<%= model_name.underscore %>", :id => "edit_<%= model_name.underscore %>" } do |f|
2
+ %input{:name => "_method", :type => "hidden", :value =>"put"}
3
+ = render :partial => "form", :locals => {:f => f}
@@ -0,0 +1,3 @@
1
+ = form_for @<%= model_name.underscore %>, :url => <%= singular_controller_routing_path %>_path(@<%= resource_name %>), :html => { :class => "edit_<%= model_name.underscore %>", :id => "edit_<%= model_name.underscore %>" } do |f|
2
+ input name="_method" type="hidden" value="put"
3
+ = render :partial => "form", :locals => {:f => f}
@@ -1,5 +1,5 @@
1
1
  <h1><%= resource_name.titleize %>s</h1>
2
- <table class="zebra-striped">
2
+ <table class="table table-striped">
3
3
  <thead>
4
4
  <tr>
5
5
  <th>ID</th>
@@ -31,4 +31,4 @@
31
31
  </tbody>
32
32
  </table>
33
33
 
34
- <%%= link_to "New", new_<%= singular_controller_routing_path %>_path, :class => 'btn primary' %>
34
+ <%%= link_to "New", new_<%= singular_controller_routing_path %>_path, :class => 'btn btn-primary' %>
@@ -0,0 +1,25 @@
1
+ %h1 <%= resource_name.titleize %>s
2
+ %table{:class => "table table-striped"}
3
+ %thead
4
+ %tr
5
+ %th ID
6
+ <%- unless columns.empty? -%>
7
+ %th
8
+ = t("activerecord.attributes.<%= singular_controller_routing_path %>.<%= columns.first.name %>", :default => t("activerecord.labels.<%= columns.first.name %>", :default => "<%= columns.first.name.capitalize %>"))
9
+ <%- end -%>
10
+ %th Created at
11
+ %th Actions
12
+ %tbody
13
+ - @<%= plural_resource_name %>.each do |<%= resource_name %>|
14
+ %tr
15
+ %td= <%= resource_name %>.id
16
+ <%- unless columns.empty? -%>
17
+ %td= link_to <%= resource_name %>.<%= columns.first.name %>, <%= singular_controller_routing_path %>_path(<%= resource_name %>)
18
+ <%- end -%>
19
+ %td= <%= resource_name %>.created_at
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?")}"
24
+
25
+ = link_to "New", new_<%= singular_controller_routing_path %>_path, :class => 'btn btn-primary'
@@ -0,0 +1,25 @@
1
+ h1 <%= resource_name.titleize %>s
2
+ table class="table table-striped"
3
+ thead
4
+ tr
5
+ th ID
6
+ <%- unless columns.empty? -%>
7
+ th
8
+ = t("activerecord.attributes.<%= singular_controller_routing_path %>.<%= columns.first.name %>", :default => t("activerecord.labels.<%= columns.first.name %>", :default => "<%= columns.first.name.capitalize %>"))
9
+ <%- end -%>
10
+ th Created at
11
+ th Actions
12
+ tbody
13
+ - @<%= plural_resource_name %>.each do |<%= resource_name %>|
14
+ tr
15
+ td= <%= resource_name %>.id
16
+ <%- unless columns.empty? -%>
17
+ td= link_to <%= resource_name %>.<%= columns.first.name %>, <%= singular_controller_routing_path %>_path(<%= resource_name %>)
18
+ <%- end -%>
19
+ td= <%= resource_name %>.created_at
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?")}"
24
+
25
+ = link_to "New", new_<%= singular_controller_routing_path %>_path, :class => 'btn btn-primary'
@@ -0,0 +1,2 @@
1
+ = form_for @<%= model_name.underscore %>, :url => <%= controller_routing_path %>_path, :html => { :class => :form } do |f|
2
+ = render :partial => "form", :locals => {:f => f}
@@ -0,0 +1,2 @@
1
+ = form_for @<%= model_name.underscore %>, :url => <%= controller_routing_path %>_path, :html => { :class => :form } do |f|
2
+ = render :partial => "form", :locals => {:f => f}
@@ -2,8 +2,9 @@
2
2
  <label class="label"><%%= t("activerecord.attributes.<%= singular_controller_routing_path %>.<%= column.name %>", :default => t("activerecord.labels.<%= column.name %>", :default => "<%= column.name.humanize %>")) %>:</label>
3
3
  <p><%%= @<%= resource_name %>.<%= column.name %> %></p>
4
4
  <%- end -%>
5
- <div class="actions">
6
- <%%= link_to "Back", <%= controller_routing_path %>_path, :class => 'btn primary' %>
7
- <%%= link_to "Edit", edit_<%= singular_controller_routing_path %>_path(@<%= resource_name %>), :class => 'btn primary' %>
8
- <%%= link_to "Delete", <%= singular_controller_routing_path %>_path(@<%= resource_name %>), :method => "delete", :confirm => "#{t("web-app-theme.confirm", :default => "Are you sure?")}", :class => 'btn primary' %>
5
+
6
+ <div class="form-actions">
7
+ <%%= link_to "Back", <%= controller_routing_path %>_path, :class => 'btn' %>
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
10
  </div>
@@ -0,0 +1,9 @@
1
+ <%- columns.each do |column| -%>
2
+ %label{:class => "label"}= t("activerecord.attributes.<%= singular_controller_routing_path %>.<%= column.name %>", :default => t("activerecord.labels.<%= column.name %>", :default => "<%= column.name.humanize %>")) + ":"
3
+ %p= @<%= resource_name %>.<%= column.name %>
4
+ <%- end -%>
5
+
6
+ .form-actions
7
+ = link_to "Back", <%= controller_routing_path %>_path, :class => 'btn'
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'
@@ -0,0 +1,9 @@
1
+ <%- columns.each do |column| -%>
2
+ label class="label"= t("activerecord.attributes.<%= singular_controller_routing_path %>.<%= column.name %>", :default => t("activerecord.labels.<%= column.name %>", :default => "<%= column.name.humanize %>")) + ":"
3
+ p= @<%= resource_name %>.<%= column.name %>
4
+ <%- end -%>
5
+
6
+ .form-actions
7
+ = link_to "Back", <%= controller_routing_path %>_path, :class => 'btn'
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'
@@ -3,7 +3,7 @@ require 'rails/generators/generated_attribute'
3
3
 
4
4
  module Bootstrap
5
5
  module Generators
6
- class ThemedGenerator < Rails::Generators::Base
6
+ class ThemedGenerator < ::Rails::Generators::Base
7
7
  source_root File.expand_path('../templates', __FILE__)
8
8
  argument :controller_path, :type => :string
9
9
  argument :model_name, :type => :string, :required => false
@@ -15,12 +15,8 @@ module Bootstrap
15
15
  initialize_views_variables
16
16
  end
17
17
 
18
- def copy_views
18
+ def copy_views
19
19
  generate_views
20
- gsub_file(File.join('app/views/layouts', "#{layout}.html.erb"), /\<ul\s+class=\"nav\">.*\<\/ul\>/mi) do |match|
21
- match.gsub!(/\<\/ul\>/, "")
22
- %|#{match} <li class="<%= controller.controller_path == '#{@controller_file_path}' ? 'active' : '' %>"><a href="<%= #{controller_routing_path}_path %>">#{plural_model_name}</a></li></ul>|
23
- end
24
20
  end
25
21
 
26
22
  protected
@@ -59,9 +55,9 @@ module Bootstrap
59
55
  def columns
60
56
  begin
61
57
  excluded_column_names = %w[id created_at updated_at]
62
- Kernel.const_get(@model_name).columns.reject{|c| excluded_column_names.include?(c.name) }.collect{|c| Rails::Generators::GeneratedAttribute.new(c.name, c.type)}
58
+ Kernel.const_get(@model_name).columns.reject{|c| excluded_column_names.include?(c.name) }.collect{|c| ::Rails::Generators::GeneratedAttribute.new(c.name, c.type)}
63
59
  rescue NoMethodError
64
- Kernel.const_get(@model_name).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)}
60
+ Kernel.const_get(@model_name).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)}
65
61
  end
66
62
  end
67
63
 
@@ -76,11 +72,11 @@ module Bootstrap
76
72
 
77
73
  def generate_views
78
74
  views = {
79
- 'index.html.erb' => File.join('app/views', @controller_file_path, "index.html.erb"),
80
- 'new.html.erb' => File.join('app/views', @controller_file_path, "new.html.erb"),
81
- 'edit.html.erb' => File.join('app/views', @controller_file_path, "edit.html.erb"),
82
- '_form.html.erb' => File.join('app/views', @controller_file_path, "_form.html.erb"),
83
- 'show.html.erb' => File.join('app/views', @controller_file_path, "show.html.erb")}
75
+ "index.html.#{ext}" => File.join('app/views', @controller_file_path, "index.html.#{ext}"),
76
+ "new.html.#{ext}" => File.join('app/views', @controller_file_path, "new.html.#{ext}"),
77
+ "edit.html.#{ext}" => File.join('app/views', @controller_file_path, "edit.html.#{ext}"),
78
+ "_form.html.#{ext}" => File.join('app/views', @controller_file_path, "_form.html.#{ext}"),
79
+ "show.html.#{ext}" => File.join('app/views', @controller_file_path, "show.html.#{ext}")}
84
80
  selected_views = views
85
81
  options.engine == generate_erb(selected_views)
86
82
  end
@@ -91,6 +87,10 @@ module Bootstrap
91
87
  end
92
88
  end
93
89
 
90
+ def ext
91
+ ::Rails.application.config.generators.options[:rails][:template_engine] || :erb
92
+ end
93
+
94
94
  end
95
95
  end
96
96
  end
@@ -1,7 +1,7 @@
1
1
  module Twitter
2
2
  module Bootstrap
3
3
  module Rails
4
- VERSION = "2.0rc0"
4
+ VERSION = "2.0.0"
5
5
  end
6
6
  end
7
7
  end
@@ -29,7 +29,7 @@
29
29
  position: relative;
30
30
  float: left;
31
31
  margin-left: -1px;
32
- .border-radius(0);
32
+ .border-radius(0px);
33
33
  }
34
34
  // Set corners individual because sometimes a single button can be in a .btn-group and we need :first-child and :last-child to both match
35
35
  .btn-group .btn:first-child {
@@ -144,4 +144,3 @@
144
144
  .btn-small .caret {
145
145
  margin-top: 4px;
146
146
  }
147
-
@@ -86,7 +86,7 @@ input[type="radio"] {
86
86
  line-height: normal;
87
87
  border: 0;
88
88
  cursor: pointer;
89
- .border-radius(0);
89
+ .border-radius(0px); /* mirror bootstrap commit 9b9e1d3 reversing IE9 hack and use mixin instead */
90
90
  }
91
91
 
92
92
  // Reset the file input to browser defaults
@@ -309,7 +309,7 @@ select:focus:required:invalid {
309
309
  border-color: #ee5f5b;
310
310
  &:focus {
311
311
  border-color: darken(#ee5f5b, 10%);
312
- .box-shadow(0 0 6px lighten(#ee5f5b, 20%));
312
+ .box-shadow(0 0 6px lighten(#ee5f5b, 20%));
313
313
  }
314
314
  }
315
315
 
@@ -412,7 +412,7 @@ select:focus:required:invalid {
412
412
  .border-radius(3px 0 0 3px);
413
413
  }
414
414
  .uneditable-input {
415
- border-right-color: #ccc;
415
+ border-right-color: #ccc;
416
416
  }
417
417
  .add-on {
418
418
  margin-right: 0;
@@ -161,7 +161,7 @@
161
161
  .navbar-fixed-top .navbar-inner {
162
162
  padding-left: 0;
163
163
  padding-right: 0;
164
- .border-radius(0);
164
+ .border-radius(0px);
165
165
  }
166
166
 
167
167
 
@@ -289,4 +289,4 @@
289
289
  left: auto;
290
290
  right: 13px;
291
291
  }
292
- }
292
+ }
@@ -152,7 +152,7 @@
152
152
  }
153
153
  .nav-tabs.nav-stacked > li > a {
154
154
  border: 1px solid #ddd;
155
- .border-radius(0);
155
+ .border-radius(0px);
156
156
  }
157
157
  .nav-tabs.nav-stacked > li:first-child > a {
158
158
  .border-radius(4px 4px 0 0);
@@ -242,7 +242,7 @@
242
242
  padding: 0;
243
243
  background-color: transparent;
244
244
  border: none;
245
- .border-radius(0);
245
+ .border-radius(0px);
246
246
  .box-shadow(none);
247
247
  }
248
248
  .navbar .dropdown-menu:before,
metadata CHANGED
@@ -1,19 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twitter-bootstrap-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0rc0
5
- prerelease: 3
4
+ version: 2.0.0
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Seyhun Akyurek
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-02 00:00:00.000000000 Z
12
+ date: 2012-02-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
16
- requirement: &85810950 !ruby/object:Gem::Requirement
16
+ requirement: &84261730 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '3.1'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *85810950
24
+ version_requirements: *84261730
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: actionpack
27
- requirement: &85810650 !ruby/object:Gem::Requirement
27
+ requirement: &84261480 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '3.1'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *85810650
35
+ version_requirements: *84261480
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: less-rails
38
- requirement: &85810370 !ruby/object:Gem::Requirement
38
+ requirement: &84261250 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 2.1.2
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *85810370
46
+ version_requirements: *84261250
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rails
49
- requirement: &85810030 !ruby/object:Gem::Requirement
49
+ requirement: &84260990 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '3.1'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *85810030
57
+ version_requirements: *84260990
58
58
  description: twitter-bootstrap-rails project integrates Bootstrap CSS toolkit for
59
59
  Rails 3.1 Asset Pipeline
60
60
  email:
@@ -66,12 +66,23 @@ files:
66
66
  - lib/generators/bootstrap/layout/layout_generator.rb
67
67
  - lib/generators/bootstrap/layout/templates/layout.html.slim
68
68
  - lib/generators/bootstrap/layout/templates/layout.html.erb
69
+ - lib/generators/bootstrap/layout/templates/layout.html.haml
69
70
  - lib/generators/bootstrap/themed/themed_generator.rb
71
+ - lib/generators/bootstrap/themed/templates/new.html.slim
70
72
  - lib/generators/bootstrap/themed/templates/show.html.erb
73
+ - lib/generators/bootstrap/themed/templates/show.html.slim
71
74
  - lib/generators/bootstrap/themed/templates/new.html.erb
75
+ - lib/generators/bootstrap/themed/templates/show.html.haml
76
+ - lib/generators/bootstrap/themed/templates/edit.html.haml
77
+ - lib/generators/bootstrap/themed/templates/_form.html.haml
78
+ - lib/generators/bootstrap/themed/templates/_form.html.slim
79
+ - lib/generators/bootstrap/themed/templates/edit.html.slim
80
+ - lib/generators/bootstrap/themed/templates/new.html.haml
72
81
  - lib/generators/bootstrap/themed/templates/index.html.erb
73
82
  - lib/generators/bootstrap/themed/templates/_form.html.erb
74
83
  - lib/generators/bootstrap/themed/templates/edit.html.erb
84
+ - lib/generators/bootstrap/themed/templates/index.html.haml
85
+ - lib/generators/bootstrap/themed/templates/index.html.slim
75
86
  - lib/generators/bootstrap/install/templates/bootstrap.coffee
76
87
  - lib/generators/bootstrap/install/templates/application.js
77
88
  - lib/generators/bootstrap/install/templates/application.css
@@ -150,9 +161,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
150
161
  required_rubygems_version: !ruby/object:Gem::Requirement
151
162
  none: false
152
163
  requirements:
153
- - - ! '>'
164
+ - - ! '>='
154
165
  - !ruby/object:Gem::Version
155
- version: 1.3.1
166
+ version: '0'
156
167
  requirements: []
157
168
  rubyforge_project: twitter-bootstrap-rails
158
169
  rubygems_version: 1.8.11