scaffold_pico 1.1.9 → 2.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7b83357d5757856a21122433ef1945d4b40ea82a717fd6ca5ea0dd14e88e4c55
4
- data.tar.gz: 653e00810c7cd025e76277f5980480083586be79ab4701f727e07c0733a91b82
3
+ metadata.gz: f40c45aedc54a1d8b3d4ff82328f5d761178d50c7cd4831dad57c998aab869a0
4
+ data.tar.gz: 3fe140a777902bc7e23ef277d27feb841303c0c9ebf817879c45dfbc93c969b7
5
5
  SHA512:
6
- metadata.gz: bd29117c532bc944d17b2eb5d69edc94a754c257e2ecc14931fe557088a66654bfe104ab8db4357f083bce8ddebdd23983c6d79a39a911a8883d32436e5006e4
7
- data.tar.gz: 13a906dfcb09af826dd01b2fe4ad8b9dc7477c739b023e1b59c17af435a5b45daaed14642901c0e9b0cac8ed035062d430f2d66b7a1d476607a58dac476057bb
6
+ metadata.gz: 9d92d5cd66c69f825c406de7d252436238e212362c3d001a507dc204ce15848b8f7ac71686a59d057f501963d933207baf9ee52822f7120390b94c89a9f93d83
7
+ data.tar.gz: b3780c528fabe7d0fc73104bb9c084a5004332b37cce3578f75023b6dd178ccbfc7aa01a8da6235b7fefdec11b93691b384f7f3ac11a52bbdfc5aa6ff64366a9
data/README.md CHANGED
@@ -1,15 +1,21 @@
1
1
  # Scaffolding done right
2
- No learning curve - replace Ruby on Rails scaffold, no DSLs or 3rd party gems.
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 - zurb / materializecss
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
- The gem assume you have already in your Gemfile
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 incase not all of Scaffold Pico’s dependencies are signed, so we cannot use HighSecurity.
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
- ## Copyright
116
+ ## License MIT
108
117
 
109
118
  Copyright (c) 2017 gudata. See LICENSE.txt for further details.
110
119
 
@@ -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 materialize'
106
- default 'materialize'
107
- validate /\A(zurb|materialize)\z/
108
- desc 'zurb or materialize'
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)
@@ -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
- Scaffold::Generators::ModelsGenerator.new(@rails).generate
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
@@ -33,3 +33,7 @@ bg:
33
33
  new: Нов %{model}
34
34
  edit: Редакция %{model}
35
35
  create: "Създай %{model}"
36
+ time:
37
+ formats:
38
+ very_short: "%F %H:%M"
39
+ very_short_with_seconds: "%F %T"
@@ -33,3 +33,7 @@ en:
33
33
  new: New %{model}
34
34
  edit: Edit %{model}
35
35
  create: "Create %{model}"
36
+ time:
37
+ formats:
38
+ very_short: "%F %H:%M"
39
+ very_short_with_seconds: "%F %T"
@@ -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) }.keys.each do |field_name| %>
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
- = form.input :<%= field_name -%>_id
49
+ = form.input :<%= field_name -%>_id
46
50
  <% elsif ['date', 'datetime'].include?(field_type) -%>
47
- = form.input :<%= field_name -%>, as: :date, html5: true
51
+ = form.input :<%= field_name -%>, as: :date, html5: true
48
52
  <% elsif field_type == 'boolean' -%>
49
- = form.input :<%= field_name -%>, as: :boolean, input_html: {class: 'filled-in'}
53
+ = form.input :<%= field_name -%>, as: :boolean, input_html: {class: 'filled-in'}
50
54
  <% else %>
51
- = form.input :<%= field_name -%>
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: 1.1.9
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - gudata
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-10 00:00:00.000000000 Z
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
- rubyforge_project:
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