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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8ee6a1fa7fbbb43253a3d8bca9531e30c14d2dd9
4
- data.tar.gz: d1b39107410f4dd044c3f97f2e0d7559a8407a49
3
+ metadata.gz: a87fe5385b0de688785cfaec48ffe310969b18f2
4
+ data.tar.gz: 1bbc6c634a83e7f9dace9ef942bb3345aae1a2fb
5
5
  SHA512:
6
- metadata.gz: 925220e206cda38d6fd489c5655daff209c5eb018d9f5439d932eced04bd087812b2d5d92408f139675948d0f010144da27d954a369bd0af1f732dc701f0da7c
7
- data.tar.gz: 0d9563ec56939c490d90844bed5bdbcc833e32f35afc02a5a85a8214990626d2eac6a7cec7e6560df100d9d8e0438bdef6f8d92c121df8d3c0735ae13d75b658
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
- index_for_main_fields klass, options.fetch(:index){{}}
34
- filter_for_main_fields klass, options.fetch(:filter){{}}
35
- form_for_main_fields klass, options.fetch(:form){{}}
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
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module ActiveAdminSimpleLife
3
- VERSION = "0.1.5"
3
+ VERSION = "0.1.6"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_admin_simple_life
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kvokka