active_admin-duplicatable 0.0.1 → 0.1.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 +4 -4
- data/.gitignore +5 -0
- data/CHANGELOG.md +19 -0
- data/README.md +10 -1
- data/lib/active_admin/duplicatable.rb +9 -2
- data/lib/active_admin/duplicatable/version.rb +1 -1
- metadata +4 -4
- data/Gemfile.lock +0 -166
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8323c9fb0d2645dba576f6fafe86fea9483f9500
|
4
|
+
data.tar.gz: 26a755b4a0f498ee46b4cbf1ececbeed61064524
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8d9ac85135ec0d56fbc7bf48d06341936fe50fdb64f37a77cac67ef06584c596a9ab2e3084ff7edbe06fae4bd17ab5cfbdbca3e07ec90543985779ed170747a
|
7
|
+
data.tar.gz: 62b14a7ad02f58240c5f49c43864758a519fde87593cc481d47fa404c3d4aae1f3535106758003e780b3260fdc72aec38c9ce259064bc19430d180f48c5363a3
|
data/.gitignore
ADDED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# Change Log
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
|
5
|
+
## [Unreleased]
|
6
|
+
|
7
|
+
## [0.1.0] - 2014-12-15
|
8
|
+
|
9
|
+
### Added
|
10
|
+
|
11
|
+
- Check user has permission to create resources in duplciation action and when
|
12
|
+
displaying the "Duplicate Model" action item.
|
13
|
+
|
14
|
+
## 0.0.1 - 2014-06-02
|
15
|
+
|
16
|
+
- Initial release
|
17
|
+
|
18
|
+
[unreleased]: https://github.com/zorab47/active_admin-duplicatable/compare/v0.1.0...HEAD
|
19
|
+
[0.1.0]: https://github.com/zorab47/active_admin-duplicatable/compare/v0.0.1...v0.1.0
|
data/README.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# ActiveAdmin::Duplicatable
|
2
2
|
|
3
|
+
[](http://badge.fury.io/rb/active_admin-duplicatable)
|
4
|
+
|
5
|
+
## Description
|
6
|
+
|
3
7
|
Simple duplication of [ActiveAdmin][] resources.
|
4
8
|
|
5
9
|
Allow user duplication of [ActiveAdmin][] resources through the power of the
|
@@ -9,7 +13,7 @@ defaults.
|
|
9
13
|
|
10
14
|
## Usage
|
11
15
|
|
12
|
-
Add duplication functionality a Post resource. See [Duplicatable][] for
|
16
|
+
Add duplication functionality to a Post resource. See [Duplicatable][] for
|
13
17
|
documentation.
|
14
18
|
|
15
19
|
```ruby
|
@@ -38,6 +42,11 @@ And then execute:
|
|
38
42
|
4. Push to the branch (`git push origin my-new-feature`)
|
39
43
|
5. Create a new Pull Request
|
40
44
|
|
45
|
+
## Versioning
|
46
|
+
|
47
|
+
Follows [Semantic Versioning 2.0.0][Semver]
|
48
|
+
|
41
49
|
[ActiveAdmin]: https://github.com/gregbell/active_admin
|
42
50
|
[Amoeba]: https://github.com/rocksolidwebdesign/amoeba
|
43
51
|
[Duplicatable]: lib/active_admin/duplicatable.rb
|
52
|
+
[Semver]: http://semver.org/spec/v2.0.0.html
|
@@ -38,7 +38,9 @@ module ActiveAdmin
|
|
38
38
|
# No return.
|
39
39
|
def enable_resource_duplication_via_form
|
40
40
|
action_item :only => [:show] do
|
41
|
-
|
41
|
+
if controller.action_methods.include?('new') && authorized?(ActiveAdmin::Auth::CREATE, active_admin_config.resource_class)
|
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
|
+
end
|
42
44
|
end
|
43
45
|
|
44
46
|
controller do
|
@@ -60,11 +62,16 @@ module ActiveAdmin
|
|
60
62
|
# No return.
|
61
63
|
def enable_resource_duplication_via_save
|
62
64
|
action_item :only => [:show] do
|
63
|
-
|
65
|
+
if controller.action_methods.include?('new') && authorized?(ActiveAdmin::Auth::CREATE, active_admin_config.resource_class)
|
66
|
+
link_to(I18n.t(:duplicate_model, default: "Duplicate %{model}", scope: [:active_admin], model: active_admin_config.resource_label), action: :duplicate)
|
67
|
+
end
|
64
68
|
end
|
65
69
|
|
66
70
|
member_action :duplicate do
|
67
71
|
resource = resource_class.find(params[:id])
|
72
|
+
|
73
|
+
authorize! ActiveAdmin::Auth::CREATE, resource
|
74
|
+
|
68
75
|
duplicate = resource.amoeba_dup
|
69
76
|
if duplicate.save
|
70
77
|
redirect_to({ action: :edit, id: duplicate.id }, flash: { notice: "#{active_admin_config.resource_label} was successfully duplicated." })
|
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.0
|
4
|
+
version: 0.1.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-
|
11
|
+
date: 2014-12-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activeadmin
|
@@ -104,8 +104,9 @@ executables: []
|
|
104
104
|
extensions: []
|
105
105
|
extra_rdoc_files: []
|
106
106
|
files:
|
107
|
+
- ".gitignore"
|
108
|
+
- CHANGELOG.md
|
107
109
|
- Gemfile
|
108
|
-
- Gemfile.lock
|
109
110
|
- LICENSE.txt
|
110
111
|
- README.md
|
111
112
|
- Rakefile
|
@@ -141,4 +142,3 @@ summary: Simple duplication of ActiveAdmin resources
|
|
141
142
|
test_files:
|
142
143
|
- spec/duplicatable_spec.rb
|
143
144
|
- spec/spec_helper.rb
|
144
|
-
has_rdoc:
|
data/Gemfile.lock
DELETED
@@ -1,166 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
active_admin-duplicatable (0.0.1)
|
5
|
-
activeadmin
|
6
|
-
amoeba (>= 2.0.0)
|
7
|
-
|
8
|
-
GEM
|
9
|
-
remote: https://rubygems.org/
|
10
|
-
specs:
|
11
|
-
actionmailer (3.2.18)
|
12
|
-
actionpack (= 3.2.18)
|
13
|
-
mail (~> 2.5.4)
|
14
|
-
actionpack (3.2.18)
|
15
|
-
activemodel (= 3.2.18)
|
16
|
-
activesupport (= 3.2.18)
|
17
|
-
builder (~> 3.0.0)
|
18
|
-
erubis (~> 2.7.0)
|
19
|
-
journey (~> 1.0.4)
|
20
|
-
rack (~> 1.4.5)
|
21
|
-
rack-cache (~> 1.2)
|
22
|
-
rack-test (~> 0.6.1)
|
23
|
-
sprockets (~> 2.2.1)
|
24
|
-
activeadmin (0.6.3)
|
25
|
-
arbre (~> 1.0)
|
26
|
-
bourbon (>= 1.0.0, < 4)
|
27
|
-
devise (>= 1.5.4, < 4, != 2.2.2, != 2.2.1, != 2.2.0, != 2.1.2, != 2.1.1, != 2.1.0, != 2.0.4, != 2.0.3, != 2.0.2, != 2.0.1, != 2.0.0)
|
28
|
-
formtastic (~> 2.0)
|
29
|
-
inherited_resources (~> 1.3)
|
30
|
-
jquery-rails (>= 1.0.0, < 3)
|
31
|
-
kaminari (~> 0.13, != 0.15.0)
|
32
|
-
meta_search (~> 1.0)
|
33
|
-
rails (>= 3.0.0, < 4)
|
34
|
-
sass (~> 3.1)
|
35
|
-
activemodel (3.2.18)
|
36
|
-
activesupport (= 3.2.18)
|
37
|
-
builder (~> 3.0.0)
|
38
|
-
activerecord (3.2.18)
|
39
|
-
activemodel (= 3.2.18)
|
40
|
-
activesupport (= 3.2.18)
|
41
|
-
arel (~> 3.0.2)
|
42
|
-
tzinfo (~> 0.3.29)
|
43
|
-
activeresource (3.2.18)
|
44
|
-
activemodel (= 3.2.18)
|
45
|
-
activesupport (= 3.2.18)
|
46
|
-
activesupport (3.2.18)
|
47
|
-
i18n (~> 0.6, >= 0.6.4)
|
48
|
-
multi_json (~> 1.0)
|
49
|
-
amoeba (2.0.0)
|
50
|
-
activerecord (>= 3.0)
|
51
|
-
arbre (1.0.1)
|
52
|
-
activesupport (>= 3.0.0)
|
53
|
-
arel (3.0.3)
|
54
|
-
bcrypt (3.1.7)
|
55
|
-
bourbon (3.2.3)
|
56
|
-
sass (~> 3.2)
|
57
|
-
thor
|
58
|
-
builder (3.0.4)
|
59
|
-
devise (3.2.4)
|
60
|
-
bcrypt (~> 3.0)
|
61
|
-
orm_adapter (~> 0.1)
|
62
|
-
railties (>= 3.2.6, < 5)
|
63
|
-
thread_safe (~> 0.1)
|
64
|
-
warden (~> 1.2.3)
|
65
|
-
diff-lcs (1.2.5)
|
66
|
-
erubis (2.7.0)
|
67
|
-
formtastic (2.2.1)
|
68
|
-
actionpack (>= 3.0)
|
69
|
-
has_scope (0.6.0.rc)
|
70
|
-
actionpack (>= 3.2, < 5)
|
71
|
-
activesupport (>= 3.2, < 5)
|
72
|
-
hike (1.2.3)
|
73
|
-
i18n (0.6.9)
|
74
|
-
inherited_resources (1.4.1)
|
75
|
-
has_scope (~> 0.6.0.rc)
|
76
|
-
responders (~> 1.0.0.rc)
|
77
|
-
journey (1.0.4)
|
78
|
-
jquery-rails (2.3.0)
|
79
|
-
railties (>= 3.0, < 5.0)
|
80
|
-
thor (>= 0.14, < 2.0)
|
81
|
-
json (1.8.1)
|
82
|
-
kaminari (0.15.1)
|
83
|
-
actionpack (>= 3.0.0)
|
84
|
-
activesupport (>= 3.0.0)
|
85
|
-
mail (2.5.4)
|
86
|
-
mime-types (~> 1.16)
|
87
|
-
treetop (~> 1.4.8)
|
88
|
-
meta_search (1.1.3)
|
89
|
-
actionpack (~> 3.1)
|
90
|
-
activerecord (~> 3.1)
|
91
|
-
activesupport (~> 3.1)
|
92
|
-
polyamorous (~> 0.5.0)
|
93
|
-
mime-types (1.25.1)
|
94
|
-
multi_json (1.10.1)
|
95
|
-
orm_adapter (0.5.0)
|
96
|
-
polyamorous (0.5.0)
|
97
|
-
activerecord (~> 3.0)
|
98
|
-
polyglot (0.3.4)
|
99
|
-
rack (1.4.5)
|
100
|
-
rack-cache (1.2)
|
101
|
-
rack (>= 0.4)
|
102
|
-
rack-ssl (1.3.4)
|
103
|
-
rack
|
104
|
-
rack-test (0.6.2)
|
105
|
-
rack (>= 1.0)
|
106
|
-
rails (3.2.18)
|
107
|
-
actionmailer (= 3.2.18)
|
108
|
-
actionpack (= 3.2.18)
|
109
|
-
activerecord (= 3.2.18)
|
110
|
-
activeresource (= 3.2.18)
|
111
|
-
activesupport (= 3.2.18)
|
112
|
-
bundler (~> 1.0)
|
113
|
-
railties (= 3.2.18)
|
114
|
-
railties (3.2.18)
|
115
|
-
actionpack (= 3.2.18)
|
116
|
-
activesupport (= 3.2.18)
|
117
|
-
rack-ssl (~> 1.3.2)
|
118
|
-
rake (>= 0.8.7)
|
119
|
-
rdoc (~> 3.4)
|
120
|
-
thor (>= 0.14.6, < 2.0)
|
121
|
-
rake (10.3.2)
|
122
|
-
rdoc (3.12.2)
|
123
|
-
json (~> 1.4)
|
124
|
-
responders (1.0.0)
|
125
|
-
railties (>= 3.2, < 5)
|
126
|
-
rspec (3.0.0)
|
127
|
-
rspec-core (~> 3.0.0)
|
128
|
-
rspec-expectations (~> 3.0.0)
|
129
|
-
rspec-mocks (~> 3.0.0)
|
130
|
-
rspec-core (3.0.0)
|
131
|
-
rspec-support (~> 3.0.0)
|
132
|
-
rspec-expectations (3.0.0)
|
133
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
134
|
-
rspec-support (~> 3.0.0)
|
135
|
-
rspec-mocks (3.0.0)
|
136
|
-
rspec-support (~> 3.0.0)
|
137
|
-
rspec-support (3.0.0)
|
138
|
-
sass (3.3.7)
|
139
|
-
sass-rails (3.2.6)
|
140
|
-
railties (~> 3.2.0)
|
141
|
-
sass (>= 3.1.10)
|
142
|
-
tilt (~> 1.3)
|
143
|
-
sprockets (2.2.2)
|
144
|
-
hike (~> 1.2)
|
145
|
-
multi_json (~> 1.0)
|
146
|
-
rack (~> 1.0)
|
147
|
-
tilt (~> 1.1, != 1.3.0)
|
148
|
-
thor (0.19.1)
|
149
|
-
thread_safe (0.3.3)
|
150
|
-
tilt (1.4.1)
|
151
|
-
treetop (1.4.15)
|
152
|
-
polyglot
|
153
|
-
polyglot (>= 0.3.1)
|
154
|
-
tzinfo (0.3.39)
|
155
|
-
warden (1.2.3)
|
156
|
-
rack (>= 1.0)
|
157
|
-
|
158
|
-
PLATFORMS
|
159
|
-
ruby
|
160
|
-
|
161
|
-
DEPENDENCIES
|
162
|
-
active_admin-duplicatable!
|
163
|
-
bundler (~> 1.6)
|
164
|
-
rake
|
165
|
-
rspec
|
166
|
-
sass-rails
|