@@ -3,10 +3,13 @@ module DSL
33
44 def scoped_collection_action ( name , options = { } , &block )
55 if name == :scoped_collection_destroy
6- options [ :title ] = 'Delete batch' if options [ :title ] . nil?
6+
7+
8+
9+ options [ :title ] = I18n . t ( 'active_admin_scoped_collection_actions.actions.delete' ) if options [ :title ] . nil?
710 add_scoped_collection_action_default_destroy ( options , &block )
811 elsif name == :scoped_collection_update
9- options [ :title ] = 'Update batch' if options [ :title ] . nil?
12+ options [ :title ] = I18n . t ( 'active_admin_scoped_collection_actions.actions.update' ) if options [ :title ] . nil?
1013 add_scoped_collection_action_default_update ( options , &block )
1114 else
1215 batch_action ( name , if : proc { false } , &block )
@@ -19,7 +22,7 @@ def scoped_collection_action(name, options = {}, &block)
1922 def add_scoped_collection_action_default_update ( options , &block )
2023 batch_action :scoped_collection_update , if : proc { false } do
2124 unless authorized? ( :batch_edit , resource_class )
22- flash [ :error ] = 'Access denied'
25+ flash [ :error ] = I18n . t ( 'active_admin_scoped_collection_actions.actions.no_permissions_msg' )
2326 render nothing : true , status : :no_content and next
2427 end
2528 if !params . has_key? ( :changes ) || params [ :changes ] . empty?
@@ -36,7 +39,7 @@ def add_scoped_collection_action_default_update(options, &block)
3639 end
3740 end
3841 if errors . empty?
39- flash [ :notice ] = 'Batch update done'
42+ flash [ :notice ] = I18n . t ( 'active_admin_scoped_collection_actions.batch_update_status_msg' )
4043 else
4144 flash [ :error ] = errors . join ( ". " )
4245 end
@@ -49,7 +52,7 @@ def add_scoped_collection_action_default_update(options, &block)
4952 def add_scoped_collection_action_default_destroy ( _ , &block )
5053 batch_action :scoped_collection_destroy , if : proc { false } do |_ |
5154 unless authorized? ( :batch_destroy , resource_class )
52- flash [ :error ] = 'Access denied'
55+ flash [ :error ] = I18n . t ( 'active_admin_scoped_collection_actions.actions.no_permissions_msg' )
5356 render nothing : true , status : :no_content and next
5457 end
5558 if block_given?
@@ -58,11 +61,11 @@ def add_scoped_collection_action_default_destroy(_, &block)
5861 errors = [ ]
5962 scoped_collection_records . find_each do |record |
6063 unless destroy_resource ( record )
61- errors << "#{ record . attributes [ resource_class . primary_key ] } | Cant be destroyed }"
64+ errors << "#{ record . attributes [ resource_class . primary_key ] } | #{ I18n . t ( 'active_admin_scoped_collection_actions.fail_on_destroy_msg' ) } }"
6265 end
6366 end
6467 if errors . empty?
65- flash [ :notice ] = 'Batch destroy done'
68+ flash [ :notice ] = I18n . t ( 'active_admin_scoped_collection_actions.batch_destroy_status_msg' )
6669 else
6770 flash [ :error ] = errors . join ( ". " )
6871 end
0 commit comments