twitter-bootstrap-rails 2.0 → 2.0.1.0
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 +31 -37
- data/Rakefile +11 -0
- data/lib/generators/bootstrap/install/install_generator.rb +37 -13
- data/lib/generators/bootstrap/install/templates/application.css +0 -1
- data/lib/generators/bootstrap/install/templates/bootstrap.coffee +6 -15
- data/lib/generators/bootstrap/install/templates/bootstrap_and_overrides.less +13 -0
- data/lib/generators/bootstrap/layout/layout_generator.rb +4 -4
- data/lib/generators/bootstrap/layout/templates/layout.html.erb +96 -49
- data/lib/generators/bootstrap/layout/templates/layout.html.haml +76 -0
- data/lib/generators/bootstrap/layout/templates/layout.html.slim +77 -0
- data/lib/generators/bootstrap/themed/templates/_form.html.erb +5 -4
- data/lib/generators/bootstrap/themed/templates/_form.html.haml +11 -0
- data/lib/generators/bootstrap/themed/templates/_form.html.slim +11 -0
- data/lib/generators/bootstrap/themed/templates/edit.html.erb +1 -2
- data/lib/generators/bootstrap/themed/templates/edit.html.haml +3 -0
- data/lib/generators/bootstrap/themed/templates/edit.html.slim +3 -0
- data/lib/generators/bootstrap/themed/templates/index.html.erb +27 -28
- data/lib/generators/bootstrap/themed/templates/index.html.haml +25 -0
- data/lib/generators/bootstrap/themed/templates/index.html.slim +25 -0
- data/lib/generators/bootstrap/themed/templates/new.html.haml +2 -0
- data/lib/generators/bootstrap/themed/templates/new.html.slim +2 -0
- data/lib/generators/bootstrap/themed/templates/show.html.erb +5 -4
- data/lib/generators/bootstrap/themed/templates/show.html.haml +9 -0
- data/lib/generators/bootstrap/themed/templates/show.html.slim +9 -0
- data/lib/generators/bootstrap/themed/themed_generator.rb +13 -13
- data/lib/twitter/bootstrap/rails/version.rb +1 -1
- 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/bootstrap-alert.js +16 -7
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-button.js +3 -3
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-carousel.js +7 -4
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-collapse.js +7 -5
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-dropdown.js +16 -7
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-modal.js +12 -7
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-popover.js +5 -5
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-scrollspy.js +4 -3
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-tab.js +11 -6
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-tooltip.js +2 -2
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-transition.js +3 -3
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-typeahead.js +40 -21
- data/vendor/toolkit/twitter/bootstrap/accordion.less +5 -4
- data/vendor/toolkit/twitter/bootstrap/alerts.less +1 -0
- data/vendor/toolkit/twitter/bootstrap/bootstrap.less +10 -8
- data/vendor/toolkit/twitter/bootstrap/breadcrumbs.less +1 -1
- data/vendor/toolkit/twitter/bootstrap/button-groups.less +49 -17
- data/vendor/toolkit/twitter/bootstrap/buttons.less +156 -89
- data/vendor/toolkit/twitter/bootstrap/carousel.less +12 -5
- data/vendor/toolkit/twitter/bootstrap/code.less +57 -0
- data/vendor/toolkit/twitter/bootstrap/dropdowns.less +24 -4
- data/vendor/toolkit/twitter/bootstrap/forms.less +117 -91
- data/vendor/toolkit/twitter/bootstrap/grid.less +8 -0
- data/vendor/toolkit/twitter/bootstrap/hero-unit.less +20 -0
- data/vendor/toolkit/twitter/bootstrap/labels.less +23 -7
- data/vendor/toolkit/twitter/bootstrap/layouts.less +17 -0
- data/vendor/toolkit/twitter/bootstrap/mixins.less +253 -36
- data/vendor/toolkit/twitter/bootstrap/modals.less +20 -2
- data/vendor/toolkit/twitter/bootstrap/navbar.less +82 -34
- data/vendor/toolkit/twitter/bootstrap/navs.less +87 -72
- data/vendor/toolkit/twitter/bootstrap/pager.less +7 -2
- data/vendor/toolkit/twitter/bootstrap/pagination.less +1 -0
- data/vendor/toolkit/twitter/bootstrap/popovers.less +25 -25
- data/vendor/toolkit/twitter/bootstrap/progress-bars.less +14 -18
- data/vendor/toolkit/twitter/bootstrap/reset.less +3 -4
- data/vendor/toolkit/twitter/bootstrap/responsive.less +224 -165
- data/vendor/toolkit/twitter/bootstrap/scaffolding.less +6 -89
- data/vendor/toolkit/twitter/bootstrap/sprites.less +139 -99
- data/vendor/toolkit/twitter/bootstrap/tables.less +15 -57
- data/vendor/toolkit/twitter/bootstrap/thumbnails.less +4 -2
- data/vendor/toolkit/twitter/bootstrap/type.less +15 -44
- data/vendor/toolkit/twitter/bootstrap/variables.less +38 -21
- data/vendor/toolkit/twitter/bootstrap_base.less +2 -0
- metadata +36 -21
- data/lib/generators/bootstrap/install/templates/bootstrap.less +0 -5
- data/vendor/assets/stylesheets/twitter/bootstrap.css.less +0 -1
- data/vendor/toolkit/twitter/bootstrap.less +0 -1
- data/vendor/toolkit/twitter/bootstrap/patterns.less +0 -30
- data/vendor/toolkit/twitter/bootstrap/print.less +0 -18
@@ -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
|
+
:css
|
12
|
+
body {
|
13
|
+
padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
|
14
|
+
}
|
15
|
+
= stylesheet_link_tag "application", :media => "all"
|
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.icon-bar
|
33
|
+
%span.icon-bar
|
34
|
+
%span.icon-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
|
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 © 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"
|
@@ -0,0 +1,77 @@
|
|
1
|
+
doctype html
|
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
|
+
|
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
|
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
|
+
= stylesheet_link_tag "application", :media => "all"
|
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
|
+
|
23
|
+
|
24
|
+
body
|
25
|
+
.navbar.navbar-fixed-top
|
26
|
+
.navbar-inner
|
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.icon-bar
|
34
|
+
span.icon-bar
|
35
|
+
span.icon-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"
|
42
|
+
|
43
|
+
.<%= container_class %>
|
44
|
+
<%- if layout_type == "fluid" -%>
|
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
|
56
|
+
<% else %>
|
57
|
+
.content
|
58
|
+
.row
|
59
|
+
.span9
|
60
|
+
= yield
|
61
|
+
.span1
|
62
|
+
.span3
|
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 © 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"
|
@@ -1,12 +1,13 @@
|
|
1
1
|
<% columns.each do |column| %>
|
2
2
|
<div class="clearfix">
|
3
|
-
|
3
|
+
<%%= f.label :<%= column.name %>, t("activerecord.attributes.<%= model_name.underscore %>.<%= column.name %>", :default => "<%= column.name.humanize %>"), :class => :label %>
|
4
4
|
<div class="input">
|
5
5
|
<%%= f.<%= column.field_type %> :<%= column.name %>, :class => '<%= column.field_type %>' %>
|
6
6
|
</div>
|
7
7
|
</div>
|
8
8
|
<%- end -%>
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
|
10
|
+
<div class="form-actions">
|
11
|
+
<%%= button nil, :class => "btn btn-primary" %>
|
12
|
+
<%%= link_to "Cancel", <%= controller_routing_path %>_path %>, :class => 'btn' %>
|
12
13
|
</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
|
@@ -1,4 +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" />
|
1
|
+
<%%= form_for @<%= model_name.underscore %>, :url => <%= singular_controller_routing_path %>_path(@<%= resource_name %>), :html => { :method => "put", :class => "edit_<%= model_name.underscore %>", :id => "edit_<%= model_name.underscore %>" } do |f| -%>
|
3
2
|
<%%= render :partial => "form", :locals => {:f => f} %>
|
4
3
|
<%% end -%>
|
@@ -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,34 +1,33 @@
|
|
1
1
|
<h1><%= resource_name.titleize %>s</h1>
|
2
|
-
<table class="
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
2
|
+
<table class="table table-striped">
|
3
|
+
<thead>
|
4
|
+
<tr>
|
5
|
+
<th>ID</th>
|
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
|
+
</th>
|
10
|
+
<%- end -%>
|
11
|
+
<th>Created at</th>
|
12
|
+
<th>Actions</th>
|
13
|
+
</tr>
|
14
14
|
</thead>
|
15
15
|
<tbody>
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
</tr>
|
16
|
+
<%% @<%= plural_resource_name %>.each do |<%= resource_name %>| -%>
|
17
|
+
<tr>
|
18
|
+
<td><%%= <%= resource_name %>.id %></td>
|
19
|
+
<%- unless columns.empty? -%>
|
20
|
+
<td><%%= link_to <%= resource_name %>.<%= columns.first.name %>, <%= singular_controller_routing_path %>_path(<%= resource_name %>) %></td>
|
21
|
+
<%- end -%>
|
22
|
+
<td><%%= <%= resource_name %>.created_at %></td>
|
23
|
+
<td>
|
24
|
+
<%%= link_to "Show", <%= singular_controller_routing_path %>_path(<%= resource_name %>) %>
|
25
|
+
<%%= link_to "Edit", edit_<%= singular_controller_routing_path %>_path(<%= resource_name %>) %>
|
26
|
+
<%%= link_to "Destroy", <%= singular_controller_routing_path %>_path(<%= resource_name %>), :method => :delete, :confirm => "#{t("web-app-theme.confirm", :default => "Are you sure?")}" %>
|
27
|
+
</td>
|
28
|
+
</tr>
|
30
29
|
<%% end -%>
|
31
|
-
|
30
|
+
</tbody>
|
32
31
|
</table>
|
33
32
|
|
34
|
-
<%%= link_to "New", new_<%= singular_controller_routing_path %>_path, :class => 'btn primary' %>
|
33
|
+
<%%= 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'
|
@@ -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
|
-
|
6
|
-
|
7
|
-
<%%= link_to "
|
8
|
-
<%%= link_to "
|
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
|
-
|
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
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
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
|