rails_admin_multiple_file_upload 0.4.3 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-gemset +1 -1
- data/README.md +3 -1
- data/app/views/rails_admin/main/multiple_file_upload.html.slim +2 -3
- data/app/views/rails_admin/main/multiple_file_upload_collection.html.slim +6 -8
- data/lib/rails_admin_multiple_file_upload/action.rb +3 -19
- data/lib/rails_admin_multiple_file_upload/configuration.rb +1 -2
- data/lib/rails_admin_multiple_file_upload/version.rb +1 -1
- data/rails_admin_multiple_file_upload.gemspec +3 -1
- data/release.sh +1 -1
- metadata +20 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8121d0d8ec32f7c6a54a21b9541834dfe5d00a46
|
4
|
+
data.tar.gz: 5052f93bfb2a1f60c9cad57e1eb4754bc54516a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac28d877cdd5a1500264aad9473a6571e6660fe95af47e7856e308615a6d827fc281421b1186e1b3c417fc67305639c0ba3e3f1e788dea94bdf50c56b8376409
|
7
|
+
data.tar.gz: 1cf30933e23b542bcea04fa7de70a816f30848923bd763b92d237c8ac699f70c21030338d12312b35290d58b8bfbae70d15b98bda156fb2013f967238a56d413
|
data/.ruby-gemset
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
rails_admin_multiple_file_upload_rails5
|
data/README.md
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
# RailsAdminMultipleFileUpload
|
2
2
|
|
3
|
+
### Rails 5 Support
|
4
|
+
|
3
5
|
rails_admin + dropzone.js + mongoid(embedded)
|
4
6
|
|
5
7
|
## Installation
|
6
8
|
|
7
9
|
Add this line to your application's Gemfile:
|
8
10
|
|
9
|
-
gem 'rails_admin_multiple_file_upload', '~> 0.
|
11
|
+
gem 'rails_admin_multiple_file_upload', '~> 0.5.0'
|
10
12
|
|
11
13
|
And then execute:
|
12
14
|
|
@@ -47,7 +47,7 @@
|
|
47
47
|
- if child_objects.respond_to?("ordered") and child_model_ordered_scope.blank?
|
48
48
|
- child_model_ordered_scope = "ordered".freeze
|
49
49
|
|
50
|
-
.tab-pane{id="multiple_file_upload_#{child_field}_#{child_model_upload_field}"}
|
50
|
+
.tab-pane{id="multiple_file_upload_#{child_field}_#{child_model_upload_field}".freeze}
|
51
51
|
.row-fluid
|
52
52
|
- block_id = "rails_admin_multiple_upload_#{child_field}_#{child_model_upload_field}".freeze
|
53
53
|
- button_id = "rails_admin_multiple_upload_#{child_field}_#{child_model_upload_field}_button".freeze
|
@@ -59,8 +59,7 @@
|
|
59
59
|
$("##{block_id} .dropzone").dropzone({
|
60
60
|
paramName: "#{child_field}[#{child_model_upload_field}]",
|
61
61
|
autoProcessQueue: false,
|
62
|
-
addRemoveLinks: true
|
63
|
-
parallelUploads: 1
|
62
|
+
addRemoveLinks: true
|
64
63
|
});
|
65
64
|
$("##{block_id} .dropzone")[0].dropzone.on('success', function(){
|
66
65
|
$("##{button_id}").click();
|
@@ -8,7 +8,7 @@
|
|
8
8
|
ruby:
|
9
9
|
_escape_tableize = @model.name.tableize.gsub("/", "_")
|
10
10
|
upload_field = "image".freeze
|
11
|
-
i18n_path = "rails_admin.multiple_file_upload_collection.#{@model.name.tableize}.#{upload_field}"
|
11
|
+
i18n_path = "rails_admin.multiple_file_upload_collection.#{@model.name.tableize}.#{upload_field}"v
|
12
12
|
i18n_path_default = "rails_admin.multiple_file_upload_collection.#{@model.name.tableize}".freeze
|
13
13
|
|
14
14
|
link = "#multiple_file_upload_collection_#{_escape_tableize}_#{upload_field}".freeze
|
@@ -41,7 +41,7 @@
|
|
41
41
|
- objects = @model.all.to_a
|
42
42
|
|
43
43
|
- _escape_tableize = @model.name.tableize.gsub("/", "_").freeze
|
44
|
-
.tab-pane{id="multiple_file_upload_collection_#{_escape_tableize}_#{upload_field}"}
|
44
|
+
.tab-pane{id="multiple_file_upload_collection_#{_escape_tableize}_#{upload_field}".freeze}
|
45
45
|
.row-fluid
|
46
46
|
- block_id = "rails_admin_multiple_upload_collection_#{_escape_tableize}_#{upload_field}".freeze
|
47
47
|
- button_id = "rails_admin_multiple_upload_collection_#{_escape_tableize}_#{upload_field}_button".freeze
|
@@ -53,8 +53,7 @@
|
|
53
53
|
$("##{block_id} .dropzone").dropzone({
|
54
54
|
paramName: "#{upload_field}",
|
55
55
|
autoProcessQueue: false,
|
56
|
-
addRemoveLinks: true
|
57
|
-
parallelUploads: 1
|
56
|
+
addRemoveLinks: true
|
58
57
|
});
|
59
58
|
$("##{block_id} .dropzone")[0].dropzone.on('success', function(){
|
60
59
|
$("##{button_id}").click();
|
@@ -74,10 +73,10 @@
|
|
74
73
|
- objects = @model.sorted.to_a
|
75
74
|
- elsif child_objects.respond_to?("ordered")
|
76
75
|
- objects = @model.ordered.to_a
|
77
|
-
-
|
76
|
+
-else
|
78
77
|
- objects = @model.all.to_a
|
79
78
|
|
80
|
-
.tab-pane{id="multiple_file_upload_collection_#{_escape_tableize}_#{upload_field}"}
|
79
|
+
.tab-pane{id="multiple_file_upload_collection_#{_escape_tableize}_#{upload_field}".freeze}
|
81
80
|
.row-fluid
|
82
81
|
- block_id = "rails_admin_multiple_upload_collection_#{_escape_tableize}_#{upload_field}".freeze
|
83
82
|
- button_id = "rails_admin_multiple_upload_collection_#{_escape_tableize}_#{upload_field}_button".freeze
|
@@ -89,8 +88,7 @@
|
|
89
88
|
$("##{block_id} .dropzone").dropzone({
|
90
89
|
paramName: "#{upload_field}",
|
91
90
|
autoProcessQueue: false,
|
92
|
-
addRemoveLinks: true
|
93
|
-
parallelUploads: 1
|
91
|
+
addRemoveLinks: true
|
94
92
|
});
|
95
93
|
$("##{block_id} .dropzone")[0].dropzone.on('success', function(){
|
96
94
|
$("##{button_id}").click();
|
@@ -49,25 +49,9 @@ module RailsAdmin
|
|
49
49
|
end
|
50
50
|
|
51
51
|
main_obj = @object
|
52
|
-
|
53
|
-
child = child_scope.new
|
52
|
+
child = main_obj.send(child_field).new
|
54
53
|
child.name = File.basename(_file.original_filename, ext) if @conf.options[:name_from_filename]
|
55
54
|
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
|
71
55
|
if child.save
|
72
56
|
message = "<strong>#{I18n.t('admin.actions.multiple_file_upload.success')}!</strong>".freeze
|
73
57
|
else
|
@@ -78,7 +62,7 @@ module RailsAdmin
|
|
78
62
|
message = "<strong>#{I18n.t('admin.actions.multiple_file_upload.error')}</strong>: #{e}".freeze
|
79
63
|
end
|
80
64
|
|
81
|
-
render
|
65
|
+
render text: message
|
82
66
|
end
|
83
67
|
end
|
84
68
|
end
|
@@ -157,7 +141,7 @@ module RailsAdmin
|
|
157
141
|
message = "<strong>#{I18n.t('admin.actions.multiple_file_upload_collection.error')}</strong>: #{e}"
|
158
142
|
end
|
159
143
|
|
160
|
-
render
|
144
|
+
render text: message
|
161
145
|
end
|
162
146
|
end
|
163
147
|
end
|
@@ -21,6 +21,8 @@ Gem::Specification.new do |gem|
|
|
21
21
|
gem.add_development_dependency "bundler", "~> 1.10"
|
22
22
|
gem.add_development_dependency "rake", "~> 10.0"
|
23
23
|
|
24
|
-
gem.add_dependency "
|
24
|
+
gem.add_dependency "rails", '>= 5.0'
|
25
|
+
|
26
|
+
gem.add_dependency "rails_admin", '>= 1.0.0.rc'
|
25
27
|
gem.add_dependency 'dropzonejs-rails', "~> 0.7.3"
|
26
28
|
end
|
data/release.sh
CHANGED
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
|
+
version: 0.5.0
|
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: 2016-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,20 +38,34 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rails
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '5.0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '5.0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: rails_admin
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
|
-
- - "
|
59
|
+
- - ">="
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.
|
61
|
+
version: 1.0.0.rc
|
48
62
|
type: :runtime
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
|
-
- - "
|
66
|
+
- - ">="
|
53
67
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.
|
68
|
+
version: 1.0.0.rc
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: dropzonejs-rails
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|