active_admin-duplicatable 0.1.0 → 0.2.0

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: 8323c9fb0d2645dba576f6fafe86fea9483f9500
4
- data.tar.gz: 26a755b4a0f498ee46b4cbf1ececbeed61064524
3
+ metadata.gz: eb10024fedf5e94c75bbd06c61ba63fe07e6642d
4
+ data.tar.gz: 9373c50c442549149090552c640af79feb063553
5
5
  SHA512:
6
- metadata.gz: d8d9ac85135ec0d56fbc7bf48d06341936fe50fdb64f37a77cac67ef06584c596a9ab2e3084ff7edbe06fae4bd17ab5cfbdbca3e07ec90543985779ed170747a
7
- data.tar.gz: 62b14a7ad02f58240c5f49c43864758a519fde87593cc481d47fa404c3d4aae1f3535106758003e780b3260fdc72aec38c9ce259064bc19430d180f48c5363a3
6
+ metadata.gz: ad0a5517a5ac40df74e0d26b8dce2a50086aede86d10a14c6dec55acf06f3c66968fa6a5b78620861ebf8b9f2d836b737771274967d85658e47d3d756392a6f2
7
+ data.tar.gz: c62337fb12d53a28627d86d27e8dad9062259361b76d725e2b3b37cb0fe1b033fd80d2680f8527ac52f76de45af335bbb5f56403d72db0c372e22a6efd0e4d8a
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.2.0] - 2015-07-23
8
+
9
+ - Avoid ActiveAdmin `1.0.0.pre1` deprecation warning when `#action_item` isn't
10
+ named, and maintain backward compatibility with older ActiveAdmin versions.
11
+
7
12
  ## [0.1.0] - 2014-12-15
8
13
 
9
14
  ### Added
@@ -15,5 +20,6 @@ All notable changes to this project will be documented in this file.
15
20
 
16
21
  - Initial release
17
22
 
18
- [unreleased]: https://github.com/zorab47/active_admin-duplicatable/compare/v0.1.0...HEAD
23
+ [unreleased]: https://github.com/zorab47/active_admin-duplicatable/compare/v0.2.0...HEAD
19
24
  [0.1.0]: https://github.com/zorab47/active_admin-duplicatable/compare/v0.0.1...v0.1.0
25
+ [0.2.0]: https://github.com/zorab47/active_admin-duplicatable/compare/v0.1.0...v0.2.0
@@ -28,6 +28,7 @@ DESC
28
28
  spec.add_development_dependency "bundler", "~> 1.6"
29
29
  spec.add_development_dependency "rake"
30
30
  spec.add_development_dependency "rspec"
31
+ spec.add_development_dependency "activerecord", "~> 3.2.18"
31
32
 
32
33
  # required for active admin
33
34
  spec.add_development_dependency "sass-rails"
@@ -37,7 +37,7 @@ module ActiveAdmin
37
37
  #
38
38
  # No return.
39
39
  def enable_resource_duplication_via_form
40
- action_item :only => [:show] do
40
+ action_item(*compatible_action_item_parameters) do
41
41
  if controller.action_methods.include?('new') && authorized?(ActiveAdmin::Auth::CREATE, active_admin_config.resource_class)
42
42
  link_to(I18n.t(:duplicate_model, default: "Duplicate %{model}", scope: [:active_admin], model: active_admin_config.resource_label), action: :new, _source_id: resource.id)
43
43
  end
@@ -61,7 +61,7 @@ module ActiveAdmin
61
61
  #
62
62
  # No return.
63
63
  def enable_resource_duplication_via_save
64
- action_item :only => [:show] do
64
+ action_item(*compatible_action_item_parameters) do
65
65
  if controller.action_methods.include?('new') && authorized?(ActiveAdmin::Auth::CREATE, active_admin_config.resource_class)
66
66
  link_to(I18n.t(:duplicate_model, default: "Duplicate %{model}", scope: [:active_admin], model: active_admin_config.resource_label), action: :duplicate)
67
67
  end
@@ -81,6 +81,23 @@ module ActiveAdmin
81
81
  end
82
82
  end
83
83
 
84
+ # For ActiveAdmin `action_item` compatibility.
85
+ #
86
+ # - When ActiveAdmin is less than 1.0.0.pre1 exclude name parameter from
87
+ # calls to `action_item` for compatibility.
88
+ # - When 1.0.0.pre1 or greater provide name to `action_item` to avoid the
89
+ # warning message, and later an error.
90
+ #
91
+ # Returns Array of parameters.
92
+ def compatible_action_item_parameters
93
+ parameters = [{ :only => [:show] }]
94
+ parameters.unshift(:duplicatable_duplicate) if action_item_name_required?
95
+ parameters
96
+ end
97
+
98
+ def action_item_name_required?
99
+ method(:action_item).parameters.count == 3
100
+ end
84
101
  end
85
102
  end
86
103
 
@@ -1,5 +1,5 @@
1
1
  module Activeadmin
2
2
  module Duplicatable
3
- VERSION = "0.1.0"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_admin-duplicatable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Charles Maresh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-15 00:00:00.000000000 Z
11
+ date: 2015-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activeadmin
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: activerecord
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 3.2.18
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 3.2.18
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: sass-rails
85
99
  requirement: !ruby/object:Gem::Requirement
@@ -135,10 +149,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
135
149
  version: '0'
136
150
  requirements: []
137
151
  rubyforge_project:
138
- rubygems_version: 2.2.2
152
+ rubygems_version: 2.2.3
139
153
  signing_key:
140
154
  specification_version: 4
141
155
  summary: Simple duplication of ActiveAdmin resources
142
156
  test_files:
143
157
  - spec/duplicatable_spec.rb
144
158
  - spec/spec_helper.rb
159
+ has_rdoc: