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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4b87fd7456e7f917832a9ea4d8b73f993e124bac
4
- data.tar.gz: 4b98ec7ee0f328f86dc1795bf17a87dacfb8d422
3
+ metadata.gz: 8a7249396315ba5c2bf97925d540c168136cd254
4
+ data.tar.gz: 5dc6d2198c98d1c84520a6e7da60e47aa19f2903
5
5
  SHA512:
6
- metadata.gz: 42ddc87df82ee526c5f0e4fc5a060a80ad521a78d620ac8092927c0091da76a38aa72cf15091fc82dbc06549e7e060d3b8898809092ea1be765d20f6e2a2d8a9
7
- data.tar.gz: 2df3652049e6ef6be8ee88110fe55933d7bb173701b903503c528d489f661bd0a28d5377fcdc70a91e5cfc1f600f2688c8fc79efbad56963c88c9ee7d30f8a2c
6
+ metadata.gz: eddf1a6219efa8cf0c9cf7b75e075b8c0b36c95aedff26eb6f38cdd4187b55d7ad10c9fb26b726ca7d045d419596b10e17299a396ecc1c759a7545f92acac224
7
+ data.tar.gz: a7bed8c4adba8a7209ba24dfbf890c550ef1e82ff3e01ed6711da537fd80664606c205cf16be5675faf21673a79984ef0476873b21803114a0b10f010aad453f
data/.gitignore CHANGED
@@ -10,3 +10,4 @@
10
10
  /.idea
11
11
  .DS_Store
12
12
  /spec/rails
13
+ .versions.conf
data/.travis.yml CHANGED
@@ -1,8 +1,7 @@
1
1
  script: bundle exec rspec spec
2
2
  rvm:
3
- - 2.1.10
4
- - 2.2.6
5
- - 2.3.3
3
+ - 2.2.7
4
+ - 2.3.4
6
5
  before_install:
7
6
  - gem install bundler -v '= 1.9.3'
8
7
  - gem update --system
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', '4.2.0'
7
+ gem 'rails', '~> 5.1'
8
8
  gem 'rspec-rails'
9
- gem 'activeadmin', github: 'activeadmin', ref: '64b5295571400c461376cf060dae9522731fe6d9'
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] = 'Delete batch' if options[:title].nil?
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] = 'Update batch' if options[:title].nil?
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] = 'Access denied'
23
- render nothing: true, status: :no_content and next
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
- render nothing: true, status: :no_content and next
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] = 'Batch update done'
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
- render nothing: true, status: :no_content
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] = 'Access denied'
53
- render nothing: true, status: :no_content and next
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]} | Cant be destroyed}"
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] = 'Batch destroy done'
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
- render nothing: true, status: :no_content
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 'This batch operations affect selected records. Or if none is selected, it will involve all records by current filters and scopes.'
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, 'Are you sure?')
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
@@ -1,3 +1,3 @@
1
1
  module ActiveAdminScopedCollectionActions
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.3"
3
3
  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.0
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-04-24 00:00:00.000000000 Z
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.6.10
93
+ rubygems_version: 2.4.8
91
94
  signing_key:
92
95
  specification_version: 4
93
96
  summary: scoped_collection actions extension for ActiveAdmin