actionscaffold 0.2.6.pre → 0.3.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.
- checksums.yaml +4 -4
- data/README.md +9 -5
- data/lib/actionscaffold/version.rb +1 -1
- data/lib/generators/layout/layout_generator.rb +28 -0
- data/lib/generators/layout/templates/application.scss +2 -0
- data/lib/generators/layout/templates/layout.html.erb +23 -0
- data/lib/generators/scaffold_view/install_generator.rb +7 -5
- data/lib/generators/scaffold_view/templates/bootstrap/_form.html.erb +22 -24
- data/lib/generators/scaffold_view/templates/bootstrap/edit.html.erb +12 -0
- data/lib/generators/scaffold_view/templates/bootstrap/new.html.erb +11 -0
- data/lib/generators/scaffold_view/templates/bootstrap/show.html.erb +2 -3
- metadata +14 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ad2e6a7a0e5c7682c3138d15485b8b88ff9992c
|
4
|
+
data.tar.gz: 5da8aa0147c24049481fbf5ce1c5e78625d636d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ad4dca3594387fcfc54acbc74e444357c32b53739d6e739741c29ce002886538787553284733281a7f5cea6960e614a19ddd3fcd7efe7e281280e8af3df203d
|
7
|
+
data.tar.gz: 9a43c8024d9f0378c6a7d0b019b4a79986f90616bd13f6517e03a91836c226bba039e7b07a1f945a3945d6ac80ff8fc1263553caaf1380c485851cfd79c4d8c3
|
data/README.md
CHANGED
@@ -4,6 +4,7 @@
|
|
4
4
|
* View support for bootstrap 4, uikit, skeleton and html5boilerplate.
|
5
5
|
* Select box for a belongs_to relationship.
|
6
6
|
* Nested resources
|
7
|
+
* HTML5 controls
|
7
8
|
|
8
9
|
|
9
10
|
## Usage
|
@@ -80,15 +81,18 @@ Or with custom theme:
|
|
80
81
|
$ rails g scaffold_view:install --ui=bootstrap
|
81
82
|
```
|
82
83
|
|
83
|
-
|
84
|
+
Generate application layout with or without css files
|
85
|
+
```bash
|
86
|
+
$ rails g layout bootstrap [--skip-stylesheet] # [skeleton, html5boilerplate]
|
87
|
+
```
|
88
|
+
|
89
|
+
... or manualy import Bootstrap styles in app/assets/stylesheets/application.scss:
|
84
90
|
```scss
|
85
91
|
// app/assets/stylesheets/application.scss
|
86
92
|
@import "bootstrap";
|
87
93
|
@import "bootstrap-theme"
|
88
94
|
```
|
89
95
|
|
90
|
-
|
91
|
-
|
92
96
|
Result:
|
93
97
|
```erb
|
94
98
|
<div class="form-group">
|
@@ -105,9 +109,8 @@ Result:
|
|
105
109
|
Add this line to your application's Gemfile:
|
106
110
|
|
107
111
|
```ruby
|
108
|
-
gem 'responders'
|
112
|
+
gem 'responders' # (optional) Add this if you want to use scaffold_controller
|
109
113
|
gem 'actionscaffold'
|
110
|
-
gem 'bootstrap', '~> 4.0.0.alpha3'
|
111
114
|
```
|
112
115
|
|
113
116
|
And then execute:
|
@@ -125,6 +128,7 @@ $ gem install actionscaffold
|
|
125
128
|
- [ ] [uikit](http://getuikit.com)
|
126
129
|
- [ ] [skeleton](http://getskeleton.com)
|
127
130
|
- [ ] [html5boilerplate](https://html5boilerplate.com)
|
131
|
+
- [ ] HTML5 controls
|
128
132
|
|
129
133
|
## Contributing
|
130
134
|
Bug reports and pull requests are welcome on GitHub at https://github.com/mtunjic/actionscaffold.
|
@@ -0,0 +1,28 @@
|
|
1
|
+
#
|
2
|
+
# layout_generator.rb
|
3
|
+
#
|
4
|
+
# Created by Marko Tunjic on 15/07/16.
|
5
|
+
# Copyright © 2016 Marko Tunjic. All rights reserved.
|
6
|
+
#
|
7
|
+
module ScaffoldView
|
8
|
+
module Generators
|
9
|
+
class LayoutGenerator < Rails::Generators::Base
|
10
|
+
source_root File.expand_path('../templates', __FILE__)
|
11
|
+
|
12
|
+
argument :ui, :type => :string, :default => "bootstrap"
|
13
|
+
|
14
|
+
class_option :stylesheet, :type => :boolean,
|
15
|
+
:default => true,
|
16
|
+
:description => "Include stylesheets"
|
17
|
+
|
18
|
+
def generate_layout
|
19
|
+
if options.stylesheet?
|
20
|
+
copy_file "application.scss", "public/stylesheets/application.scss"
|
21
|
+
end
|
22
|
+
template "layout.html.erb", "app/views/layouts/application.html.erb"
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title><%%= yield(:title) %></title>
|
5
|
+
<%%= csrf_meta_tags %>
|
6
|
+
<%%= stylesheet_link_tag 'application', media: 'all' %>
|
7
|
+
<meta charset="utf-8">
|
8
|
+
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
9
|
+
<link rel="apple-touch-icon" href="apple-touch-icon.png">
|
10
|
+
<meta name="description" content="">
|
11
|
+
<meta name="author" content="">
|
12
|
+
<meta http-equiv="content-type" content="text/html;charset=UTF-8">
|
13
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
14
|
+
</head>
|
15
|
+
<body>
|
16
|
+
<div class="container" >
|
17
|
+
<%% flash.each do |name, msg| %>
|
18
|
+
<%%= content_tag :div, msg, :id => "flash_#{name}" %>
|
19
|
+
<%% end %>
|
20
|
+
<%%= yield %>
|
21
|
+
</div>
|
22
|
+
</body>
|
23
|
+
</html>
|
@@ -8,14 +8,16 @@ module ScaffoldView
|
|
8
8
|
module Generators
|
9
9
|
class InstallGenerator < Rails::Generators::Base
|
10
10
|
|
11
|
-
|
12
|
-
|
11
|
+
source_root File.expand_path("../templates", __FILE__)
|
12
|
+
|
13
13
|
desc "This generator override default scaffold generator for views."
|
14
|
-
|
14
|
+
argument :ui, :type => :string,
|
15
|
+
:default => "bootstrap",
|
16
|
+
:description => "Include stylesheets"
|
15
17
|
|
16
18
|
def copy_template_file
|
17
|
-
%w(index show _form).each do |template|
|
18
|
-
copy_file "#{template}.html.erb",
|
19
|
+
%w(index show _form new edit).each do |template|
|
20
|
+
copy_file "#{ui}/#{template}.html.erb",
|
19
21
|
"lib/templates/erb/scaffold/#{template}.html.erb"
|
20
22
|
end
|
21
23
|
end
|
@@ -1,23 +1,19 @@
|
|
1
|
+
<%%= form_for(@<%= singular_table_name %>) do |f| %>
|
1
2
|
<%% if @<%= singular_table_name %>.errors.any? %>
|
2
|
-
<
|
3
|
-
<
|
4
|
-
|
5
|
-
|
3
|
+
<div class="panel panel-danger">
|
4
|
+
<div class="panel-heading">
|
5
|
+
<h3 class="panel-title">
|
6
|
+
<%%= pluralize(@<%= singular_table_name %>.errors.count, "error") %> prohibited this <%= singular_table_name %> from being saved:</h3>
|
7
|
+
</div>
|
8
|
+
<div class="panel-body">
|
6
9
|
<ul>
|
7
10
|
<%% @<%= singular_table_name %>.errors.full_messages.each do |msg| %>
|
8
|
-
|
11
|
+
<li><%%= msg %></li>
|
9
12
|
<%% end %>
|
10
13
|
</ul>
|
11
|
-
</
|
12
|
-
</aside>
|
14
|
+
</div>
|
13
15
|
</div>
|
14
|
-
<%% end %>
|
15
|
-
<%%= form_for(@<%= singular_table_name %>) do |f| %>
|
16
|
-
<article class="panel panel-default">
|
17
|
-
<header class="panel-heading">
|
18
|
-
<h1><%= singular_table_name.titleize %></h1>
|
19
|
-
</header>
|
20
|
-
<section class="panel-body">
|
16
|
+
<%% end %>
|
21
17
|
<%- attributes.each do |attribute| -%>
|
22
18
|
<div class="form-group">
|
23
19
|
<%- if attribute.password_digest? -%>
|
@@ -30,20 +26,22 @@
|
|
30
26
|
<%- else -%>
|
31
27
|
<%- if attribute.reference? -%>
|
32
28
|
<%%= f.label :<%= attribute.column_name %> %>
|
33
|
-
<%%= f.collection_select :<%= attribute.column_name %>, <%= attribute.name.camelize %>.all, :id, :name, prompt: true %>
|
34
|
-
<%-
|
29
|
+
<%%= f.collection_select :<%= attribute.column_name %>, <%= attribute.name.camelize %>.all, :id, :name, {prompt: true}, { class: "form-control"} %>
|
30
|
+
<%- elsif attribute.type == :boolean -%>
|
31
|
+
<div class="checkbox">
|
32
|
+
<label class="checkbox-inline">
|
33
|
+
<%%= check_box_tag "<%= singular_table_name %>", @<%= singular_table_name %>.<%= attribute.name %>, @<%= singular_table_name %>.<%= attribute.name %> %><%= attribute.name.camelize %>
|
34
|
+
</label>
|
35
|
+
</div>
|
36
|
+
<% else -%>
|
35
37
|
<%%= f.label :<%= attribute.name %> %>
|
36
38
|
<%%= f.<%= attribute.field_type %> :<%= attribute.name %>, class: "form-control" %>
|
37
39
|
<%- end -%>
|
38
40
|
<%- end -%>
|
39
41
|
</div>
|
40
42
|
<%- end -%>
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
<div class="form-group actions">
|
47
|
-
<%%= f.submit :Submit, class: "btn btn-default" %>
|
48
|
-
</div>
|
43
|
+
<hr />
|
44
|
+
<div class="form-group actions">
|
45
|
+
<%%= f.submit class: "btn btn-default" %>
|
46
|
+
</div>
|
49
47
|
<%% end %>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<article class="panel panel-default">
|
2
|
+
<header class="panel-heading">
|
3
|
+
<h3>Editing <%= singular_table_name.titleize %></h3>
|
4
|
+
</header>
|
5
|
+
<section class="panel-body">
|
6
|
+
<%%= render 'form', <%= singular_table_name %>: @<%= singular_table_name %> %>
|
7
|
+
</section>
|
8
|
+
<footer class="panel-footer">
|
9
|
+
</footer>
|
10
|
+
</article>
|
11
|
+
<%%= link_to 'Show', @<%= singular_table_name %>, class: "btn btn-default" %>
|
12
|
+
<%%= link_to 'Back', <%= index_helper %>_path, class: "btn btn-default" %>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<article class="panel panel-default">
|
2
|
+
<header class="panel-heading">
|
3
|
+
<h1>New <%= singular_table_name.titleize %></h1>
|
4
|
+
</header>
|
5
|
+
<section class="panel-body">
|
6
|
+
<%%= render 'form', <%= singular_table_name %>: @<%= singular_table_name %> %>
|
7
|
+
</section>
|
8
|
+
<footer class="panel-footer">
|
9
|
+
</footer>
|
10
|
+
</article>
|
11
|
+
<%%= link_to 'Back', <%= index_helper %>_path %>
|
@@ -11,8 +11,7 @@
|
|
11
11
|
</dl>
|
12
12
|
</section>
|
13
13
|
<footer class="panel-footer">
|
14
|
-
<%%= link_to 'Edit', edit_<%= singular_table_name %>_path(@<%= singular_table_name %>) %> |
|
15
|
-
<%%= link_to 'Back', <%= index_helper %>_path %>
|
16
14
|
</footer>
|
17
15
|
</article>
|
18
|
-
|
16
|
+
<%%= link_to 'Edit', edit_<%= singular_table_name %>_path(@<%= singular_table_name %>), class: "btn btn-default" %>
|
17
|
+
<%%= link_to 'Back', <%= index_helper %>_path, class: "btn btn-default" %>
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: actionscaffold
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.1
|
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-08-
|
11
|
+
date: 2016-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 5.0.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 5.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: responders
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,20 +38,6 @@ 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
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
42
|
name: sqlite3
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -78,11 +64,16 @@ files:
|
|
78
64
|
- Rakefile
|
79
65
|
- lib/actionscaffold.rb
|
80
66
|
- lib/actionscaffold/version.rb
|
67
|
+
- lib/generators/layout/layout_generator.rb
|
68
|
+
- lib/generators/layout/templates/application.scss
|
69
|
+
- lib/generators/layout/templates/layout.html.erb
|
81
70
|
- lib/generators/scaffold_controller/install_generator.rb
|
82
71
|
- lib/generators/scaffold_controller/templates/controller.rb
|
83
72
|
- lib/generators/scaffold_view/install_generator.rb
|
84
73
|
- lib/generators/scaffold_view/templates/bootstrap/_form.html.erb
|
74
|
+
- lib/generators/scaffold_view/templates/bootstrap/edit.html.erb
|
85
75
|
- lib/generators/scaffold_view/templates/bootstrap/index.html.erb
|
76
|
+
- lib/generators/scaffold_view/templates/bootstrap/new.html.erb
|
86
77
|
- lib/generators/scaffold_view/templates/bootstrap/show.html.erb
|
87
78
|
- lib/tasks/scaffolder_tasks.rake
|
88
79
|
homepage: https://github.com/mtunjic/actionscaffold
|
@@ -97,12 +88,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
97
88
|
requirements:
|
98
89
|
- - ">="
|
99
90
|
- !ruby/object:Gem::Version
|
100
|
-
version:
|
91
|
+
version: 2.2.2
|
101
92
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
93
|
requirements:
|
103
|
-
- - "
|
94
|
+
- - ">="
|
104
95
|
- !ruby/object:Gem::Version
|
105
|
-
version:
|
96
|
+
version: '0'
|
106
97
|
requirements: []
|
107
98
|
rubyforge_project:
|
108
99
|
rubygems_version: 2.6.4
|