rails_admin_import 1.4.0 → 2.0.0
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 741d56674d36948aadddfa2951204d3fd3ece179
|
4
|
+
data.tar.gz: 4535fb361151b7f3dbb615c380a0d9eeb93a6478
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f364e695d7e1eac68a4bc821cc08f34c1dc1ea340a8d8c26a317aba5fcbcff7aded642fc7c9657e6c4671e3306b4dc1522ab39ef4c9ae449850e5a53806b5ec8
|
7
|
+
data.tar.gz: dd57d2e866208dfeb6da5acf65d118902c87d650d0cf42828266a901e726734b8d1a159b4cde9569f36fd7260a952792b63d58aeec11bfa9ebff7960418b11c4
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
# 2.0.0 / 2016-05-04
|
4
|
+
|
5
|
+
- Pull in the encoding list from the Encoding module instead of RailsAdmin. Thanks @baldursson, @patricklewis and @lucasff
|
6
|
+
|
3
7
|
# 1.4.0 / 2016-02-26
|
4
8
|
|
5
9
|
- Implement row limit (default maximum is 1000 rows). Thanks @codealchemy!
|
data/README.md
CHANGED
@@ -267,8 +267,13 @@ For example, you could
|
|
267
267
|
|
268
268
|
* Set an attribute on a Devise User model to skip checking for a password when importing a new model.
|
269
269
|
|
270
|
-
*
|
270
|
+
* Import an image into Carrierwave via a URL provided in the CSV.
|
271
271
|
|
272
|
+
```
|
273
|
+
def before_import_save(record)
|
274
|
+
self.remote_image_url = record[:image] if record[:image].present?
|
275
|
+
end
|
276
|
+
```
|
272
277
|
|
273
278
|
## ORM: ActiveRecord and Mongoid
|
274
279
|
|
@@ -24,7 +24,7 @@
|
|
24
24
|
%label.col-sm-2.control-label{for: "encoding"}= t("admin.import.encoding")
|
25
25
|
.col-sm-10.controls
|
26
26
|
= select_tag 'encoding',
|
27
|
-
options_for_select(
|
27
|
+
options_for_select(Encoding.name_list.sort),
|
28
28
|
include_blank: true, data: { enumeration: true }
|
29
29
|
%p.help-block= t('admin.import.help.encoding', name: 'UTF-8')
|
30
30
|
.form-group.control-group
|
@@ -52,7 +52,7 @@
|
|
52
52
|
= t("admin.import.mapping")
|
53
53
|
.col-sm-10.controls
|
54
54
|
= select_tag "associations[#{field.name}]",
|
55
|
-
options_for_select(@import_model.associated_model_fields(field)
|
55
|
+
options_for_select(@import_model.associated_model_fields(field),
|
56
56
|
@import_model.associated_config(field).mapping_key.to_s), data: { enumeration: true }
|
57
57
|
|
58
58
|
%br
|
@@ -9,8 +9,12 @@ module RailsAdmin
|
|
9
9
|
:name
|
10
10
|
end
|
11
11
|
|
12
|
+
register_instance_option(:mapping_key_list) do
|
13
|
+
[]
|
14
|
+
end
|
15
|
+
|
12
16
|
register_instance_option(:default_excluded_fields) do
|
13
|
-
[:id, :_id, :created_at, :updated_at]
|
17
|
+
[:id, :_id, :created_at, :updated_at, :c_at, :u_at]
|
14
18
|
end
|
15
19
|
end
|
16
20
|
end
|
@@ -63,7 +63,11 @@ module RailsAdminImport
|
|
63
63
|
end
|
64
64
|
|
65
65
|
def update_lookup_field_names
|
66
|
-
@
|
66
|
+
if @config.mapping_key_list.present?
|
67
|
+
@update_lookup_field_names = @config.mapping_key_list
|
68
|
+
else
|
69
|
+
@update_lookup_field_names ||= model_fields.map(&:name) + belongs_to_fields.map(&:foreign_key)
|
70
|
+
end
|
67
71
|
end
|
68
72
|
|
69
73
|
def associated_object(field, mapping_field, value)
|
@@ -82,9 +86,13 @@ module RailsAdminImport
|
|
82
86
|
|
83
87
|
def associated_model_fields(field)
|
84
88
|
@associated_fields ||= {}
|
85
|
-
|
86
|
-
|
87
|
-
|
89
|
+
if associated_config(field).mapping_key_list.present?
|
90
|
+
@associated_fields[field] ||= associated_config(field).mapping_key_list
|
91
|
+
else
|
92
|
+
@associated_fields[field] ||= associated_config(field).visible_fields.select { |f|
|
93
|
+
!f.association?
|
94
|
+
}.map(&:name)
|
95
|
+
end
|
88
96
|
end
|
89
97
|
|
90
98
|
def has_multiple_values?(field_name)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_admin_import
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steph Skardal
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-05-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|