twitter-bootstrap-rails-ajax 0.0.1
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 +221 -0
- data/Rakefile +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 +4 -0
- data/lib/generators/bootstrap/install/templates/bootstrap_and_overrides.less +29 -0
- data/lib/generators/bootstrap/layout/layout_generator.rb +23 -0
- data/lib/generators/bootstrap/layout/templates/layout.html.erb +97 -0
- data/lib/generators/bootstrap/layout/templates/layout.html.haml +70 -0
- data/lib/generators/bootstrap/layout/templates/layout.html.slim +70 -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 +4 -0
- 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 +38 -0
- data/lib/generators/bootstrap/themed/templates/index.html.haml +24 -0
- data/lib/generators/bootstrap/themed/templates/index.html.slim +26 -0
- data/lib/generators/bootstrap/themed/templates/new.html.erb +4 -0
- data/lib/generators/bootstrap/themed/templates/new.html.haml +3 -0
- data/lib/generators/bootstrap/themed/templates/new.html.slim +3 -0
- data/lib/generators/bootstrap/themed/templates/show.html.erb +21 -0
- data/lib/generators/bootstrap/themed/templates/show.html.haml +14 -0
- data/lib/generators/bootstrap/themed/templates/show.html.slim +16 -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-rails.rb +10 -0
- data/lib/twitter/bootstrap/rails/bootstrap.rb +2 -0
- data/lib/twitter/bootstrap/rails/engine.rb +24 -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 +175 -0
- data/vendor/assets/fonts/fontawesome-webfont.svgz +0 -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 +12 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-alert.js +94 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-button.js +100 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-carousel.js +161 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-collapse.js +138 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-dropdown.js +92 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-modal.js +210 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-popover.js +95 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-scrollspy.js +125 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-tab.js +130 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-tooltip.js +270 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-transition.js +51 -0
- data/vendor/assets/javascripts/twitter/bootstrap/bootstrap-typeahead.js +324 -0
- data/vendor/toolkit/fontawesome.less +267 -0
- data/vendor/toolkit/twitter/bootstrap/accordion.less +28 -0
- data/vendor/toolkit/twitter/bootstrap/alerts.less +58 -0
- data/vendor/toolkit/twitter/bootstrap/badges.less +36 -0
- data/vendor/toolkit/twitter/bootstrap/bootstrap.less +63 -0
- data/vendor/toolkit/twitter/bootstrap/breadcrumbs.less +24 -0
- data/vendor/toolkit/twitter/bootstrap/button-groups.less +172 -0
- data/vendor/toolkit/twitter/bootstrap/buttons.less +187 -0
- data/vendor/toolkit/twitter/bootstrap/carousel.less +121 -0
- data/vendor/toolkit/twitter/bootstrap/close.less +18 -0
- data/vendor/toolkit/twitter/bootstrap/code.less +57 -0
- data/vendor/toolkit/twitter/bootstrap/component-animations.less +20 -0
- data/vendor/toolkit/twitter/bootstrap/dropdowns.less +148 -0
- data/vendor/toolkit/twitter/bootstrap/forms.less +555 -0
- data/vendor/toolkit/twitter/bootstrap/grid.less +5 -0
- data/vendor/toolkit/twitter/bootstrap/hero-unit.less +22 -0
- data/vendor/toolkit/twitter/bootstrap/labels.less +38 -0
- data/vendor/toolkit/twitter/bootstrap/layouts.less +17 -0
- data/vendor/toolkit/twitter/bootstrap/mixins.less +614 -0
- data/vendor/toolkit/twitter/bootstrap/modals.less +90 -0
- data/vendor/toolkit/twitter/bootstrap/navbar.less +341 -0
- data/vendor/toolkit/twitter/bootstrap/navs.less +363 -0
- data/vendor/toolkit/twitter/bootstrap/pager.less +36 -0
- data/vendor/toolkit/twitter/bootstrap/pagination.less +56 -0
- data/vendor/toolkit/twitter/bootstrap/popovers.less +49 -0
- data/vendor/toolkit/twitter/bootstrap/progress-bars.less +109 -0
- data/vendor/toolkit/twitter/bootstrap/reset.less +126 -0
- data/vendor/toolkit/twitter/bootstrap/responsive.less +371 -0
- data/vendor/toolkit/twitter/bootstrap/scaffolding.less +29 -0
- data/vendor/toolkit/twitter/bootstrap/sprites.less +158 -0
- data/vendor/toolkit/twitter/bootstrap/tables.less +159 -0
- data/vendor/toolkit/twitter/bootstrap/thumbnails.less +35 -0
- data/vendor/toolkit/twitter/bootstrap/tooltip.less +35 -0
- data/vendor/toolkit/twitter/bootstrap/type.less +234 -0
- data/vendor/toolkit/twitter/bootstrap/utilities.less +23 -0
- data/vendor/toolkit/twitter/bootstrap/variables.less +201 -0
- data/vendor/toolkit/twitter/bootstrap/wells.less +27 -0
- data/vendor/toolkit/twitter/bootstrap_base.less +2 -0
- metadata +138 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
!!! 5
|
|
2
|
+
%html(lang="en")
|
|
3
|
+
%head
|
|
4
|
+
%meta(charset="utf-8")
|
|
5
|
+
%meta(name="viewport" content="width=device-width, initial-scale=1.0")
|
|
6
|
+
%title= content_for?(:title) ? yield(:title) : "<%= app_name %>"
|
|
7
|
+
= csrf_meta_tags
|
|
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
|
+
= stylesheet_link_tag "application", :media => "all"
|
|
12
|
+
%link(href="images/favicon.ico" rel="shortcut icon")
|
|
13
|
+
%link(href="images/apple-touch-icon.png" rel="apple-touch-icon")
|
|
14
|
+
%link(href="images/apple-touch-icon-72x72.png" rel="apple-touch-icon" sizes="72x72")
|
|
15
|
+
%link(href="images/apple-touch-icon-114x114.png" rel="apple-touch-icon" sizes="114x114")
|
|
16
|
+
|
|
17
|
+
%body
|
|
18
|
+
.navbar.navbar-fixed-top
|
|
19
|
+
.navbar-inner
|
|
20
|
+
<%- if layout_type == "fluid" -%>
|
|
21
|
+
.container-fluid
|
|
22
|
+
<%- else -%>
|
|
23
|
+
.container
|
|
24
|
+
<%- end -%>
|
|
25
|
+
%a.btn.btn-navbar(data-target=".nav-collapse" data-toggle="collapse")
|
|
26
|
+
%span.icon-bar
|
|
27
|
+
%span.icon-bar
|
|
28
|
+
%span.icon-bar
|
|
29
|
+
%a.brand(href="#") <%= app_name %>
|
|
30
|
+
.container.nav-collapse
|
|
31
|
+
%ul.nav
|
|
32
|
+
%li= link_to "Link 1", "/path1"
|
|
33
|
+
%li= link_to "Link 2", "/path2"
|
|
34
|
+
%li= link_to "Link 3", "/path3"
|
|
35
|
+
|
|
36
|
+
.<%= container_class %>
|
|
37
|
+
<%- if layout_type == "fluid" -%>
|
|
38
|
+
|
|
39
|
+
.row-fluid
|
|
40
|
+
.span3
|
|
41
|
+
.well.sidebar-nav
|
|
42
|
+
%ul.nav.nav-list
|
|
43
|
+
%li.nav-header Sidebar
|
|
44
|
+
%li= link_to "Link 1", "/path1"
|
|
45
|
+
%li= link_to "Link 2", "/path2"
|
|
46
|
+
%li= link_to "Link 3", "/path3"
|
|
47
|
+
.span9
|
|
48
|
+
= yield
|
|
49
|
+
<% else %>
|
|
50
|
+
.content
|
|
51
|
+
.row
|
|
52
|
+
.span9
|
|
53
|
+
= yield
|
|
54
|
+
.span3
|
|
55
|
+
.well.sidebar-nav
|
|
56
|
+
%h3 Sidebar
|
|
57
|
+
%ul.nav.nav-list
|
|
58
|
+
%li.nav-header Sidebar
|
|
59
|
+
%li= link_to "Link 1", "/path1"
|
|
60
|
+
%li= link_to "Link 2", "/path2"
|
|
61
|
+
%li= link_to "Link 3", "/path3"
|
|
62
|
+
<% end %>
|
|
63
|
+
%footer
|
|
64
|
+
%p © Company 2012
|
|
65
|
+
/
|
|
66
|
+
Javascripts
|
|
67
|
+
\==================================================
|
|
68
|
+
/ Placed at the end of the document so the pages load faster
|
|
69
|
+
= javascript_include_tag "application"
|
|
70
|
+
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
doctype html
|
|
2
|
+
html lang="en"
|
|
3
|
+
head
|
|
4
|
+
meta charset="utf-8"
|
|
5
|
+
meta name="viewport" content="width=device-width, initial-scale=1.0"
|
|
6
|
+
title= content_for?(:title) ? yield(:title) : "<%= app_name %>"
|
|
7
|
+
= csrf_meta_tags
|
|
8
|
+
|
|
9
|
+
/! Le HTML5 shim, for IE6-8 support of HTML elements
|
|
10
|
+
/[if lt IE 9]
|
|
11
|
+
= javascript_include_tag "http://html5shim.googlecode.com/svn/trunk/html5.js"
|
|
12
|
+
= stylesheet_link_tag "application", :media => "all"
|
|
13
|
+
link href="images/favicon.ico" rel="shortcut icon"
|
|
14
|
+
link href="images/apple-touch-icon.png" rel="apple-touch-icon"
|
|
15
|
+
link href="images/apple-touch-icon-72x72.png" rel="apple-touch-icon" sizes="72x72"
|
|
16
|
+
link href="images/apple-touch-icon-114x114.png" rel="apple-touch-icon" sizes="114x114"
|
|
17
|
+
|
|
18
|
+
body
|
|
19
|
+
.navbar.navbar-fixed-top
|
|
20
|
+
.navbar-inner
|
|
21
|
+
<%- if layout_type == "fluid" -%>
|
|
22
|
+
.container-fluid
|
|
23
|
+
<%- else -%>
|
|
24
|
+
.container
|
|
25
|
+
<%- end -%>
|
|
26
|
+
a.btn.btn-navbar data-target=".nav-collapse" data-toggle="collapse"
|
|
27
|
+
span.icon-bar
|
|
28
|
+
span.icon-bar
|
|
29
|
+
span.icon-bar
|
|
30
|
+
a.brand href="#"<%= app_name %>
|
|
31
|
+
.<%=container_class%>.nav-collapse
|
|
32
|
+
ul.nav
|
|
33
|
+
li= link_to "Link 1", "/path1"
|
|
34
|
+
li= link_to "Link 2", "/path2"
|
|
35
|
+
li= link_to "Link 3", "/path3"
|
|
36
|
+
|
|
37
|
+
.<%= container_class %>
|
|
38
|
+
<%- if layout_type == "fluid" -%>
|
|
39
|
+
|
|
40
|
+
.row-fluid
|
|
41
|
+
.span3
|
|
42
|
+
.well.sidebar-nav
|
|
43
|
+
ul.nav.nav-list
|
|
44
|
+
li.nav-header Sidebar
|
|
45
|
+
li= link_to "Link 1", "/path1"
|
|
46
|
+
li= link_to "Link 2", "/path2"
|
|
47
|
+
li= link_to "Link 3", "/path3"
|
|
48
|
+
.span9
|
|
49
|
+
= yield
|
|
50
|
+
<% else %>
|
|
51
|
+
.content
|
|
52
|
+
.row
|
|
53
|
+
.span9
|
|
54
|
+
= yield
|
|
55
|
+
.span3
|
|
56
|
+
.well.sidebar-nav
|
|
57
|
+
h3 Sidebar
|
|
58
|
+
ul.nav.nav-list
|
|
59
|
+
li.nav-header Sidebar
|
|
60
|
+
li= link_to "Link 1", "/path1"
|
|
61
|
+
li= link_to "Link 2", "/path2"
|
|
62
|
+
li= link_to "Link 3", "/path3"
|
|
63
|
+
<% end %>
|
|
64
|
+
footer
|
|
65
|
+
p © Company 2012
|
|
66
|
+
/!
|
|
67
|
+
Javascripts
|
|
68
|
+
\==================================================
|
|
69
|
+
/! Placed at the end of the document so the pages load faster
|
|
70
|
+
= javascript_include_tag "application"
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<%%= form_for @<%= resource_name %>, :html => { :class => 'form-horizontal' } do |f| %>
|
|
2
|
+
<%- columns.each do |column| -%>
|
|
3
|
+
<div class="control-group">
|
|
4
|
+
<%%= f.label :<%= column.name %>, :class => 'control-label' %>
|
|
5
|
+
<div class="controls">
|
|
6
|
+
<%%= f.<%= column.field_type %> :<%= column.name %>, :class => '<%= column.field_type %>' %>
|
|
7
|
+
</div>
|
|
8
|
+
</div>
|
|
9
|
+
<%- end -%>
|
|
10
|
+
|
|
11
|
+
<div class="form-actions">
|
|
12
|
+
<%%= f.submit nil, :class => 'btn btn-primary' %>
|
|
13
|
+
<%%= link_to t('.cancel', :default => t("helpers.links.cancel")),
|
|
14
|
+
<%= controller_routing_path %>_path, :class => 'btn' %>
|
|
15
|
+
</div>
|
|
16
|
+
<%% end %>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
= form_for @<%= resource_name %>, :html => { :class => 'form-horizontal' } do |f|
|
|
2
|
+
<%- columns.each do |column| -%>
|
|
3
|
+
.control-group
|
|
4
|
+
= f.label :<%= column.name %>, :class => 'control-label'
|
|
5
|
+
.controls
|
|
6
|
+
= f.<%= column.field_type %> :<%= column.name %>, :class => '<%= column.field_type %>'
|
|
7
|
+
<%- end -%>
|
|
8
|
+
.form-actions
|
|
9
|
+
= f.submit nil, :class => 'btn btn-primary'
|
|
10
|
+
= link_to t('.cancel', :default => t("helpers.links.cancel")), <%= controller_routing_path %>_path, :class => 'btn'
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
= form_for @<%= resource_name %>, :html => { :class => "form-horizontal" } do |f|
|
|
2
|
+
<%- columns.each do |column| -%>
|
|
3
|
+
.control-group
|
|
4
|
+
= f.label :<%= column.name %>, :class => 'control-label'
|
|
5
|
+
.controls
|
|
6
|
+
= f.<%= column.field_type %> :<%= column.name %>, :class => '<%= column.field_type %>'
|
|
7
|
+
<%- end -%>
|
|
8
|
+
.form-actions
|
|
9
|
+
= f.submit nil, :class => 'btn btn-primary'
|
|
10
|
+
'
|
|
11
|
+
= link_to t('.cancel', :default => t("helpers.links.cancel")), <%= controller_routing_path %>_path, :class => 'btn'
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<%%- model_class = <%= resource_name.classify %>.new.class -%>
|
|
2
|
+
<h1><%%=t '.title', :default => model_class.model_name.human.pluralize %></h1>
|
|
3
|
+
<table class="table table-striped">
|
|
4
|
+
<thead>
|
|
5
|
+
<tr>
|
|
6
|
+
<th><%%= model_class.human_attribute_name(:id) %></th>
|
|
7
|
+
<%- columns.each do |column| -%>
|
|
8
|
+
<th><%%= model_class.human_attribute_name(:<%= column.name %>) %></th>
|
|
9
|
+
<%- end -%>
|
|
10
|
+
<th><%%= model_class.human_attribute_name(:created_at) %></th>
|
|
11
|
+
<th><%%=t '.actions', :default => t("helpers.actions") %></th>
|
|
12
|
+
</tr>
|
|
13
|
+
</thead>
|
|
14
|
+
<tbody>
|
|
15
|
+
<%% @<%= plural_resource_name %>.each do |<%= resource_name %>| %>
|
|
16
|
+
<tr>
|
|
17
|
+
<td><%%= link_to <%= resource_name %>.id, <%= singular_controller_routing_path %>_path(<%= resource_name %>) %></td>
|
|
18
|
+
<%- columns.each do |column| -%>
|
|
19
|
+
<td><%%= <%= resource_name %>.<%= column.name %> %></td>
|
|
20
|
+
<%- end -%>
|
|
21
|
+
<td><%%=l <%= resource_name %>.created_at %></td>
|
|
22
|
+
<td>
|
|
23
|
+
<%%= link_to t('.edit', :default => t("helpers.links.edit")),
|
|
24
|
+
edit_<%= singular_controller_routing_path %>_path(<%= resource_name %>), :class => 'btn btn-mini' %>
|
|
25
|
+
<%%= link_to t('.destroy', :default => t("helpers.links.destroy")),
|
|
26
|
+
<%= singular_controller_routing_path %>_path(<%= resource_name %>),
|
|
27
|
+
:method => :delete,
|
|
28
|
+
:confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')),
|
|
29
|
+
:class => 'btn btn-mini btn-danger' %>
|
|
30
|
+
</td>
|
|
31
|
+
</tr>
|
|
32
|
+
<%% end %>
|
|
33
|
+
</tbody>
|
|
34
|
+
</table>
|
|
35
|
+
|
|
36
|
+
<%%= link_to t('.new', :default => t("helpers.links.new")),
|
|
37
|
+
new_<%= singular_controller_routing_path %>_path,
|
|
38
|
+
:class => 'btn btn-primary' %>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
- model_class = <%= resource_name.classify %>.new.class
|
|
2
|
+
%h1=t '.title', :default => model_class.model_name.human.pluralize
|
|
3
|
+
%table.table.table-striped
|
|
4
|
+
%thead
|
|
5
|
+
%tr
|
|
6
|
+
%th= model_class.human_attribute_name(:id)
|
|
7
|
+
<%- columns.each do |column| -%>
|
|
8
|
+
%th= model_class.human_attribute_name(:<%= column.name %>)
|
|
9
|
+
<%- end -%>
|
|
10
|
+
%th= model_class.human_attribute_name(:created_at)
|
|
11
|
+
%th=t '.actions', :default => t("helpers.actions")
|
|
12
|
+
%tbody
|
|
13
|
+
- @<%= plural_resource_name %>.each do |<%= resource_name %>|
|
|
14
|
+
%tr
|
|
15
|
+
%td= link_to <%= resource_name %>.id, <%= singular_controller_routing_path %>_path(<%= resource_name %>)
|
|
16
|
+
<%- columns.each do |column| -%>
|
|
17
|
+
%td= <%= resource_name %>.<%= column.name %>
|
|
18
|
+
<%- end -%>
|
|
19
|
+
%td=l <%= resource_name %>.created_at
|
|
20
|
+
%td
|
|
21
|
+
= link_to t('.edit', :default => t("helpers.links.edit")), edit_<%= singular_controller_routing_path %>_path(<%= resource_name %>), :class => 'btn btn-mini'
|
|
22
|
+
= link_to t('.destroy', :default => t("helpers.links.destroy")), <%= singular_controller_routing_path %>_path(<%= resource_name %>), :method => :delete, :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')), :class => 'btn btn-mini btn-danger'
|
|
23
|
+
|
|
24
|
+
= link_to t('.new', :default => t("helpers.links.new")), new_<%= singular_controller_routing_path %>_path, :class => 'btn btn-primary'
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
- model_class = <%= resource_name.classify %>.new.class
|
|
2
|
+
h1=t '.title', :default => model_class.model_name.human.pluralize
|
|
3
|
+
table class="table table-striped"
|
|
4
|
+
thead
|
|
5
|
+
tr
|
|
6
|
+
th= model_class.human_attribute_name(:id)
|
|
7
|
+
<%- columns.each do |column| -%>
|
|
8
|
+
th= model_class.human_attribute_name(:<%= column.name %>)
|
|
9
|
+
<%- end -%>
|
|
10
|
+
th= model_class.human_attribute_name(:created_at)
|
|
11
|
+
th=t '.actions', :default => t("helpers.actions")
|
|
12
|
+
tbody
|
|
13
|
+
- @<%= plural_resource_name %>.each do |<%= resource_name %>|
|
|
14
|
+
tr
|
|
15
|
+
td= link_to <%= resource_name %>.id, <%= singular_controller_routing_path %>_path(<%= resource_name %>)
|
|
16
|
+
<%- columns.each do |column| -%>
|
|
17
|
+
td= <%= resource_name %>.<%= column.name %>
|
|
18
|
+
<%- end -%>
|
|
19
|
+
td=l <%= resource_name %>.created_at
|
|
20
|
+
td
|
|
21
|
+
= link_to t('.edit', :default => t("helpers.links.edit")), edit_<%= singular_controller_routing_path %>_path(<%= resource_name %>), :class => 'btn btn-mini'
|
|
22
|
+
'
|
|
23
|
+
= link_to t('.destroy', :default => t("helpers.links.destroy")), <%= singular_controller_routing_path %>_path(<%= resource_name %>), :method => :delete, :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')), :class => 'btn btn-mini btn-danger'
|
|
24
|
+
|
|
25
|
+
= link_to t('.new', :default => t("helpers.links.new")), new_<%= singular_controller_routing_path %>_path, :class => 'btn btn-primary'
|
|
26
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<%%- model_class = @<%= resource_name %>.class -%>
|
|
2
|
+
<h1><%%=t '.title', :default => model_class.model_name.human %></h1>
|
|
3
|
+
|
|
4
|
+
<%- columns.each do |column| -%>
|
|
5
|
+
<p>
|
|
6
|
+
<strong><%%= model_class.human_attribute_name(:<%= column.name %>) %>:</strong><br>
|
|
7
|
+
<%%= @<%= resource_name %>.<%= column.name %> %>
|
|
8
|
+
</p>
|
|
9
|
+
<%- end -%>
|
|
10
|
+
|
|
11
|
+
<div class="form-actions">
|
|
12
|
+
<%%= link_to t('.back', :default => t("helpers.links.back")),
|
|
13
|
+
<%= controller_routing_path %>_path, :class => 'btn' %>
|
|
14
|
+
<%%= link_to t('.edit', :default => t("helpers.links.edit")),
|
|
15
|
+
edit_<%= singular_controller_routing_path %>_path(@<%= resource_name %>), :class => 'btn' %>
|
|
16
|
+
<%%= link_to t('.destroy', :default => t("helpers.links.destroy")),
|
|
17
|
+
<%= singular_controller_routing_path %>_path(@<%= resource_name %>),
|
|
18
|
+
:method => 'delete',
|
|
19
|
+
:confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')),
|
|
20
|
+
:class => 'btn btn-danger' %>
|
|
21
|
+
</div>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
- model_class = @<%= resource_name %>.class
|
|
2
|
+
%h1=t '.title', :default => model_class.model_name.human
|
|
3
|
+
|
|
4
|
+
<%- columns.each do |column| -%>
|
|
5
|
+
%p
|
|
6
|
+
%strong= model_class.human_attribute_name(:<%= column.name %>) + ':'
|
|
7
|
+
%br
|
|
8
|
+
= @<%= resource_name %>.<%= column.name %>
|
|
9
|
+
<%- end -%>
|
|
10
|
+
|
|
11
|
+
.form-actions
|
|
12
|
+
= link_to t('.back', :default => t("helpers.links.back")), <%= controller_routing_path %>_path, :class => 'btn'
|
|
13
|
+
= link_to t('.edit', :default => t("helpers.links.edit")), edit_<%= singular_controller_routing_path %>_path(@<%= resource_name %>), :class => 'btn'
|
|
14
|
+
= link_to t('.destroy', :default => t("helpers.links.destroy")), <%= singular_controller_routing_path %>_path(@<%= resource_name %>), :method => "delete", :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')), :class => 'btn btn-danger'
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
- model_class = @<%= resource_name %>.class
|
|
2
|
+
h1=t '.title', :default => model_class.model_name.human
|
|
3
|
+
|
|
4
|
+
<%- columns.each do |column| -%>
|
|
5
|
+
p
|
|
6
|
+
strong= model_class.human_attribute_name(:<%= column.name %>) + ':'
|
|
7
|
+
br
|
|
8
|
+
= @<%= resource_name %>.<%= column.name %>
|
|
9
|
+
<%- end -%>
|
|
10
|
+
|
|
11
|
+
.form-actions
|
|
12
|
+
= link_to t('.back', :default => t("helpers.links.back")), <%= controller_routing_path %>_path, :class => 'btn'
|
|
13
|
+
'
|
|
14
|
+
= link_to t('.edit', :default => t("helpers.links.edit")), edit_<%= singular_controller_routing_path %>_path(@<%= resource_name %>), :class => 'btn'
|
|
15
|
+
'
|
|
16
|
+
= link_to t('.destroy', :default => t("helpers.links.destroy")), <%= singular_controller_routing_path %>_path(@<%= resource_name %>), :method => "delete", :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')), :class => 'btn btn-danger'
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<%%= simple_form_for @<%= resource_name %>, :html => { :class => 'form-horizontal' } do |f| %>
|
|
2
|
+
<%- columns.each do |column| -%>
|
|
3
|
+
<%%= f.input :<%= column.name %> %>
|
|
4
|
+
<%- end -%>
|
|
5
|
+
<%- if ::SimpleForm::FormBuilder.instance_methods.include?(:wrapped_button) -%>
|
|
6
|
+
<%%= f.button :wrapped, :cancel => <%= controller_routing_path %>_path %>
|
|
7
|
+
<%- else -%>
|
|
8
|
+
<div class="form-actions">
|
|
9
|
+
<%%= f.button :submit, :class => 'btn-primary' %>
|
|
10
|
+
<%%= link_to t('.cancel', :default => t("helpers.links.cancel")),
|
|
11
|
+
<%= controller_routing_path %>_path, :class => 'btn' %>
|
|
12
|
+
</div>
|
|
13
|
+
<%- end -%>
|
|
14
|
+
<%% end %>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
= simple_form_for @<%= resource_name %>, :html => { :class => 'form-horizontal' } do |f|
|
|
2
|
+
<%- columns.each do |column| -%>
|
|
3
|
+
= f.input :<%= column.name %>
|
|
4
|
+
<%- end -%>
|
|
5
|
+
<%- if ::SimpleForm::FormBuilder.instance_methods.include?(:wrapped_button) -%>
|
|
6
|
+
= f.button :wrapped, :cancel => <%= controller_routing_path %>_path
|
|
7
|
+
<%- else -%>
|
|
8
|
+
.form-actions
|
|
9
|
+
= f.button :submit, :class => 'btn-primary'
|
|
10
|
+
= link_to t('.cancel', :default => t("helpers.links.cancel")), <%= controller_routing_path %>_path, :class => 'btn'
|
|
11
|
+
<%- end -%>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
= simple_form_for @<%= resource_name %>, :html => { :class => "form-horizontal" } do |f|
|
|
2
|
+
<%- columns.each do |column| -%>
|
|
3
|
+
= f.input :<%= column.name %>
|
|
4
|
+
<%- end -%>
|
|
5
|
+
<%- if ::SimpleForm::FormBuilder.instance_methods.include?(:wrapped_button) -%>
|
|
6
|
+
= f.button :wrapped, :cancel => <%= controller_routing_path %>_path
|
|
7
|
+
<%- else -%>
|
|
8
|
+
.form-actions
|
|
9
|
+
= f.button :submit, :class => 'btn-primary'
|
|
10
|
+
'
|
|
11
|
+
= link_to t('.cancel', :default => t("helpers.links.cancel")), <%= controller_routing_path %>_path, :class => 'btn'
|
|
12
|
+
<%- end -%>
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
require 'rails/generators'
|
|
2
|
+
require 'rails/generators/generated_attribute'
|
|
3
|
+
|
|
4
|
+
module Bootstrap
|
|
5
|
+
module Generators
|
|
6
|
+
class ThemedGenerator < ::Rails::Generators::Base
|
|
7
|
+
source_root File.expand_path('../templates', __FILE__)
|
|
8
|
+
argument :controller_path, :type => :string
|
|
9
|
+
argument :model_name, :type => :string, :required => false
|
|
10
|
+
argument :layout, :type => :string, :default => "application",
|
|
11
|
+
:banner => "Specify application layout"
|
|
12
|
+
|
|
13
|
+
def initialize(args, *options)
|
|
14
|
+
super(args, *options)
|
|
15
|
+
initialize_views_variables
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def copy_views
|
|
19
|
+
generate_views
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
protected
|
|
23
|
+
|
|
24
|
+
def initialize_views_variables
|
|
25
|
+
@base_name, @controller_class_path, @controller_file_path, @controller_class_nesting, @controller_class_nesting_depth = extract_modules(controller_path)
|
|
26
|
+
@controller_routing_path = @controller_file_path.gsub(/\//, '_')
|
|
27
|
+
@model_name = @controller_class_nesting + "::#{@base_name.singularize.camelize}" unless @model_name
|
|
28
|
+
@model_name = @model_name.camelize
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def controller_routing_path
|
|
32
|
+
@controller_routing_path
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def singular_controller_routing_path
|
|
36
|
+
@controller_routing_path.singularize
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def model_name
|
|
40
|
+
@model_name
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def plural_model_name
|
|
44
|
+
@model_name.pluralize
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def resource_name
|
|
48
|
+
@model_name.demodulize.underscore
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def plural_resource_name
|
|
52
|
+
resource_name.pluralize
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def columns
|
|
56
|
+
begin
|
|
57
|
+
excluded_column_names = %w[id created_at updated_at]
|
|
58
|
+
@model_name.constantize.columns.reject{|c| excluded_column_names.include?(c.name) }.collect{|c| ::Rails::Generators::GeneratedAttribute.new(c.name, c.type)}
|
|
59
|
+
rescue NoMethodError
|
|
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
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def extract_modules(name)
|
|
65
|
+
modules = name.include?('/') ? name.split('/') : name.split('::')
|
|
66
|
+
name = modules.pop
|
|
67
|
+
path = modules.map { |m| m.underscore }
|
|
68
|
+
file_path = (path + [name.underscore]).join('/')
|
|
69
|
+
nesting = modules.map { |m| m.camelize }.join('::')
|
|
70
|
+
[name, path, file_path, nesting, modules.size]
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def generate_views
|
|
74
|
+
views = {
|
|
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_builder}_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}")}
|
|
80
|
+
selected_views = views
|
|
81
|
+
options.engine == generate_erb(selected_views)
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def generate_erb(views)
|
|
85
|
+
views.each do |template_name, output_path|
|
|
86
|
+
template template_name, output_path
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def ext
|
|
91
|
+
::Rails.application.config.generators.options[:rails][:template_engine] || :erb
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def form_builder
|
|
95
|
+
defined?(::SimpleForm) ? 'simple_form/' : ''
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
end
|