File tree Expand file tree Collapse file tree 3 files changed +6
-3
lines changed Expand file tree Collapse file tree 3 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -79,6 +79,7 @@ Tool | Description
79
79
: plural_resource_label |pluralized resource label value (default config.plural_resource_label)
80
80
: error_limit |Limit the number of errors reported (default ` 5 ` , set to ` nil ` for all)
81
81
: headers_rewrites |hash with key (csv header) - value (db column name) rows mapping
82
+ : if |Controls whether the 'Import' button is displayed. It supports a proc to be evaluated into a boolean value within the activeadmin render context.
82
83
83
84
84
85
Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ def active_admin_import(options = {}, &block)
62
62
render template : options [ :template ]
63
63
end
64
64
65
- action_item :import , only : :index do
65
+ action_item :import , only : :index , if : options [ :if ] do
66
66
if authorized? ( ActiveAdminImport ::Auth ::IMPORT , active_admin_config . resource_class )
67
67
link_to (
68
68
I18n . t ( 'active_admin_import.import_model' , plural_model : options [ :plural_resource_label ] ) ,
Original file line number Diff line number Diff line change @@ -20,7 +20,8 @@ module Options
20
20
:resource_label ,
21
21
:plural_resource_label ,
22
22
:error_limit ,
23
- :headers_rewrites
23
+ :headers_rewrites ,
24
+ :if
24
25
] . freeze
25
26
26
27
def self . options_for ( config , options = { } )
@@ -36,7 +37,8 @@ def self.options_for(config, options = {})
36
37
resource_label : config . resource_label ,
37
38
plural_resource_label : config . plural_resource_label ,
38
39
error_limit : 5 ,
39
- headers_rewrites : { }
40
+ headers_rewrites : { } ,
41
+ if : true
40
42
} . deep_merge ( options )
41
43
end
42
44
end
You can’t perform that action at this time.
0 commit comments