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
7979: plural_resource_label |pluralized resource label value (default config.plural_resource_label)
8080: error_limit |Limit the number of errors reported (default ` 5 ` , set to ` nil ` for all)
8181: 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.
8283
8384
8485
Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ def active_admin_import(options = {}, &block)
6262 render template : options [ :template ]
6363 end
6464
65- action_item :import , only : :index do
65+ action_item :import , only : :index , if : options [ :if ] do
6666 if authorized? ( ActiveAdminImport ::Auth ::IMPORT , active_admin_config . resource_class )
6767 link_to (
6868 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
2020 :resource_label ,
2121 :plural_resource_label ,
2222 :error_limit ,
23- :headers_rewrites
23+ :headers_rewrites ,
24+ :if
2425 ] . freeze
2526
2627 def self . options_for ( config , options = { } )
@@ -36,7 +37,8 @@ def self.options_for(config, options = {})
3637 resource_label : config . resource_label ,
3738 plural_resource_label : config . plural_resource_label ,
3839 error_limit : 5 ,
39- headers_rewrites : { }
40+ headers_rewrites : { } ,
41+ if : true
4042 } . deep_merge ( options )
4143 end
4244 end
You can’t perform that action at this time.
0 commit comments