abyme 0.6.2 → 0.6.3
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/Gemfile.lock +1 -1
- data/lib/abyme/version.rb +1 -1
- data/lib/generators/abyme/view/view_generator.rb +10 -10
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e71aaa0391ddf79198fbd0e3076b7899ecd8a72abbfac41429d416f3a671dccc
|
|
4
|
+
data.tar.gz: 382947241368e89f93142bb5b0c9b34f1af8323f5d8689fd54d2dd4a7907385e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 34cc3af27975485027977aa98f51419924ec4d42f3f72a0a03c559eaed18bb2a2e5734efc9345ed10631740f7860b63691e42da159c84e89e27711505ce19a6c
|
|
7
|
+
data.tar.gz: e9588871ddce9c79d34d77511a9f56f29a280177a5dc9f9fe056cc7540ce2e28d3b0a64d6ceb5735811cd910e9cf1692e4a5ff81a87eaec8d0a0c4d466ff216d
|
data/Gemfile.lock
CHANGED
data/lib/abyme/version.rb
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
require
|
|
1
|
+
require "rails/generators"
|
|
2
2
|
|
|
3
3
|
module Abyme
|
|
4
4
|
module Generators
|
|
5
5
|
class ViewGenerator < Rails::Generators::Base
|
|
6
|
-
source_root File.expand_path(
|
|
6
|
+
source_root File.expand_path("templates", __dir__)
|
|
7
7
|
|
|
8
8
|
argument :association, type: :string, required: true, banner: "association association"
|
|
9
9
|
argument :attributes, type: :array, default: [], banner: "field field"
|
|
@@ -20,7 +20,7 @@ module Abyme
|
|
|
20
20
|
private
|
|
21
21
|
|
|
22
22
|
def partial_file_path
|
|
23
|
-
Rails.root.join(
|
|
23
|
+
Rails.root.join("app", "views", "abyme", "_#{association.downcase.singularize}_fields.html.erb")
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
def insert_fields(builder = nil)
|
|
@@ -33,12 +33,12 @@ module Abyme
|
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
def simple_form_fields
|
|
36
|
-
if attributes.include?(
|
|
37
|
-
|
|
36
|
+
inputs = if attributes.include?("all_attributes")
|
|
37
|
+
rejected_keys(association.classify.constantize.new.attributes.keys).map do |key|
|
|
38
38
|
"<%= f.input :#{key} %>"
|
|
39
39
|
end
|
|
40
40
|
else
|
|
41
|
-
|
|
41
|
+
attributes.map do |key|
|
|
42
42
|
"<%= f.input :#{key} %>"
|
|
43
43
|
end
|
|
44
44
|
end
|
|
@@ -47,7 +47,7 @@ module Abyme
|
|
|
47
47
|
end
|
|
48
48
|
|
|
49
49
|
def rejected_keys(keys)
|
|
50
|
-
keys.reject { |key| [
|
|
50
|
+
keys.reject { |key| ["id", "created_at", "updated_at"].include?(key) || key.match(/_id/) }
|
|
51
51
|
end
|
|
52
52
|
|
|
53
53
|
def header
|
|
@@ -55,10 +55,10 @@ module Abyme
|
|
|
55
55
|
end
|
|
56
56
|
|
|
57
57
|
def default_keys
|
|
58
|
-
%
|
|
58
|
+
%(
|
|
59
59
|
<%= f.hidden_field :_destroy %>
|
|
60
|
-
<%= remove_associated_record content: "Remove #{association.downcase}" %>
|
|
61
|
-
|
|
60
|
+
<%= remove_associated_record content: "Remove #{association.downcase.singularize}" %>
|
|
61
|
+
)
|
|
62
62
|
end
|
|
63
63
|
end
|
|
64
64
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: abyme
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.6.
|
|
4
|
+
version: 0.6.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Romain Sanson
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: exe
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2021-06-
|
|
12
|
+
date: 2021-06-24 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: bundler
|