active_admin_scoped_collection_actions 0.3.0 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +2 -3
- data/CHANGELOG.md +13 -0
- data/Gemfile +2 -2
- data/config/locales/en.yml +11 -0
- data/config/locales/es.yml +11 -0
- data/lib/active_admin_scoped_collection_actions/dsl.rb +13 -15
- data/lib/active_admin_scoped_collection_actions/resource_extension.rb +2 -2
- data/lib/active_admin_scoped_collection_actions/version.rb +1 -1
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a7249396315ba5c2bf97925d540c168136cd254
|
4
|
+
data.tar.gz: 5dc6d2198c98d1c84520a6e7da60e47aa19f2903
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eddf1a6219efa8cf0c9cf7b75e075b8c0b36c95aedff26eb6f38cdd4187b55d7ad10c9fb26b726ca7d045d419596b10e17299a396ecc1c759a7545f92acac224
|
7
|
+
data.tar.gz: a7bed8c4adba8a7209ba24dfbf890c550ef1e82ff3e01ed6711da537fd80664606c205cf16be5675faf21673a79984ef0476873b21803114a0b10f010aad453f
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
## ActiveAdmin Scoped Collection Actions 0.3.3 (July 17, 2017) ##
|
2
|
+
|
3
|
+
* Fixed compatibility with Rails 5.1
|
4
|
+
|
5
|
+
|
6
|
+
## ActiveAdmin Scoped Collection Actions 0.3.2 (July 17, 2017) ##
|
7
|
+
|
8
|
+
* Added I18n support.
|
9
|
+
|
10
|
+
translations for English and Spanish (@cpfarher #25).
|
11
|
+
|
12
|
+
*Christian Pfarher*
|
13
|
+
|
data/Gemfile
CHANGED
@@ -4,9 +4,9 @@ source 'https://rubygems.org'
|
|
4
4
|
gemspec
|
5
5
|
group :test do
|
6
6
|
gem 'sprockets-rails', '2.3.3'
|
7
|
-
gem 'rails', '
|
7
|
+
gem 'rails', '~> 5.1'
|
8
8
|
gem 'rspec-rails'
|
9
|
-
gem 'activeadmin',
|
9
|
+
gem 'activeadmin', '1.0.0'
|
10
10
|
gem 'sass-rails'
|
11
11
|
gem 'sqlite3'
|
12
12
|
gem 'launchy'
|
@@ -0,0 +1,11 @@
|
|
1
|
+
en:
|
2
|
+
active_admin_scoped_collection_actions:
|
3
|
+
sidebar_msg: 'This batch operations affect selected records. Or if none is selected, it will involve all records by current filters and scopes.'
|
4
|
+
confirm_action_message: 'Are you sure?'
|
5
|
+
actions:
|
6
|
+
delete: 'Delete batch'
|
7
|
+
update: 'Update batch'
|
8
|
+
no_permissions_msg: 'Access denied'
|
9
|
+
batch_update_status_msg: 'Batch update done'
|
10
|
+
batch_destroy_status_msg: 'Batch destroy done'
|
11
|
+
fail_on_destroy_msg: 'Cant be destroyed'
|
@@ -0,0 +1,11 @@
|
|
1
|
+
es:
|
2
|
+
active_admin_scoped_collection_actions:
|
3
|
+
sidebar_msg: 'Estas operaciones afectan las filas seleccionadas o en caso que no halla seleccionado ninguna, afectará a todo los registros afectados por los filtros aplicados.'
|
4
|
+
confirm_action_message: '¿Está seguro que quiere realizar esta acción?'
|
5
|
+
actions:
|
6
|
+
delete: 'Batch Borrado'
|
7
|
+
update: 'Batch Actualizado'
|
8
|
+
no_permissions_msg: 'Permiso denegado'
|
9
|
+
batch_update_status_msg: 'Batch actualizado correctamente'
|
10
|
+
batch_destroy_status_msg: 'Batch destruido correctamente'
|
11
|
+
fail_on_destroy_msg: 'No se puede eliminar'
|
@@ -3,10 +3,10 @@ module ActiveAdminScopedCollectionActions
|
|
3
3
|
|
4
4
|
def scoped_collection_action(name, options = {}, &block)
|
5
5
|
if name == :scoped_collection_destroy
|
6
|
-
options[:title] = '
|
6
|
+
options[:title] = I18n.t('active_admin_scoped_collection_actions.actions.delete') if options[:title].nil?
|
7
7
|
add_scoped_collection_action_default_destroy(options, &block)
|
8
8
|
elsif name == :scoped_collection_update
|
9
|
-
options[:title] = '
|
9
|
+
options[:title] = I18n.t('active_admin_scoped_collection_actions.actions.update') if options[:title].nil?
|
10
10
|
add_scoped_collection_action_default_update(options, &block)
|
11
11
|
else
|
12
12
|
batch_action(name, if: proc { false }, &block)
|
@@ -15,15 +15,14 @@ module ActiveAdminScopedCollectionActions
|
|
15
15
|
config.add_scoped_collection_action(name, options)
|
16
16
|
end
|
17
17
|
|
18
|
-
|
19
18
|
def add_scoped_collection_action_default_update(options, &block)
|
20
19
|
batch_action :scoped_collection_update, if: proc { false } do
|
21
20
|
unless authorized?(:batch_edit, resource_class)
|
22
|
-
flash[:error] = '
|
23
|
-
|
21
|
+
flash[:error] = I18n.t('active_admin_scoped_collection_actions.actions.no_permissions_msg')
|
22
|
+
head :ok and next
|
24
23
|
end
|
25
24
|
if !params.has_key?(:changes) || params[:changes].empty?
|
26
|
-
|
25
|
+
head :ok and next
|
27
26
|
end
|
28
27
|
permitted_changes = params.require(:changes).permit(*(options[:form].call.keys))
|
29
28
|
if block_given?
|
@@ -36,21 +35,20 @@ module ActiveAdminScopedCollectionActions
|
|
36
35
|
end
|
37
36
|
end
|
38
37
|
if errors.empty?
|
39
|
-
flash[:notice] = '
|
38
|
+
flash[:notice] = I18n.t('active_admin_scoped_collection_actions.batch_update_status_msg')
|
40
39
|
else
|
41
40
|
flash[:error] = errors.join(". ")
|
42
41
|
end
|
43
|
-
|
42
|
+
head :ok
|
44
43
|
end
|
45
44
|
end
|
46
45
|
end
|
47
46
|
|
48
|
-
|
49
47
|
def add_scoped_collection_action_default_destroy(_, &block)
|
50
48
|
batch_action :scoped_collection_destroy, if: proc { false } do |_|
|
51
49
|
unless authorized?(:batch_destroy, resource_class)
|
52
|
-
flash[:error] = '
|
53
|
-
|
50
|
+
flash[:error] = I18n.t('active_admin_scoped_collection_actions.actions.no_permissions_msg')
|
51
|
+
head :ok and next
|
54
52
|
end
|
55
53
|
if block_given?
|
56
54
|
instance_eval &block
|
@@ -58,19 +56,19 @@ module ActiveAdminScopedCollectionActions
|
|
58
56
|
errors = []
|
59
57
|
scoped_collection_records.find_each do |record|
|
60
58
|
unless destroy_resource(record)
|
61
|
-
errors << "#{record.attributes[resource_class.primary_key]} |
|
59
|
+
errors << "#{record.attributes[resource_class.primary_key]} | #{I18n.t('active_admin_scoped_collection_actions.fail_on_destroy_msg')}}"
|
62
60
|
end
|
63
61
|
end
|
64
62
|
if errors.empty?
|
65
|
-
flash[:notice] = '
|
63
|
+
flash[:notice] = I18n.t('active_admin_scoped_collection_actions.batch_destroy_status_msg')
|
66
64
|
else
|
67
65
|
flash[:error] = errors.join(". ")
|
68
66
|
end
|
69
|
-
|
67
|
+
head :ok
|
70
68
|
end
|
71
69
|
end
|
72
70
|
end
|
73
71
|
|
74
|
-
|
75
72
|
end
|
76
73
|
end
|
74
|
+
|
@@ -51,7 +51,7 @@ module ActiveAdminScopedCollectionActions
|
|
51
51
|
def scoped_collection_actions_sidebar_section
|
52
52
|
ActiveAdmin::SidebarSection.new :collection_actions, only: :index, if: scoped_collection_sidebar_condition do
|
53
53
|
|
54
|
-
div '
|
54
|
+
div I18n.t('active_admin_scoped_collection_actions.sidebar_msg')
|
55
55
|
|
56
56
|
active_admin_config.scoped_collection_actions.each do |key, options={}|
|
57
57
|
b_title = options.fetch(:title, ::ActiveSupport::Inflector.humanize(key))
|
@@ -64,7 +64,7 @@ module ActiveAdminScopedCollectionActions
|
|
64
64
|
if options[:form].present?
|
65
65
|
b_data[:inputs] = options[:form].is_a?(Proc) ? options[:form].call : options[:form]
|
66
66
|
end
|
67
|
-
b_data[:confirm] = options.fetch(:confirm, '
|
67
|
+
b_data[:confirm] = options.fetch(:confirm, I18n.t('active_admin_scoped_collection_actions.confirm_action_message'))
|
68
68
|
b_options[:data] = b_data.to_json
|
69
69
|
button b_title, b_options
|
70
70
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_admin_scoped_collection_actions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gena M.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-07-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -48,12 +48,15 @@ extra_rdoc_files: []
|
|
48
48
|
files:
|
49
49
|
- ".gitignore"
|
50
50
|
- ".travis.yml"
|
51
|
+
- CHANGELOG.md
|
51
52
|
- CODE_OF_CONDUCT.md
|
52
53
|
- Gemfile
|
53
54
|
- LICENSE.txt
|
54
55
|
- README.md
|
55
56
|
- Rakefile
|
56
57
|
- active_admin_scoped_collection_actions.gemspec
|
58
|
+
- config/locales/en.yml
|
59
|
+
- config/locales/es.yml
|
57
60
|
- lib/active_admin_scoped_collection_actions.rb
|
58
61
|
- lib/active_admin_scoped_collection_actions/authorization.rb
|
59
62
|
- lib/active_admin_scoped_collection_actions/controller.rb
|
@@ -87,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
87
90
|
version: '0'
|
88
91
|
requirements: []
|
89
92
|
rubyforge_project:
|
90
|
-
rubygems_version: 2.
|
93
|
+
rubygems_version: 2.4.8
|
91
94
|
signing_key:
|
92
95
|
specification_version: 4
|
93
96
|
summary: scoped_collection actions extension for ActiveAdmin
|