actionscaffold 0.2.2.pre → 0.2.4.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -0
- data/lib/actionscaffold/version.rb +1 -1
- data/lib/generators/scaffold_view/install_generator.rb +11 -5
- data/lib/generators/scaffold_view/templates/bootstrap/_form.html.erb +50 -0
- data/lib/generators/scaffold_view/templates/bootstrap/index.html.erb +37 -0
- data/lib/generators/scaffold_view/templates/bootstrap/show.html.erb +25 -0
- metadata +19 -3
- data/lib/generators/scaffold_view/templates/_form.html.erb +0 -40
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c9f85f9f782365fcfce49af1cb388ba2a2463f1c
|
4
|
+
data.tar.gz: 22f99f07df355e81234a92b16ccf75d0ee9603b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a80579abb3c029a01e8ef3e0a0f4bf91f02370217edfb457c7e0e740b622e9a39755e3aef1deec16c3e4dc0524b2ac854a7a54149ac3fbf15bfd0a68540010f
|
7
|
+
data.tar.gz: a1d6ec5cba94473a433edeb0941c5a3585f8ed02a4edbd09bc583f2e5a4d3ea45d58fdca3d6b6c9dae422c231c8726da749f4c895907a713e8ebc77504afdfa6
|
data/README.md
CHANGED
@@ -80,6 +80,15 @@ Or with custom theme:
|
|
80
80
|
$ rails g scaffold_view:install --ui=bootstrap
|
81
81
|
```
|
82
82
|
|
83
|
+
Import Bootstrap styles in app/assets/stylesheets/application.scss:
|
84
|
+
```scss
|
85
|
+
// app/assets/stylesheets/application.scss
|
86
|
+
@import "bootstrap";
|
87
|
+
@import "bootstrap-theme"
|
88
|
+
```
|
89
|
+
|
90
|
+
|
91
|
+
|
83
92
|
Result:
|
84
93
|
```erb
|
85
94
|
<div class="form-group">
|
@@ -97,6 +106,7 @@ Add this line to your application's Gemfile:
|
|
97
106
|
```ruby
|
98
107
|
gem 'responders'
|
99
108
|
gem 'actionscaffold'
|
109
|
+
gem 'bootstrap', '~> 4.0.0.alpha3'
|
100
110
|
```
|
101
111
|
|
102
112
|
And then execute:
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
#
|
2
|
+
# install_generator.rb
|
3
3
|
#
|
4
4
|
# Created by Marko Tunjic on 15/07/16.
|
5
5
|
# Copyright © 2016 Marko Tunjic. All rights reserved.
|
@@ -7,13 +7,19 @@
|
|
7
7
|
module ScaffoldView
|
8
8
|
module Generators
|
9
9
|
class InstallGenerator < Rails::Generators::Base
|
10
|
+
|
11
|
+
# TODO: add opt args
|
12
|
+
ui = "bootstrap"
|
10
13
|
desc "This generator override default scaffold generator for views."
|
11
|
-
source_root File.expand_path("../templates", __FILE__)
|
14
|
+
source_root File.expand_path("../templates/#{ui}", __FILE__)
|
15
|
+
|
12
16
|
def copy_template_file
|
13
|
-
|
14
|
-
"
|
17
|
+
%w(index show _form).each do |template|
|
18
|
+
copy_file "#{template}.html.erb",
|
19
|
+
"lib/templates/erb/scaffold/#{template}.html.erb"
|
20
|
+
end
|
15
21
|
end
|
22
|
+
|
16
23
|
end
|
17
24
|
end
|
18
25
|
end
|
19
|
-
|
@@ -0,0 +1,50 @@
|
|
1
|
+
<%% if @<%= singular_table_name %>.errors.any? %>
|
2
|
+
<aside class="panel panel-danger alert-devise">
|
3
|
+
<header class="panel-heading">
|
4
|
+
<%%= pluralize(@<%= singular_table_name %>.errors.count, "error") %> prohibited this <%= singular_table_name %> from being saved:</header>
|
5
|
+
<section class="panel-body">
|
6
|
+
<ul>
|
7
|
+
<%% @<%= singular_table_name %>.errors.full_messages.each do |msg| %>
|
8
|
+
<li><%%= msg %></li>
|
9
|
+
<%% end %>
|
10
|
+
</ul>
|
11
|
+
</section>
|
12
|
+
</aside>
|
13
|
+
</div>
|
14
|
+
<%% end %>
|
15
|
+
|
16
|
+
<%%= form_for(@<%= singular_table_name %>) do |f| %>
|
17
|
+
<article class="panel panel-default">
|
18
|
+
<header class="panel-heading">
|
19
|
+
<h1><%= singular_table_name.titleize %></h1>
|
20
|
+
</header>
|
21
|
+
<section class="panel-body">
|
22
|
+
<% attributes.each do |attribute| -%>
|
23
|
+
<div class="form-group">
|
24
|
+
<% if attribute.password_digest? -%>
|
25
|
+
<%%= f.label :password %>
|
26
|
+
<%%= f.password_field :password, class: "form-control" %>
|
27
|
+
</div>
|
28
|
+
<div>
|
29
|
+
<%%= f.label :password_confirmation %>
|
30
|
+
<%%= f.password_field :password_confirmation, class: "form-control" %>
|
31
|
+
<% else -%>
|
32
|
+
<%- if attribute.reference? -%>
|
33
|
+
<%%= f.label :<%= attribute.column_name %> %>
|
34
|
+
<%%= f.collection_select :<%= attribute.column_name %>, <%= attribute.name.camelize %>.all, :id, :name, prompt: true %>
|
35
|
+
<%- else -%>
|
36
|
+
<%%= f.label :<%= attribute.name %> %>
|
37
|
+
<%%= f.<%= attribute.field_type %> :<%= attribute.name %>, class: "form-control" %>
|
38
|
+
<%- end -%>
|
39
|
+
<% end -%>
|
40
|
+
</div>
|
41
|
+
<% end -%>
|
42
|
+
</section>
|
43
|
+
<footer class="panel-footer">
|
44
|
+
</footer>
|
45
|
+
</article>
|
46
|
+
|
47
|
+
<div class="form-group actions">
|
48
|
+
<%%= f.submit :Submit, class: "btn btn-primary" %>
|
49
|
+
</div>
|
50
|
+
<%% end %>
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<h1><%= plural_table_name.titleize %></h1>
|
2
|
+
<br />
|
3
|
+
<table class="table table-striped">
|
4
|
+
<thead>
|
5
|
+
<tr>
|
6
|
+
<% attributes.reject(&:password_digest?).each do |attribute| -%>
|
7
|
+
<th><%= attribute.human_name %></th>
|
8
|
+
<% end -%>
|
9
|
+
<th></th>
|
10
|
+
</tr>
|
11
|
+
</thead>
|
12
|
+
<tfoot>
|
13
|
+
<tr>
|
14
|
+
</tr>
|
15
|
+
</tfoot>
|
16
|
+
<tbody>
|
17
|
+
<%% @<%= plural_table_name %>.each do |<%= singular_table_name %>| %>
|
18
|
+
<tr><% attributes.reject(&:password_digest?).each do |attribute| %>
|
19
|
+
<td><% if attribute.reference? -%>
|
20
|
+
<%%= <%= singular_table_name %>.<%= attribute.name %>.name %>
|
21
|
+
<% elsif attribute.type == :boolean %>
|
22
|
+
<%%= check_box_tag "<%= singular_table_name %>",
|
23
|
+
<%= singular_table_name %>.<%= attribute.name %>, <%= singular_table_name %>.<%= attribute.name %> %>
|
24
|
+
<% else %>
|
25
|
+
<%%= <%= singular_table_name %>.<%= attribute.name %> %>
|
26
|
+
<% end %></td>
|
27
|
+
<% end %>
|
28
|
+
<td>
|
29
|
+
<%%= link_to 'Show', <%= singular_table_name %> %> / <%%= link_to 'Edit', edit_<%= singular_table_name %>_path(<%= singular_table_name %>) %> / <%%= link_to 'Delete', <%= singular_table_name %>,
|
30
|
+
method: :delete, data: { confirm: 'Are you sure?' } %>
|
31
|
+
</td>
|
32
|
+
</tr>
|
33
|
+
<%% end %>
|
34
|
+
</tbody>
|
35
|
+
</table>
|
36
|
+
<br>
|
37
|
+
<%%= link_to 'New <%= singular_table_name.titleize %>', new_<%= singular_table_name %>_path %>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<article class="panel panel-default">
|
2
|
+
<header class="panel-heading">
|
3
|
+
<h1><%= singular_table_name.titleize %></h1>
|
4
|
+
</header>
|
5
|
+
<section class="panel-body">
|
6
|
+
<dl class="dl-horizontal">
|
7
|
+
<% attributes.reject(&:password_digest?).each do |attribute| -%>
|
8
|
+
<dt><strong><%= attribute.human_name %>:</strong></dt>
|
9
|
+
<dd>
|
10
|
+
<% if attribute.reference? -%>
|
11
|
+
<%%= @<%= singular_table_name %>.<%= attribute.name %>.name %>
|
12
|
+
<% elsif attribute.type == :boolean %>
|
13
|
+
<%%= check_box_tag "<%= singular_table_name %>", @<%= singular_table_name %>.<%= attribute.name %>, @<%= singular_table_name %>.<%= attribute.name %> %>
|
14
|
+
<% else %>
|
15
|
+
<%%= @<%= singular_table_name %>.<%= attribute.name %> %>
|
16
|
+
<% end -%>
|
17
|
+
</dd>
|
18
|
+
<% end %>
|
19
|
+
</dl>
|
20
|
+
</section>
|
21
|
+
<footer class="panel-footer">
|
22
|
+
</footer>
|
23
|
+
</article>
|
24
|
+
<%%= link_to 'Edit', edit_<%= singular_table_name %>_path(@<%= singular_table_name %>) %> |
|
25
|
+
<%%= link_to 'Back', <%= index_helper %>_path %>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: actionscaffold
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marko Tunjic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 2.2.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bootstrap
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 4.0.0.alpha3
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 4.0.0.alpha3
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: sqlite3
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -67,7 +81,9 @@ files:
|
|
67
81
|
- lib/generators/scaffold_controller/install_generator.rb
|
68
82
|
- lib/generators/scaffold_controller/templates/controller.rb
|
69
83
|
- lib/generators/scaffold_view/install_generator.rb
|
70
|
-
- lib/generators/scaffold_view/templates/_form.html.erb
|
84
|
+
- lib/generators/scaffold_view/templates/bootstrap/_form.html.erb
|
85
|
+
- lib/generators/scaffold_view/templates/bootstrap/index.html.erb
|
86
|
+
- lib/generators/scaffold_view/templates/bootstrap/show.html.erb
|
71
87
|
- lib/tasks/scaffolder_tasks.rake
|
72
88
|
homepage: https://github.com/mtunjic/actionscaffold
|
73
89
|
licenses:
|
@@ -1,40 +0,0 @@
|
|
1
|
-
<%%= form_for(@<%= singular_table_name %>) do |f| %>
|
2
|
-
<%% if @<%= singular_table_name %>.errors.any? %>
|
3
|
-
|
4
|
-
<aside class="panel panel-danger alert-devise">
|
5
|
-
<header class="panel-heading"><%%= pluralize(@<%= singular_table_name %>.errors.count, "error") %> prohibited this <%= singular_table_name %> from being saved:</header>
|
6
|
-
<section class="panel-body">
|
7
|
-
<ul>
|
8
|
-
<%% @<%= singular_table_name %>.errors.full_messages.each do |msg| %>
|
9
|
-
<li><%%= msg %></li>
|
10
|
-
<%% end %>
|
11
|
-
</ul>
|
12
|
-
</section>
|
13
|
-
</aside>
|
14
|
-
</div>
|
15
|
-
<%% end %>
|
16
|
-
|
17
|
-
<% attributes.each do |attribute| -%>
|
18
|
-
<div class="form-group">
|
19
|
-
<% if attribute.password_digest? -%>
|
20
|
-
<%%= f.label :password %>
|
21
|
-
<%%= f.password_field :password, class: "form-control" %>
|
22
|
-
</div>
|
23
|
-
<div>
|
24
|
-
<%%= f.label :password_confirmation %>
|
25
|
-
<%%= f.password_field :password_confirmation, class: "form-control" %>
|
26
|
-
<% else -%>
|
27
|
-
<%- if attribute.reference? -%>
|
28
|
-
<%%= f.label :<%= attribute.column_name %> %>
|
29
|
-
<%%= f.collection_select :<%= attribute.column_name %>, <%= attribute.name.camelize %>.all, :id, :name, prompt: true %>
|
30
|
-
<%- else -%>
|
31
|
-
<%%= f.label :<%= attribute.name %> %>
|
32
|
-
<%%= f.<%= attribute.field_type %> :<%= attribute.name %>, class: "form-control" %>
|
33
|
-
<%- end -%>
|
34
|
-
<% end -%>
|
35
|
-
</div>
|
36
|
-
<% end -%>
|
37
|
-
<div class="form-group actions">
|
38
|
-
<%%= f.submit :Submit, class: "btn btn-primary" %>
|
39
|
-
</div>
|
40
|
-
<%% end %>
|