activeadmin_dynamic_fields 0.2.6 → 0.2.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +20 -16
- data/lib/activeadmin/dynamic_fields/version.rb +1 -1
- metadata +136 -14
- data/.gitignore +0 -4
- data/.rubocop.yml +0 -73
- data/Gemfile +0 -4
- data/activeadmin_dynamic_fields.gemspec +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b1a35cc8fb49264ee130c088dd680bde833cecdcb1fd5f2544b7111369c4f74
|
4
|
+
data.tar.gz: 5d72305f05e98728adcb05d03e2d3ffea6fc3c5707544de12c3a045691d45467
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a334732f34e9636c60dd6ba376fe0331fc7dbfddb50e5e7c78b7b294758381dacd85ca51a6a61b85b936a937e4d140a467b2f6fd6baf4952599878cbc7ffbfac
|
7
|
+
data.tar.gz: c9dd461761fff9e2194368ff22404fca87c688399798ea67ab17bdd292c5dcd2aff7eedd7f16fe44b30a17bc3eb4d76d43ada098ba4b25f57557844d9807a6e6
|
data/README.md
CHANGED
@@ -108,9 +108,9 @@ function on_change_category( el ) {
|
|
108
108
|
|
109
109
|
```rb
|
110
110
|
member_action :save, method: [:post] do
|
111
|
-
render ActiveAdmin::DynamicFields
|
112
|
-
# render ActiveAdmin::DynamicFields
|
113
|
-
# render ActiveAdmin::DynamicFields
|
111
|
+
render ActiveAdmin::DynamicFields.update(resource, params)
|
112
|
+
# render ActiveAdmin::DynamicFields.update(resource, params, [:published])
|
113
|
+
# render ActiveAdmin::DynamicFields.update(resource, params, Article::permit_params)
|
114
114
|
end
|
115
115
|
```
|
116
116
|
|
@@ -119,24 +119,24 @@ end
|
|
119
119
|
```rb
|
120
120
|
# Edit a string:
|
121
121
|
column :title do |row|
|
122
|
-
div row.title, ActiveAdmin::DynamicFields
|
122
|
+
div row.title, ActiveAdmin::DynamicFields.edit_string(:title, save_admin_article_path(row.id))
|
123
123
|
end
|
124
124
|
# Edit a boolean:
|
125
125
|
column :published do |row|
|
126
|
-
status_tag row.published, ActiveAdmin::DynamicFields
|
126
|
+
status_tag row.published, ActiveAdmin::DynamicFields.edit_boolean(:published, save_admin_article_path(row.id), row.published)
|
127
127
|
end
|
128
128
|
# Edit a select ([''] allow to have a blank value):
|
129
129
|
column :author do |row|
|
130
|
-
select ActiveAdmin::DynamicFields
|
131
|
-
options_for_select(
|
130
|
+
select ActiveAdmin::DynamicFields.edit_select(:author_id, save_admin_article_path(row.id)) do
|
131
|
+
options_for_select([''] + Author.pluck(:name, :id), row.author_id)
|
132
132
|
end
|
133
133
|
end
|
134
134
|
```
|
135
135
|
|
136
|
-
- In *show* config (
|
136
|
+
- In *show* config (inside `attributes_table` block):
|
137
137
|
```rb
|
138
138
|
row :title do |row|
|
139
|
-
div row.title, ActiveAdmin::DynamicFields
|
139
|
+
div row.title, ActiveAdmin::DynamicFields.edit_string(:title, save_admin_article_path(row.id))
|
140
140
|
end
|
141
141
|
```
|
142
142
|
|
@@ -150,12 +150,16 @@ Prepare the content dialog - in Active Admin Author config:
|
|
150
150
|
ActiveAdmin.register Author do
|
151
151
|
# ...
|
152
152
|
member_action :dialog do
|
153
|
-
|
154
|
-
|
155
|
-
|
153
|
+
record = resource
|
154
|
+
context = Arbre::Context.new do
|
155
|
+
dl do
|
156
|
+
%i[name age created_at].each do |field|
|
157
|
+
dt "#{Author.human_attribute_name(field)}:"
|
158
|
+
dd record[field]
|
159
|
+
end
|
160
|
+
end
|
156
161
|
end
|
157
|
-
|
158
|
-
render plain: content
|
162
|
+
render plain: context
|
159
163
|
end
|
160
164
|
# ...
|
161
165
|
end
|
@@ -170,7 +174,7 @@ ActiveAdmin.register Article do
|
|
170
174
|
attributes_table do
|
171
175
|
# ...
|
172
176
|
row :author do
|
173
|
-
link_to object.author.name, dialog_admin_author_path(
|
177
|
+
link_to object.author.name, dialog_admin_author_path(object.author), title: object.author.name, 'data-df-dialog': true, 'data-df-icon': true
|
174
178
|
end
|
175
179
|
end
|
176
180
|
end
|
@@ -188,7 +192,7 @@ Take a look at [other ActiveAdmin components](https://github.com/blocknotes?utf8
|
|
188
192
|
|
189
193
|
## Contributors
|
190
194
|
|
191
|
-
- [Mattia Roccoberton](http://blocknot.es)
|
195
|
+
- [Mattia Roccoberton](http://blocknot.es): author
|
192
196
|
|
193
197
|
## License
|
194
198
|
|
metadata
CHANGED
@@ -1,42 +1,164 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activeadmin_dynamic_fields
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mattia Roccoberton
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-08-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activeadmin
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: activestorage
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 6.0.3.2
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 6.0.3.2
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: capybara
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 3.33.0
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 3.33.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.13.1
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.13.1
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: puma
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 4.3.5
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 4.3.5
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec_junit_formatter
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.4.1
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.4.1
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rspec-rails
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 4.0.1
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 4.0.1
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: selenium-webdriver
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 3.142.7
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 3.142.7
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: simplecov
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 0.19.0
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 0.19.0
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: sqlite3
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 1.4.2
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 1.4.2
|
27
153
|
description: An Active Admin plugin to add dynamic behaviors to fields
|
28
154
|
email: mat@blocknot.es
|
29
155
|
executables: []
|
30
156
|
extensions: []
|
31
157
|
extra_rdoc_files: []
|
32
158
|
files:
|
33
|
-
- ".gitignore"
|
34
|
-
- ".rubocop.yml"
|
35
|
-
- Gemfile
|
36
159
|
- LICENSE.txt
|
37
160
|
- README.md
|
38
161
|
- Rakefile
|
39
|
-
- activeadmin_dynamic_fields.gemspec
|
40
162
|
- app/assets/javascripts/activeadmin/dynamic_fields.js
|
41
163
|
- lib/activeadmin/dynamic_fields.rb
|
42
164
|
- lib/activeadmin/dynamic_fields/engine.rb
|
@@ -46,7 +168,7 @@ homepage: https://github.com/blocknotes/activeadmin_dynamic_fields
|
|
46
168
|
licenses:
|
47
169
|
- MIT
|
48
170
|
metadata: {}
|
49
|
-
post_install_message:
|
171
|
+
post_install_message:
|
50
172
|
rdoc_options: []
|
51
173
|
require_paths:
|
52
174
|
- lib
|
@@ -61,8 +183,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
61
183
|
- !ruby/object:Gem::Version
|
62
184
|
version: '0'
|
63
185
|
requirements: []
|
64
|
-
rubygems_version: 3.0.
|
65
|
-
signing_key:
|
186
|
+
rubygems_version: 3.0.3
|
187
|
+
signing_key:
|
66
188
|
specification_version: 4
|
67
189
|
summary: Dynamic fields for ActiveAdmin
|
68
190
|
test_files: []
|
data/.gitignore
DELETED
data/.rubocop.yml
DELETED
@@ -1,73 +0,0 @@
|
|
1
|
-
require:
|
2
|
-
- rubocop-rspec
|
3
|
-
|
4
|
-
Rails:
|
5
|
-
Enabled: true
|
6
|
-
|
7
|
-
AllCops:
|
8
|
-
TargetRubyVersion: 2.3.8
|
9
|
-
TargetRailsVersion: 5.2
|
10
|
-
Exclude:
|
11
|
-
- db/schema.rb
|
12
|
-
- bin/*
|
13
|
-
- node_modules/**/*
|
14
|
-
# Temporary files
|
15
|
-
- tmp/**/*
|
16
|
-
|
17
|
-
Rails/InverseOf:
|
18
|
-
Enabled: false
|
19
|
-
|
20
|
-
Style/Documentation:
|
21
|
-
Enabled: false
|
22
|
-
|
23
|
-
Metrics/ClassLength:
|
24
|
-
# Default value is 100
|
25
|
-
Max: 150
|
26
|
-
|
27
|
-
Metrics/LineLength:
|
28
|
-
# Default is 80
|
29
|
-
Max: 120
|
30
|
-
|
31
|
-
Metrics/ModuleLength:
|
32
|
-
# Default is 100
|
33
|
-
Max: 150
|
34
|
-
|
35
|
-
Metrics/ParameterLists:
|
36
|
-
# Default is 5
|
37
|
-
Max: 6
|
38
|
-
|
39
|
-
RSpec/ExampleLength:
|
40
|
-
# Default is 10
|
41
|
-
Max: 20
|
42
|
-
|
43
|
-
Style/FrozenStringLiteralComment:
|
44
|
-
# Deface DOES edit strings in place
|
45
|
-
Exclude:
|
46
|
-
- 'app/overrides/**/*'
|
47
|
-
|
48
|
-
RSpec/MultipleExpectations:
|
49
|
-
# Default is 3
|
50
|
-
Max: 5
|
51
|
-
|
52
|
-
RSpec/NestedGroups:
|
53
|
-
# Default is 3
|
54
|
-
Max: 6
|
55
|
-
|
56
|
-
Metrics/AbcSize:
|
57
|
-
Max: 25
|
58
|
-
|
59
|
-
Metrics/BlockLength:
|
60
|
-
# This value double the rubocop default
|
61
|
-
Max: 50
|
62
|
-
|
63
|
-
Metrics/CyclomaticComplexity:
|
64
|
-
# This value double the rubocop default
|
65
|
-
Max: 12
|
66
|
-
|
67
|
-
Metrics/MethodLength:
|
68
|
-
# This value double the rubocop default
|
69
|
-
Max: 20
|
70
|
-
|
71
|
-
Metrics/PerceivedComplexity:
|
72
|
-
# Default is 7
|
73
|
-
Max: 10
|
data/Gemfile
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
lib = File.expand_path('lib', __dir__)
|
4
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
-
require 'activeadmin/dynamic_fields/version'
|
6
|
-
|
7
|
-
Gem::Specification.new do |spec|
|
8
|
-
spec.name = 'activeadmin_dynamic_fields'
|
9
|
-
spec.version = ActiveAdmin::DynamicFields::VERSION
|
10
|
-
spec.summary = 'Dynamic fields for ActiveAdmin'
|
11
|
-
spec.description = 'An Active Admin plugin to add dynamic behaviors to fields'
|
12
|
-
spec.license = 'MIT'
|
13
|
-
spec.authors = ['Mattia Roccoberton']
|
14
|
-
spec.email = 'mat@blocknot.es'
|
15
|
-
spec.homepage = 'https://github.com/blocknotes/activeadmin_dynamic_fields'
|
16
|
-
|
17
|
-
spec.files = `git ls-files -z`.split("\x0")
|
18
|
-
spec.require_paths = ['lib']
|
19
|
-
|
20
|
-
spec.add_runtime_dependency 'activeadmin', '>= 1.0'
|
21
|
-
end
|