active_admin_simple_life 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -0
- data/lib/active_admin_simple_life/simple_menu.rb +6 -4
- data/lib/active_admin_simple_life/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a87fe5385b0de688785cfaec48ffe310969b18f2
|
4
|
+
data.tar.gz: 1bbc6c634a83e7f9dace9ef942bb3345aae1a2fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd1e299bdf77a81e40d098fe677797895d2913edebb5dc218f0b879181997c82ed0870060159bad5ef5b3cba7d188c8164bb194cea28d31269162a9d4c450d69
|
7
|
+
data.tar.gz: 64e40f0dade5feed6ce374f3d3c6c49ec58bb66d4ba43016b1f18bcab6dc57d9545ba2e3345199fe8a62163d93aa1f0541957977839ffab7edb3703d9610cd35
|
data/README.md
CHANGED
@@ -35,6 +35,9 @@ method takes options like:
|
|
35
35
|
* `:permitted_params` = addition for strong params (by default provides only
|
36
36
|
`main_fields`)
|
37
37
|
* `:max_length` = max column length
|
38
|
+
* `index: {skip: true}` or `form: {skip: true}` or `filter: {skip: true}` for skipping some parts of defaults
|
39
|
+
and of course you may provide a block to this method, which witll be executed in AA context
|
40
|
+
|
38
41
|
|
39
42
|
Parts of `simple_menu_for` may be used for other purposes with:
|
40
43
|
* `index_for_main_fields klass, options`, where options are:
|
@@ -11,8 +11,9 @@ module ActiveAdminSimpleLife
|
|
11
11
|
# permitted_params:array for some additions to main_fields permitted params
|
12
12
|
|
13
13
|
# def simple_menu_for(klass, options = {})
|
14
|
-
def for(klass, options = {})
|
14
|
+
def for(klass, options = {}, &blk)
|
15
15
|
ActiveAdmin.register klass do
|
16
|
+
options = {index: {}, form: {}, filter: {}}.merge options
|
16
17
|
permitted_params = options.delete :permitted_params
|
17
18
|
permit_params(*(klass.main_fields + (permitted_params || [])))
|
18
19
|
# menu_options = options.slice(:priority, :parent, :if)
|
@@ -30,9 +31,10 @@ module ActiveAdminSimpleLife
|
|
30
31
|
end
|
31
32
|
end if permitted_params
|
32
33
|
|
33
|
-
|
34
|
-
|
35
|
-
|
34
|
+
%i[index filter form].each do |action|
|
35
|
+
send "#{action}_for_main_fields", klass, options[action] unless options[action][:skip] == true
|
36
|
+
end
|
37
|
+
instance_exec &blk if block_given?
|
36
38
|
end
|
37
39
|
end
|
38
40
|
end
|