scaffold_pico 1.1.10 → 2.2.2
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 +16 -7
- data/lib/scaffold/cli.rb +9 -6
- 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 +18 -0
- metadata +8 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b46ccfdaeb94290ae485382afddb96a71306367cffa07f9904bc3d34cdcfae1
|
4
|
+
data.tar.gz: 4102b389ee0c84cc7f11cca76b8a76dd94754b25ff08d175af7b1ec20c09dcb2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e1221e9fa6844c96b0c41aa07033a6dd006242408eec6481a15bdf5ed857131717d5dceb30a650a8da95c3741c9ff1f11e49f5c3b5f3290fd6073d64ee96e9b
|
7
|
+
data.tar.gz: 74bd020646b2b5af40204c283e118bf041690ca68d56dddabc7f74463d9b9edbcd1f1344861d86414111a25e36e6e5235eaf23364bb851a93c2b4c0ada39bb58
|
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'
|
@@ -55,7 +64,7 @@ gem install scaffold_pico -P MediumSecurity
|
|
55
64
|
|
56
65
|
The MediumSecurity trust profile will verify signed gems, but allow the installation of unsigned dependencies.
|
57
66
|
|
58
|
-
This is necessary
|
67
|
+
This is necessary in case not all of Scaffold Pico’s dependencies are signed, so we cannot use HighSecurity.
|
59
68
|
|
60
69
|
|
61
70
|
|
@@ -104,7 +113,7 @@ Help please: For some of the generated models/views there are extra blank links.
|
|
104
113
|
You can't generate scaffolds for a mounted named engines. I don't know if we need this feature.
|
105
114
|
|
106
115
|
|
107
|
-
##
|
116
|
+
## License MIT
|
108
117
|
|
109
118
|
Copyright (c) 2017 gudata. See LICENSE.txt for further details.
|
110
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 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
|
@@ -124,11 +129,9 @@ module Scaffold
|
|
124
129
|
end
|
125
130
|
|
126
131
|
end
|
127
|
-
|
128
132
|
end
|
129
133
|
|
130
134
|
def run
|
131
|
-
|
132
135
|
if Choice[:model]
|
133
136
|
add_custom_inflection(Choice.choices[:custom_inflection]) if Choice.choices[:custom_inflection]
|
134
137
|
scaffold = Scaffold::Main.new(Choice.choices)
|
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,18 @@
|
|
1
|
+
.d-flex.justify-content-between.flex-wrap.flex-md-nowrap.align-items-center.pb-2.mb-3.border-bottom
|
2
|
+
h1 = t('scaffold.show.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.edit', model: <%= @rails.resource.class_name_with_modules %>.model_name.human(count: 1).mb_chars.downcase), <%= @rails.path.edit_instance_resource %>, class: 'btn btn-sm btn-outline-secondary'
|
7
|
+
= 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'
|
8
|
+
.btn-group
|
9
|
+
= 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-primary'
|
10
|
+
|
11
|
+
.table-responsive
|
12
|
+
table.table.table-striped
|
13
|
+
tbody
|
14
|
+
<% @rails.resource.fields.keys.each do |field_name| %>
|
15
|
+
tr
|
16
|
+
td = <%= @rails.resource.class_name_with_modules -%>.human_attribute_name(:<%= field_name -%>)
|
17
|
+
td = @<%= @rails.resource.name %>.<%= field_name -%>
|
18
|
+
<% 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.2
|
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-21 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.7.7
|
155
|
+
rubygems_version: 3.0.3
|
152
156
|
signing_key:
|
153
157
|
specification_version: 4
|
154
158
|
summary: Scaffold should be simple
|