scaffold_pico 2.1.12 → 2.2.0

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: 2fb60ad0037d7cf6edaefb5699e19e060ac516a9183adb1f733b349b144e0931
4
- data.tar.gz: 5ee34c31d8af7f46729af481b6a79666be7d621625f5e584245157c288d9efc4
3
+ metadata.gz: 51d27ed6f4eaf2d79803724fb2eec7c47a7ed79b3e8510d646a7957cd807f429
4
+ data.tar.gz: 5ae4293af62180a821fa4ccbb726ad9a697f0d7a1d2d2abb6ca3dc595b549ecc
5
5
  SHA512:
6
- metadata.gz: cf3924dc514fba7477e66f9627db409425cc6a952f8bd27d1434bb09c513a1e9686549cfe49a56f7b697d8aec5b2fe99571d83c21cf788de62ac33895d33c898
7
- data.tar.gz: 2b27d6383a918ad24eb8e9000b2c537b2ba76a8d73742bf2da0d6c7e2fafc67c41aea458b452fe6e713025f167a7e9518c9ed1b8fbf0171a9500760d301612b4
6
+ metadata.gz: f5fcaa0c06bcc728d62d53a8700168d35b602e1f108c02ca5b5b41fc5bf2c0ff928c1f8ae422b3e76c268888d05ede3b7d0db3fc25064f01f03c4436d4db9fbb
7
+ data.tar.gz: f111655ade0c1a363cb5b4cc3c3b866bb22f7710b731adcae403f5961fd4d76979c7b64d18d0d6f041f5697167816da5a1bdaf5803f34b0e5b9fad586a5d988d
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'
@@ -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 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
@@ -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 %>
@@ -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: 2.1.12
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: 2020-05-18 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