active_admin_paranoia 1.0.10 → 1.0.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 90216d115aad9b5d601ab5a9ae4c3c890d41467f
4
- data.tar.gz: a9e51b014d5e077cecb05fcb136a37396395c62d
3
+ metadata.gz: cec3ccee649c706e1af5a3886157a05724d49c6e
4
+ data.tar.gz: 3b032c0e20e70919ee52239b4d5fa28d6c35b251
5
5
  SHA512:
6
- metadata.gz: 4587181367aa4b8eb8f81037dfe2107f9e8a3e2bebe9b210bf4e4762a4aa6752565083e1b08b140defb89e2724dc8273c7e9801d69f366222ab98fd7e667009c
7
- data.tar.gz: 81952d5af6365ac77374b5eb95afc28fe3af7eddfb005b8f8859a37390de413d59c284aedfa43e28d44a04f5bd1487c5761ea18e651686e8e964bb4aed8652f4
6
+ metadata.gz: 3ccd4997e8c4725618b57111682ba767eb8f33b1260cfa9f4e8c9c4db9cec8ec9be35183138f27b04a18e33bc2c2edd27459b4eba38935e1ec771166c3aef783
7
+ data.tar.gz: 0f12c674b89af8789e83ee36ffe02df227c25c348e548309bf6703d6a9a410923dbe720b53ac1c26e31bc7d7f4de6c3dedca00f6c88db221edf54f65585d21aa
data/README.md CHANGED
@@ -5,7 +5,7 @@ This gem extends ActiveAdmin so that batch restore and batch archive actions wil
5
5
  This gem assumes that you have already configured [paranoia](https://github.com/radar/paranoia) for you desire resource. Add this line to your application's Gemfile:
6
6
 
7
7
  ```ruby
8
- gem "active_admin_paranoia" , '~> 1.0.10'
8
+ gem "active_admin_paranoia" , '~> 1.0.11'
9
9
 
10
10
  ```
11
11
 
@@ -9,12 +9,24 @@ module ActiveAdminParanoia
9
9
 
10
10
  batch_action :destroy, confirm: proc{ I18n.t('active_admin.batch_actions.delete_confirmation', plural_model: resource_class.to_s.downcase.pluralize) }, if: proc{ authorized?(ActiveAdmin::Auth::DESTROY, resource_class) && params[:scope] != 'archived' } do |ids|
11
11
  resource_class.to_s.camelize.constantize.where(id: ids).destroy_all
12
- redirect_to :back, notice: I18n.t('active_admin.batch_actions.succesfully_destroyed', count: ids.count, model: resource_class.to_s.camelize.constantize.model_name, plural_model: resource_class.to_s.downcase.pluralize)
12
+ options = { notice: I18n.t('active_admin.batch_actions.succesfully_destroyed', count: ids.count, model: resource_class.to_s.camelize.constantize.model_name, plural_model: resource_class.to_s.downcase.pluralize) }
13
+ # For more info, see here: https://github.com/rails/rails/pull/22506
14
+ if Rails::VERSION::MAJOR >= 5
15
+ redirect_back({ fallback_location: ActiveAdmin.application.root_to }.merge(options))
16
+ else
17
+ redirect_to :back, options
18
+ end
13
19
  end
14
20
 
15
21
  batch_action :restore, confirm: proc{ I18n.t('active_admin_paranoia.batch_actions.restore_confirmation', plural_model: resource_class.to_s.downcase.pluralize) }, if: proc{ authorized?(ActiveAdminParanoia::Auth::RESTORE, resource_class) && params[:scope] == 'archived' } do |ids|
16
22
  resource_class.to_s.camelize.constantize.restore(ids, recursive: true)
17
- redirect_to :back, notice: I18n.t('active_admin_paranoia.batch_actions.succesfully_restored', count: ids.count, model: resource_class.to_s.camelize.constantize.model_name, plural_model: resource_class.to_s.downcase.pluralize)
23
+ options = { notice: I18n.t('active_admin_paranoia.batch_actions.succesfully_restored', count: ids.count, model: resource_class.to_s.camelize.constantize.model_name, plural_model: resource_class.to_s.downcase.pluralize) }
24
+ # For more info, see here: https://github.com/rails/rails/pull/22506
25
+ if Rails::VERSION::MAJOR >= 5
26
+ redirect_back({ fallback_location: ActiveAdmin.application.root_to }.merge(options))
27
+ else
28
+ redirect_to :back, options
29
+ end
18
30
  end
19
31
 
20
32
  action_item :restore, only: :show do
@@ -23,7 +35,13 @@ module ActiveAdminParanoia
23
35
 
24
36
  member_action :restore, method: :put, confirm: proc{ I18n.t('active_admin_paranoia.restore_confirmation') }, if: proc{ authorized?(ActiveAdminParanoia::Auth::RESTORE, resource_class) } do
25
37
  resource.restore(recursive: true)
26
- redirect_to :back, notice: I18n.t('active_admin_paranoia.batch_actions.succesfully_restored', count: 1, model: resource_class.to_s.camelize.constantize.model_name, plural_model: resource_class.to_s.downcase.pluralize)
38
+ options = { notice: I18n.t('active_admin_paranoia.batch_actions.succesfully_restored', count: 1, model: resource_class.to_s.camelize.constantize.model_name, plural_model: resource_class.to_s.downcase.pluralize) }
39
+ # For more info, see here: https://github.com/rails/rails/pull/22506
40
+ if Rails::VERSION::MAJOR >= 5
41
+ redirect_back({ fallback_location: ActiveAdmin.application.root_to }.merge(options))
42
+ else
43
+ redirect_to :back, options
44
+ end
27
45
  end
28
46
 
29
47
  scope(I18n.t('active_admin_paranoia.non_archived'), default: true) { |scope| scope.where(resource_class.to_s.camelize.constantize.paranoia_column => resource_class.to_s.camelize.constantize.paranoia_sentinel_value) }
@@ -1,3 +1,3 @@
1
1
  module ActiveAdminParanoia
2
- VERSION = '1.0.10'
2
+ VERSION = '1.0.11'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_admin_paranoia
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.10
4
+ version: 1.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miah Raihan Mahmud Arman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-29 00:00:00.000000000 Z
11
+ date: 2017-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails