scaffold_pico 1.1.8 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +30 -6
- data/lib/scaffold/cli.rb +9 -4
- data/lib/scaffold/main.rb +6 -2
- data/lib/templates/pico/locales/bg.scaffold_pico.yml.erb +4 -0
- data/lib/templates/pico/locales/en.scaffold_pico.yml.erb +4 -0
- data/lib/templates/pico/views/materialize/slim/index.html.slim.erb +9 -5
- data/lib/templates/pico/views/twitter_bootstrap_4x/slim/_form.html.slim.erb +15 -0
- data/lib/templates/pico/views/twitter_bootstrap_4x/slim/edit.html.slim.erb +14 -0
- data/lib/templates/pico/views/twitter_bootstrap_4x/slim/index.html.slim.erb +56 -0
- data/lib/templates/pico/views/twitter_bootstrap_4x/slim/new.html.slim.erb +11 -0
- data/lib/templates/pico/views/twitter_bootstrap_4x/slim/show.html.slim.erb +16 -0
- metadata +8 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 51d27ed6f4eaf2d79803724fb2eec7c47a7ed79b3e8510d646a7957cd807f429
|
4
|
+
data.tar.gz: 5ae4293af62180a821fa4ccbb726ad9a697f0d7a1d2d2abb6ca3dc595b549ecc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5fcaa0c06bcc728d62d53a8700168d35b602e1f108c02ca5b5b41fc5bf2c0ff928c1f8ae422b3e76c268888d05ede3b7d0db3fc25064f01f03c4436d4db9fbb
|
7
|
+
data.tar.gz: f111655ade0c1a363cb5b4cc3c3b866bb22f7710b731adcae403f5961fd4d76979c7b64d18d0d6f041f5697167816da5a1bdaf5803f34b0e5b9fad586a5d988d
|
data/README.md
CHANGED
@@ -1,15 +1,21 @@
|
|
1
1
|
# Scaffolding done right
|
2
|
-
|
2
|
+
Soon or later the scaffold from which you start becomes your basic application. I have tried a lot of dynamic administration tooling and soon or later I land on the moment to work and invest time how to make my code work with the admin tool instead of develop my logic.
|
3
|
+
|
4
|
+
I beleave that the appication is born and gets old. Starting with great foundation gives you a boost and then the application become mature without the pain.
|
5
|
+
|
6
|
+
No learning curve - only what you already know - Ruby on Rails & scaffold
|
3
7
|
|
4
8
|
* Support namespaces for the model and the controllers
|
5
9
|
* You can generate scaffolds for nested resources
|
6
10
|
* Can override every file per project
|
7
|
-
* Supports different css frameworks
|
11
|
+
* Supports different css frameworks
|
12
|
+
- twitter-boostrap-4.x
|
13
|
+
- materializecss
|
14
|
+
- zurb
|
8
15
|
* Generate fabricators
|
9
16
|
* Define #index, #edit/new and search during the scafold creation
|
10
17
|
* You can specify includes/joins for the #index action
|
11
|
-
* Implement basic search
|
12
|
-
|
18
|
+
* Implement basic search service
|
13
19
|
|
14
20
|
# SYNOPSIS
|
15
21
|
|
@@ -30,7 +36,10 @@ No learning curve - replace Ruby on Rails scaffold, no DSLs or 3rd party gems.
|
|
30
36
|
|
31
37
|
|
32
38
|
# Install
|
33
|
-
|
39
|
+
|
40
|
+
This project assumes that you use simple_form and kaminari, but if you have other preferences you can change them.
|
41
|
+
|
42
|
+
You should already have in your Gemfile something like
|
34
43
|
|
35
44
|
gem 'kaminari'
|
36
45
|
gem 'slim-rails'
|
@@ -45,6 +54,21 @@ There is no need to have it in your gem file.
|
|
45
54
|
|
46
55
|
gem install scaffold_pico
|
47
56
|
|
57
|
+
Scaffold Pico is cryptographically signed. To be sure the gem you install hasn’t been tampered with:
|
58
|
+
|
59
|
+
Add my public key (if you haven’t already) as a trusted certificate
|
60
|
+
|
61
|
+
gem cert --add <(curl -Ls https://raw.githubusercontent.com/gudata/scaffold_pico/master/certs/gudata.pem)
|
62
|
+
|
63
|
+
gem install scaffold_pico -P MediumSecurity
|
64
|
+
|
65
|
+
The MediumSecurity trust profile will verify signed gems, but allow the installation of unsigned dependencies.
|
66
|
+
|
67
|
+
This is necessary in case not all of Scaffold Pico’s dependencies are signed, so we cannot use HighSecurity.
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
48
72
|
# Overriding
|
49
73
|
If you want to change something you can override/change
|
50
74
|
|
@@ -89,7 +113,7 @@ Help please: For some of the generated models/views there are extra blank links.
|
|
89
113
|
You can't generate scaffolds for a mounted named engines. I don't know if we need this feature.
|
90
114
|
|
91
115
|
|
92
|
-
##
|
116
|
+
## License MIT
|
93
117
|
|
94
118
|
Copyright (c) 2017 gudata. See LICENSE.txt for further details.
|
95
119
|
|
data/lib/scaffold/cli.rb
CHANGED
@@ -54,6 +54,11 @@ module Scaffold
|
|
54
54
|
validate /\A(?:::)?([A-Z]\w*(?:::[A-Z]\w*)*)\z/
|
55
55
|
end
|
56
56
|
|
57
|
+
option :no_model, :required => true do
|
58
|
+
long '--no-model'
|
59
|
+
desc 'Do not generate file. It can help when you need to recreate the views on a model which already exists and have some code'
|
60
|
+
end
|
61
|
+
|
57
62
|
option :includes do
|
58
63
|
long '--includes=*INCLUDES'
|
59
64
|
desc 'add .includes(*includes) into the collection request, we have join also'
|
@@ -102,10 +107,10 @@ module Scaffold
|
|
102
107
|
|
103
108
|
option :css_framework do
|
104
109
|
long '-c'
|
105
|
-
long '--css_framework
|
106
|
-
default '
|
107
|
-
validate /\A(zurb|materialize)\z/
|
108
|
-
desc 'zurb
|
110
|
+
long '--css_framework zurb'
|
111
|
+
default 'twitter_bootstrap_4x'
|
112
|
+
validate /\A(zurb|materialize|twitter_bootstrap_4x)\z/
|
113
|
+
desc 'zurb, materialize, twitter_bootstrap_4x'
|
109
114
|
end
|
110
115
|
|
111
116
|
option :services_folder do
|
data/lib/scaffold/main.rb
CHANGED
@@ -16,11 +16,15 @@ module Scaffold
|
|
16
16
|
def run
|
17
17
|
Scaffold::Generators::FabricatorGenerator.new(@rails).generate if @choice[:fabrication]
|
18
18
|
Scaffold::Generators::ControllerGenerator.new(@rails).generate
|
19
|
-
|
19
|
+
if @choice[:no_model]
|
20
|
+
puts("Skipping generating the model...")
|
21
|
+
else
|
22
|
+
Scaffold::Generators::ModelsGenerator.new(@rails).generate
|
23
|
+
end
|
20
24
|
Scaffold::Generators::ViewsGenerator.new(@rails).generate(@choice[:template], @choice[:css_framework])
|
21
25
|
Scaffold::Generators::RoutesGenerator.new(@rails).generate
|
22
26
|
Scaffold::Generators::LocalesGenerator.new(@rails).generate
|
23
27
|
end
|
24
28
|
|
25
29
|
end
|
26
|
-
end
|
30
|
+
end
|
@@ -23,8 +23,12 @@
|
|
23
23
|
tbody
|
24
24
|
- @<%= @rails.resource.collection_name %>.each do |<%= @rails.resource.name %>|
|
25
25
|
tr
|
26
|
-
<% @rails.resource.fields.select {|k,v| @rails.controller.index_fields.include?(k) }.
|
26
|
+
<% @rails.resource.fields.select {|k,v| @rails.controller.index_fields.include?(k) }.each_pair do |field_name, field_type| %>
|
27
|
+
<% if ['date', 'datetime'].include?(field_type) -%>
|
28
|
+
td.nowrap = l(<%= @rails.resource.name %>.<%= field_name -%>, format: :very_short)
|
29
|
+
<% else -%>
|
27
30
|
td = <%= @rails.resource.name %>.<%= field_name -%>
|
31
|
+
<% end -%>
|
28
32
|
<% end %>
|
29
33
|
td = link_to t('scaffold.index.show'), <%= @rails.path.resource %>
|
30
34
|
td = link_to t('scaffold.index.edit'), <%= @rails.path.edit_resource %>
|
@@ -42,13 +46,13 @@
|
|
42
46
|
|
43
47
|
<% @rails.resource.fields.select {|k,v| @rails.controller.search_fields.include?(k) }.each_pair do |field_name, field_type| %>
|
44
48
|
<% if field_type == 'belongs_to' -%>
|
45
|
-
|
49
|
+
= form.input :<%= field_name -%>_id
|
46
50
|
<% elsif ['date', 'datetime'].include?(field_type) -%>
|
47
|
-
|
51
|
+
= form.input :<%= field_name -%>, as: :date, html5: true
|
48
52
|
<% elsif field_type == 'boolean' -%>
|
49
|
-
|
53
|
+
= form.input :<%= field_name -%>, as: :boolean, input_html: {class: 'filled-in'}
|
50
54
|
<% else %>
|
51
|
-
|
55
|
+
= form.input :<%= field_name -%>
|
52
56
|
<% end -%>
|
53
57
|
<% end %>
|
54
58
|
|
@@ -0,0 +1,15 @@
|
|
1
|
+
= form.error_notification
|
2
|
+
.form-inputs
|
3
|
+
<% @rails.resource.fields.each_pair do |field_name, kind| -%>
|
4
|
+
<% if kind == 'file' -%>
|
5
|
+
= form.input :<%= field_name -%>, as: :file
|
6
|
+
<% elsif kind == 'belongs_to' -%>
|
7
|
+
= form.association :<%= field_name %>
|
8
|
+
<% elsif kind == 'text' -%>
|
9
|
+
= form.input :<%= field_name -%>, as: :text
|
10
|
+
<% elsif ['date', 'datetime'].include?(kind) -%>
|
11
|
+
= form.input :<%= field_name -%>, as: :date, html5: true
|
12
|
+
<% else -%>
|
13
|
+
= form.input :<%= field_name %>
|
14
|
+
<% end -%>
|
15
|
+
<% end -%>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
.d-flex.justify-content-between.flex-wrap.flex-md-nowrap.align-items-center.pb-2.mb-3.border-bottom
|
2
|
+
h1 = t('scaffold.edit.title', model: <%= @rails.resource.class_name_with_modules %>.model_name.human(count: 1).mb_chars.downcase)
|
3
|
+
|
4
|
+
.btn-toolbar.mb-2.mb-md-0
|
5
|
+
.btn-group.mr-2
|
6
|
+
= link_to t('scaffold.actions.new', model: <%= @rails.resource.class_name_with_modules %>.model_name.human(count: 1).mb_chars.downcase), <%= @rails.path.new_resource %>, class: 'btn btn-sm btn-outline-secondary'
|
7
|
+
.btn-group
|
8
|
+
= link_to t('scaffold.show.actions.index', model: <%= @rails.resource.class_name_with_modules %>.model_name.human(count: 2).mb_chars.downcase), <%= @rails.path.collection %>, class: "btn btn-sm btn-outline-secondary"
|
9
|
+
|
10
|
+
|
11
|
+
= simple_form_for <%= @rails.path.instance_resource %> do |form|
|
12
|
+
= render 'form', form: form
|
13
|
+
.form-actions
|
14
|
+
= form.button :button, t('scaffold.actions.update', model: <%= @rails.resource.class_name_with_modules %>.model_name.human(count: 1)), :class => 'btn btn-primary'
|
@@ -0,0 +1,56 @@
|
|
1
|
+
h1 = t('scaffold.index.title', model: <%= @rails.resource.class_name_with_modules %>.model_name.human(count: 2).mb_chars.downcase)
|
2
|
+
|
3
|
+
.row
|
4
|
+
.col-sm-8.col-12
|
5
|
+
table.table.table-bordered.table-striped
|
6
|
+
thead
|
7
|
+
tr
|
8
|
+
<% @rails.resource.fields.select {|k,v| @rails.controller.index_fields.include?(k) }.keys.each do |field_name| %>
|
9
|
+
th = <%= @rails.resource.class_name_with_modules -%>.human_attribute_name(:<%= field_name -%>)
|
10
|
+
<% end %>
|
11
|
+
th colspan=3 = t('scaffold.index.actions')
|
12
|
+
|
13
|
+
tbody
|
14
|
+
- @<%= @rails.resource.collection_name %>.each do |<%= @rails.resource.name %>|
|
15
|
+
tr
|
16
|
+
<% @rails.resource.fields.select {|k,v| @rails.controller.index_fields.include?(k) }.keys.each do |field_name| %>
|
17
|
+
td = <%= @rails.resource.name %>.<%= field_name -%>
|
18
|
+
<% end %>
|
19
|
+
td = link_to t('scaffold.index.show'), <%= @rails.path.resource %>
|
20
|
+
td = link_to t('scaffold.index.edit'), <%= @rails.path.edit_resource %>
|
21
|
+
td = link_to t('scaffold.index.destroy'), <%= @rails.path.resource %>, data: {:confirm => t('scaffold.confirm')}, :method => :delete
|
22
|
+
= paginate @<%= @rails.resource.collection_name %>
|
23
|
+
|
24
|
+
.col-sm-4.col-12
|
25
|
+
.card
|
26
|
+
.card-body
|
27
|
+
aside.actions
|
28
|
+
.btn-toolbar.mb-2.mb-md-0
|
29
|
+
btn-group.mr-2
|
30
|
+
= link_to t('scaffold.actions.new', model: <%= @rails.resource.class_name_with_modules %>.model_name.human.mb_chars.downcase), <%= @rails.path.new_resource %>, class: 'btn btn-outline-primary btn-sm', role: "button"
|
31
|
+
|
32
|
+
.card.mt-2
|
33
|
+
.card-body
|
34
|
+
aside.search
|
35
|
+
h5 = t('scaffold.index.search.header')
|
36
|
+
|
37
|
+
= simple_form_for <%= "@#{@rails.resource.collection_name}_search" %>, as: :<%= @rails.resource.collection_name %>_search, url: <%= @rails.path.collection %>, method: :get do |form|
|
38
|
+
= form.error_notification
|
39
|
+
.form-inputs
|
40
|
+
<% @rails.resource.fields.select {|k,v| @rails.controller.search_fields.include?(k) }.each_pair do |field_name, field_type| %>
|
41
|
+
<% if field_type == 'belongs_to' -%>
|
42
|
+
= form.input :<%= field_name -%>_id
|
43
|
+
<% elsif ['date', 'datetime'].include?(field_type) -%>
|
44
|
+
= form.input :<%= field_name -%>, as: :date, html5: true
|
45
|
+
<% elsif field_type == 'boolean' -%>
|
46
|
+
= form.input :<%= field_name -%>, as: :boolean, input_html: {class: 'filled-in'}
|
47
|
+
<% else %>
|
48
|
+
= form.input :<%= field_name -%>
|
49
|
+
<% end -%>
|
50
|
+
<% end %>
|
51
|
+
|
52
|
+
.form-actions
|
53
|
+
= form.button :submit, t('scaffold.index.search.button'), class: 'btn-primary'
|
54
|
+
<!-- = link_to t('scaffold.index.search.reset'), url_for(<%= @rails.path.collection %>), class: 'btn-outline-secondary' -->
|
55
|
+
= form.button :button, "Cancel", type: "reset", class: "btn-outline-secondary float-right"
|
56
|
+
|
@@ -0,0 +1,11 @@
|
|
1
|
+
.d-flex.justify-content-between.flex-wrap.flex-md-nowrap.align-items-center.pb-2.mb-3.border-bottom
|
2
|
+
h1 = t('scaffold.new.title', model: <%= @rails.resource.class_name_with_modules %>.model_name.human(count: 1).mb_chars.downcase)
|
3
|
+
|
4
|
+
.btn-toolbar.mb-2.mb-md-0
|
5
|
+
.btn-group
|
6
|
+
= link_to t('scaffold.show.actions.index', model: <%= @rails.resource.class_name_with_modules %>.model_name.human(count: 2).mb_chars.downcase), <%= @rails.path.collection %>, class: "btn btn-sm btn-outline-secondary"
|
7
|
+
|
8
|
+
= simple_form_for <%= @rails.path.instance_resource %> do |form|
|
9
|
+
= render 'form', form: form
|
10
|
+
.form-actions
|
11
|
+
= form.button :button, t('scaffold.actions.create', model: <%= @rails.resource.class_name_with_modules %>.model_name.human(count: 1)), :class => 'btn btn-primary'
|
@@ -0,0 +1,16 @@
|
|
1
|
+
h1 = t('scaffold.show.title', model: <%= @rails.resource.class_name_with_modules %>.model_name.human(count: 1).mb_chars.downcase)
|
2
|
+
|
3
|
+
.callout.clearfix
|
4
|
+
.float-left
|
5
|
+
= link_to t('scaffold.show.actions.index', model: <%= @rails.resource.class_name_with_modules %>.model_name.human(count: 2).mb_chars.downcase), <%= @rails.path.collection %>, class: 'button small primary'
|
6
|
+
.float-right
|
7
|
+
= link_to t('scaffold.actions.edit', model: <%= @rails.resource.class_name_with_modules %>.model_name.human(count: 1).mb_chars.downcase), <%= @rails.path.edit_instance_resource %>, class: 'button small warning'
|
8
|
+
= link_to t('scaffold.actions.new', model: <%= @rails.resource.class_name_with_modules %>.model_name.human(count: 1).mb_chars.downcase), <%= @rails.path.new_resource %>, class: 'button small secondary'
|
9
|
+
|
10
|
+
table
|
11
|
+
tbody
|
12
|
+
<% @rails.resource.fields.keys.each do |field_name| %>
|
13
|
+
tr
|
14
|
+
td = <%= @rails.resource.class_name_with_modules -%>.human_attribute_name(:<%= field_name -%>)
|
15
|
+
td = @<%= @rails.resource.name %>.<%= field_name -%>
|
16
|
+
<% end %>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scaffold_pico
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- gudata
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -123,6 +123,11 @@ files:
|
|
123
123
|
- lib/templates/pico/views/materialize/slim/index.html.slim.erb
|
124
124
|
- lib/templates/pico/views/materialize/slim/new.html.slim.erb
|
125
125
|
- lib/templates/pico/views/materialize/slim/show.html.slim.erb
|
126
|
+
- lib/templates/pico/views/twitter_bootstrap_4x/slim/_form.html.slim.erb
|
127
|
+
- lib/templates/pico/views/twitter_bootstrap_4x/slim/edit.html.slim.erb
|
128
|
+
- lib/templates/pico/views/twitter_bootstrap_4x/slim/index.html.slim.erb
|
129
|
+
- lib/templates/pico/views/twitter_bootstrap_4x/slim/new.html.slim.erb
|
130
|
+
- lib/templates/pico/views/twitter_bootstrap_4x/slim/show.html.slim.erb
|
126
131
|
- lib/templates/pico/views/zurb/slim/_form.html.slim.erb
|
127
132
|
- lib/templates/pico/views/zurb/slim/edit.html.slim.erb
|
128
133
|
- lib/templates/pico/views/zurb/slim/index.html.slim.erb
|
@@ -147,8 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
147
152
|
- !ruby/object:Gem::Version
|
148
153
|
version: '0'
|
149
154
|
requirements: []
|
150
|
-
|
151
|
-
rubygems_version: 2.5.2.2
|
155
|
+
rubygems_version: 3.0.3
|
152
156
|
signing_key:
|
153
157
|
specification_version: 4
|
154
158
|
summary: Scaffold should be simple
|