rails_admin_multiple_file_upload 0.4.2.1 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/app/views/rails_admin/main/multiple_file_upload.html.slim +2 -1
- data/app/views/rails_admin/main/multiple_file_upload_collection.html.slim +4 -2
- data/lib/rails_admin_multiple_file_upload/action.rb +19 -3
- data/lib/rails_admin_multiple_file_upload/configuration.rb +2 -1
- data/lib/rails_admin_multiple_file_upload/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a2a765d2be198c84cb26e18b6288a89b731e36f5
|
4
|
+
data.tar.gz: 07987f6026a8d1eea9da12f106f34f6f9fa4544a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f11695f8218aef92861d9526065f764ac9320673aacb9a58424fc3b1776735cfedb146b1c5836b900fc3da0fa00b0586a4c20e303eb7544826a884dd57c11258
|
7
|
+
data.tar.gz: 6990653615e7178bce343ff624fff94671091700ae8fc6a75bde2a70d862cc3e8f8974ce4ad8da71a10636870bb3a6318d97294a2aa7613ece08827a2f0c43c1
|
data/README.md
CHANGED
@@ -59,7 +59,8 @@
|
|
59
59
|
$("##{block_id} .dropzone").dropzone({
|
60
60
|
paramName: "#{child_field}[#{child_model_upload_field}]",
|
61
61
|
autoProcessQueue: false,
|
62
|
-
addRemoveLinks: true
|
62
|
+
addRemoveLinks: true,
|
63
|
+
parallelUploads: 1
|
63
64
|
});
|
64
65
|
$("##{block_id} .dropzone")[0].dropzone.on('success', function(){
|
65
66
|
$("##{button_id}").click();
|
@@ -53,7 +53,8 @@
|
|
53
53
|
$("##{block_id} .dropzone").dropzone({
|
54
54
|
paramName: "#{upload_field}",
|
55
55
|
autoProcessQueue: false,
|
56
|
-
addRemoveLinks: true
|
56
|
+
addRemoveLinks: true,
|
57
|
+
parallelUploads: 1
|
57
58
|
});
|
58
59
|
$("##{block_id} .dropzone")[0].dropzone.on('success', function(){
|
59
60
|
$("##{button_id}").click();
|
@@ -88,7 +89,8 @@
|
|
88
89
|
$("##{block_id} .dropzone").dropzone({
|
89
90
|
paramName: "#{upload_field}",
|
90
91
|
autoProcessQueue: false,
|
91
|
-
addRemoveLinks: true
|
92
|
+
addRemoveLinks: true,
|
93
|
+
parallelUploads: 1
|
92
94
|
});
|
93
95
|
$("##{block_id} .dropzone")[0].dropzone.on('success', function(){
|
94
96
|
$("##{button_id}").click();
|
@@ -49,9 +49,25 @@ module RailsAdmin
|
|
49
49
|
end
|
50
50
|
|
51
51
|
main_obj = @object
|
52
|
-
|
52
|
+
child_scope = main_obj.send(child_field)
|
53
|
+
child = child_scope.new
|
53
54
|
child.name = File.basename(_file.original_filename, ext) if @conf.options[:name_from_filename]
|
54
55
|
child.send(child_model_upload_field + "=", _file)
|
56
|
+
if @conf.options[:set_order_as_max_plus_one]
|
57
|
+
begin
|
58
|
+
if @conf.options[:set_order_as_max_plus_one].is_a?(Symbol) or @conf.options[:set_order_as_max_plus_one].is_a?(String)
|
59
|
+
f_name = @conf.options[:set_order_as_max_plus_one]
|
60
|
+
else
|
61
|
+
f_name = :order
|
62
|
+
end
|
63
|
+
if child.respond_to?(f_name) and child.respond_to?("#{f_name}=") and child_scope.respond_to?(f_name)
|
64
|
+
current_max = child_scope.max(f_name).to_i
|
65
|
+
child.send("#{f_name}=", current_max + 1)
|
66
|
+
end
|
67
|
+
rescue Exception => ex
|
68
|
+
puts ex.inspect
|
69
|
+
end
|
70
|
+
end
|
55
71
|
if child.save
|
56
72
|
message = "<strong>#{I18n.t('admin.actions.multiple_file_upload.success')}!</strong>".freeze
|
57
73
|
else
|
@@ -62,7 +78,7 @@ module RailsAdmin
|
|
62
78
|
message = "<strong>#{I18n.t('admin.actions.multiple_file_upload.error')}</strong>: #{e}".freeze
|
63
79
|
end
|
64
80
|
|
65
|
-
render
|
81
|
+
render plain: message
|
66
82
|
end
|
67
83
|
end
|
68
84
|
end
|
@@ -141,7 +157,7 @@ module RailsAdmin
|
|
141
157
|
message = "<strong>#{I18n.t('admin.actions.multiple_file_upload_collection.error')}</strong>: #{e}"
|
142
158
|
end
|
143
159
|
|
144
|
-
render
|
160
|
+
render plain: message
|
145
161
|
end
|
146
162
|
end
|
147
163
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_admin_multiple_file_upload
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Kiseliev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-03-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|