active_admin_import 2.1.1 → 2.1.2
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 +5 -13
- data/README.md +6 -3
- data/app/views/admin/import.html.erb +2 -2
- data/lib/active_admin_import.rb +1 -0
- data/lib/active_admin_import/authorization.rb +8 -0
- data/lib/active_admin_import/dsl.rb +11 -7
- data/lib/active_admin_import/version.rb +1 -1
- metadata +17 -16
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
OWU1MDI1YjMwNjM1MmIxOWU4MTQ5NDlkNGMzODQ1OGM5YWM4OGQ4NQ==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b8f417cc9a85210d9b683c9153e081542a882820
|
4
|
+
data.tar.gz: d91324749b99737df1100043f3d33aeeb1b81e25
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
MTBjNDI2OGE1YWM4MTJlYjUwNmM2Y2NlZWIxM2EwNDAwZTUzNzU2YjljZGRj
|
11
|
-
MjI4ODU3ZTVlYjA5MzMwMWJjZWEyOGFmOTkyYWM2OGY0NjIyZmY=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
YzA1ZTY1NjVjYzUwOTYwZGQ4MWMzMTdlOTg0Y2FjZmMyZjc3NGUyNGIzNmVl
|
14
|
-
YjFkZmM1NDMwMDFlNDJhZDQ1N2YyNjVjMGJmYmQ2NjQ1NjQwOTdjODY4Mjlk
|
15
|
-
YWU2ZWZjNzRjMjYxOTg3Mjg2MmMzMTE3ODlkOGI0MWI1NDliNjQ=
|
6
|
+
metadata.gz: afe63356cf3a67b25940824541b1e2dc4c7ae752fa7f93ac9d1e4a2403f2f963c0c4f081cc91d1cdf69e3c7e796e7ce4165dee9e8b6f31d762ed18209f45beba
|
7
|
+
data.tar.gz: a3bd48e057590d3c85c01738f2399ae578153fdd2661eaba3f6124e3b5c87cbbab6ca2dbd50743cbdc377cb2b6a1aebc313d3a8cd0456db086e34a036b8b2f1d
|
data/README.md
CHANGED
@@ -11,7 +11,7 @@ Should work with both AA 0.6 and 1.0.0
|
|
11
11
|
Add this line to your application's Gemfile:
|
12
12
|
|
13
13
|
```ruby
|
14
|
-
gem "active_admin_import" , '2.1.
|
14
|
+
gem "active_admin_import" , '2.1.1'
|
15
15
|
```
|
16
16
|
|
17
17
|
And then execute:
|
@@ -154,7 +154,7 @@ Example5 Callbacks for each bulk insert iteration
|
|
154
154
|
import.csv_lines #lines to import
|
155
155
|
import.model #template_object instance
|
156
156
|
},
|
157
|
-
:
|
157
|
+
:after_batch_import => proc{ |import|
|
158
158
|
#the same
|
159
159
|
}
|
160
160
|
end
|
@@ -207,5 +207,8 @@ https://github.com/gregbell/active_admin
|
|
207
207
|
https://github.com/zdennis/activerecord-import
|
208
208
|
|
209
209
|
#Source Doc
|
210
|
-
http://rubydoc.info/gems/active_admin_import/2.1.
|
210
|
+
http://rubydoc.info/gems/active_admin_import/2.1.1/
|
211
|
+
|
212
|
+
|
213
|
+
|
211
214
|
|
@@ -1,5 +1,5 @@
|
|
1
|
-
<p>
|
2
|
-
|
1
|
+
<p class="active_admin_import_hint">
|
2
|
+
<%= raw(@active_admin_import_model.hint) %>
|
3
3
|
</p>
|
4
4
|
<%= semantic_form_for @active_admin_import_model, url: {action: :do_import}, html: {multipart: true} do |f| %>
|
5
5
|
<%= f.inputs do %>
|
data/lib/active_admin_import.rb
CHANGED
@@ -33,21 +33,25 @@ module ActiveAdminImport
|
|
33
33
|
headers_rewrites: {}
|
34
34
|
}
|
35
35
|
options = default_options.deep_merge(options)
|
36
|
-
options[:template_object]
|
37
|
-
params_key = ActiveModel::Naming.param_key(options[:template_object])
|
36
|
+
params_key = ActiveModel::Naming.param_key(options[:template_object] || ActiveAdminImport::Model.new)
|
38
37
|
|
39
38
|
collection_action :import, method: :get do
|
40
|
-
|
39
|
+
authorize!(ActiveAdminImport::Auth::IMPORT, active_admin_config.resource_class)
|
40
|
+
|
41
|
+
@active_admin_import_model = options[:template_object] || ActiveAdminImport::Model.new
|
41
42
|
render template: options[:template]
|
42
43
|
end
|
43
44
|
|
44
|
-
action_item only: :index do
|
45
|
-
|
45
|
+
action_item :import, only: :index do
|
46
|
+
if authorized?(ActiveAdminImport::Auth::IMPORT, active_admin_config.resource_class)
|
47
|
+
link_to(I18n.t('active_admin_import.import_model', model: options[:resource_label]), action: 'import')
|
48
|
+
end
|
46
49
|
end
|
47
50
|
|
48
51
|
collection_action :do_import, method: :post do
|
52
|
+
authorize!(ActiveAdminImport::Auth::IMPORT, active_admin_config.resource_class)
|
49
53
|
|
50
|
-
@active_admin_import_model = options[:template_object]
|
54
|
+
@active_admin_import_model = options[:template_object] || ActiveAdminImport::Model.new
|
51
55
|
@active_admin_import_model.assign_attributes(params[params_key].try(:deep_symbolize_keys) || {})
|
52
56
|
#go back to form
|
53
57
|
return render template: options[:template] unless @active_admin_import_model.valid?
|
@@ -58,7 +62,7 @@ module ActiveAdminImport
|
|
58
62
|
instance_eval &block
|
59
63
|
else
|
60
64
|
model_name = options[:resource_label].downcase
|
61
|
-
plural_model_name = options[:
|
65
|
+
plural_model_name = options[:plural_resource_label].downcase
|
62
66
|
if @importer.result[:imported].to_i > 0
|
63
67
|
flash[:notice] = I18n.t('active_admin_import.imported', count: @importer.result[:imported].to_i, model: model_name, plural_model: plural_model_name)
|
64
68
|
end
|
metadata
CHANGED
@@ -1,67 +1,67 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_admin_import
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Fedoronchuk
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord-import
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0.4'
|
20
|
-
- -
|
20
|
+
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: 0.4.1
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
|
-
- - ~>
|
27
|
+
- - "~>"
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '0.4'
|
30
|
-
- -
|
30
|
+
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 0.4.1
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: activeadmin
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- -
|
37
|
+
- - ">="
|
38
38
|
- !ruby/object:Gem::Version
|
39
39
|
version: 0.6.0
|
40
40
|
type: :runtime
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
|
-
- -
|
44
|
+
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: 0.6.0
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rubyzip
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
|
-
- - ~>
|
51
|
+
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: '1.0'
|
54
|
-
- -
|
54
|
+
- - ">="
|
55
55
|
- !ruby/object:Gem::Version
|
56
56
|
version: 1.0.0
|
57
57
|
type: :runtime
|
58
58
|
prerelease: false
|
59
59
|
version_requirements: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
|
-
- - ~>
|
61
|
+
- - "~>"
|
62
62
|
- !ruby/object:Gem::Version
|
63
63
|
version: '1.0'
|
64
|
-
- -
|
64
|
+
- - ">="
|
65
65
|
- !ruby/object:Gem::Version
|
66
66
|
version: 1.0.0
|
67
67
|
description: The most efficient way to import for Active Admin
|
@@ -71,7 +71,7 @@ executables: []
|
|
71
71
|
extensions: []
|
72
72
|
extra_rdoc_files: []
|
73
73
|
files:
|
74
|
-
- .gitignore
|
74
|
+
- ".gitignore"
|
75
75
|
- Gemfile
|
76
76
|
- LICENSE
|
77
77
|
- README.md
|
@@ -81,6 +81,7 @@ files:
|
|
81
81
|
- config/locales/en.yml
|
82
82
|
- config/locales/it.yml
|
83
83
|
- lib/active_admin_import.rb
|
84
|
+
- lib/active_admin_import/authorization.rb
|
84
85
|
- lib/active_admin_import/dsl.rb
|
85
86
|
- lib/active_admin_import/engine.rb
|
86
87
|
- lib/active_admin_import/importer.rb
|
@@ -96,17 +97,17 @@ require_paths:
|
|
96
97
|
- lib
|
97
98
|
required_ruby_version: !ruby/object:Gem::Requirement
|
98
99
|
requirements:
|
99
|
-
- -
|
100
|
+
- - ">="
|
100
101
|
- !ruby/object:Gem::Version
|
101
102
|
version: '0'
|
102
103
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
104
|
requirements:
|
104
|
-
- -
|
105
|
+
- - ">="
|
105
106
|
- !ruby/object:Gem::Version
|
106
107
|
version: '0'
|
107
108
|
requirements: []
|
108
109
|
rubyforge_project:
|
109
|
-
rubygems_version: 2.2.
|
110
|
+
rubygems_version: 2.2.2
|
110
111
|
signing_key:
|
111
112
|
specification_version: 4
|
112
113
|
summary: ActiveAdmin import based on activerecord-import gem.
|