base_editing_bootstrap 0.6.0 → 0.7.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3f75c92251f46045d20902120b1796ad0804dbfd632b0ddd77669a6f4f7ab35c
4
- data.tar.gz: 9e87df84d2fc30d8f981095cc3304479c1629b25cf0daa14746a78d83dba5245
3
+ metadata.gz: f49f0f2c12bba569f7cc1d5dae8c7539939b2f98214800c405566fc20a2b8597
4
+ data.tar.gz: 2f5c46bad766c8212f9d8684cb951c8156d6c26a279d411c5cc61e9e117abb54
5
5
  SHA512:
6
- metadata.gz: 3ded9cc6fbff9ae4515f98530596a444f3b18760dc5677b0ae9f5c9b96056287d08500f5a691fb2bcf926709151e79d7af7d4da235dbcd129aa7db4d3d4f520d
7
- data.tar.gz: 6d22f81c4ecf3db3a7413f0fa42ac35b01ffa1e36a570d9cbc412e5daa5a49c9abc3659f63613e7c194cac8b3a417b52de0e5dc2d243799b7faf9dfc5d255213
6
+ metadata.gz: '058cca4f47850ca85f902e591f0c48df33ac520d47a593ef0c1f307fb838c911aa8100330fbe8b0391c7d4f9ef3d1551666c4ad18e760ab0959bdb70f7478997'
7
+ data.tar.gz: 6f05b31efdf2862ff1e7ff5f90ccf9b98645493223f801245e2e7efed0794718c9e57fa79bb851c0edb6cebd13a3c51a0cc595c4ec28ced82eb3bd8fcd082cb8
data/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@
2
2
  All notable changes to this project will be documented in this file. See [conventional commits](https://www.conventionalcommits.org/) for commit guidelines.
3
3
 
4
4
  - - -
5
+ ## 0.7.0 - 2024-05-30
6
+ #### Bug Fixes
7
+ - Generators with enum - (7f25cac) - Marino Bonetti
8
+ #### Features
9
+ - Add Generator for cell field - (ab0210b) - Marino Bonetti
10
+ - Add generator for form field override - (118b998) - Marino Bonetti
11
+ - Add distinguishable classes per field - (2e5e797) - Marino Bonetti
12
+ #### Tests
13
+ - Add Tests to generator - (cd3f40a) - Marino Bonetti
14
+
15
+ - - -
16
+
5
17
  ## 0.6.0 - 2024-05-29
6
18
  #### Bug Fixes
7
19
  - Add dependency in generator - (b911b1a) - Marino Bonetti
@@ -1,5 +1,5 @@
1
- <%= form.label(form_field, class: "form-label") %>
2
- <div class="input-group mb-2 <%= form.object.validated? ? "has-validation" : "" %>">
1
+ <%= form.label(form_field, class: ["form-label","form-#{form_field}-label"]) %>
2
+ <div class="input-group mb-2 <%= form.object.validated? ? "has-validation" : "" %><%= "form-#{form_field}-input-group" %>">
3
3
  <%= render partial: "editing_form_measure_unit", locals: {object: form.object, field: form_field} %>
4
4
  <%= form_print_field(form, form_field) %>
5
5
  <%= error_messages_for(form.object, form_field) %>
@@ -1 +1 @@
1
- 0.6.0
1
+ 0.7.0
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BaseEditingBootstrap
4
+ module Generators
5
+ class CellOverrideGenerator < ::Rails::Generators::Base
6
+ source_root File.expand_path("../../../../app/views/base_editing", __dir__)
7
+ argument :name, type: :string, banner: "Post", required: true
8
+ argument :attributes, type: :array, default: [], banner: "field field:type"
9
+
10
+ TYPES = [:base,:timestamps].freeze
11
+
12
+ desc <<-DESCRIPTION.strip_heredoc
13
+ Description:
14
+ Copy partial files for a defined cell,
15
+ the possible types are #{TYPES}
16
+ Default to base
17
+ DESCRIPTION
18
+
19
+ def copy_form_partials
20
+ if attributes.empty?
21
+ say "Need one field"
22
+ else
23
+ singular_name = name.underscore.downcase.singularize
24
+ plural_name = singular_name.pluralize
25
+ attributes.each do |a|
26
+ attr_name, type = a.split(":")
27
+
28
+ type = :base if type.nil?
29
+ type = type.to_sym
30
+ raise "Type #{type} not found in #{TYPES}" unless TYPES.include?(type)
31
+ copy_file "cell_field/_#{type}.html.erb", File.join("app/views", plural_name, singular_name, 'cell_field', "_#{attr_name}.html.erb")
32
+ end
33
+ end
34
+
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BaseEditingBootstrap
4
+ module Generators
5
+ class FieldOverrideGenerator < ::Rails::Generators::Base
6
+ source_root File.expand_path("../../../../app/views/base_editing", __dir__)
7
+ argument :name, type: :string, banner: "Post", required: true
8
+ argument :attributes, type: :array, default: [], banner: "field field:type"
9
+
10
+ TYPES = %i[base date datetime decimal integer enum]
11
+
12
+ desc <<-DESCRIPTION.strip_heredoc
13
+ Description:
14
+ Copy partial files for a defined fields,
15
+ the possible types are #{TYPES}
16
+ Default to base
17
+ DESCRIPTION
18
+
19
+ def copy_form_partials
20
+ if attributes.empty?
21
+ say "Need one field"
22
+ else
23
+ singular_name = name.underscore.downcase.singularize
24
+ plural_name = singular_name.pluralize
25
+ attributes.each do |a|
26
+ attr_name, type = a.split(":")
27
+
28
+ type = :base if type.nil?
29
+ type = type.to_sym
30
+ raise "Type #{type} not found in #{TYPES}" unless TYPES.include?(type)
31
+ copy_file "form_field/_#{type}.html.erb", File.join("app/views", plural_name, singular_name, 'form_field', "_#{attr_name}.html.erb")
32
+ end
33
+ end
34
+
35
+ end
36
+ end
37
+ end
38
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: base_editing_bootstrap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marino Bonetti
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-29 00:00:00.000000000 Z
11
+ date: 2024-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -354,6 +354,8 @@ files:
354
354
  - lib/base_editing_bootstrap/searches/base.rb
355
355
  - lib/base_editing_bootstrap/searches/field.rb
356
356
  - lib/base_editing_bootstrap/version.rb
357
+ - lib/generators/base_editing_bootstrap/cell_override/cell_override_generator.rb
358
+ - lib/generators/base_editing_bootstrap/field_override/field_override_generator.rb
357
359
  - lib/generators/base_editing_bootstrap/install/USAGE
358
360
  - lib/generators/base_editing_bootstrap/install/install_generator.rb
359
361
  - lib/generators/base_editing_bootstrap/install/templates/initializer.rb