rails_admin_multiple_file_upload 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/rails_admin/rails_admin_multiple_file_upload.coffee +1 -1
- data/app/assets/stylesheets/rails_admin/rails_admin_multiple_file_upload.sass +0 -3
- data/app/views/rails_admin/main/multiple_file_upload.html.slim +4 -1
- data/lib/rails_admin_multiple_file_upload/action.rb +6 -4
- data/lib/rails_admin_multiple_file_upload/helper.rb +3 -3
- 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: f7d2ca40c78b3ef1fd33143dd4f104df6939748f
|
4
|
+
data.tar.gz: 0061080f432bc5971ebaf2feb67312181f002d44
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6f3773faa42661fe47a1156d02ac1444dc68f1c67fd2242bba37376eeb93e9d0dd62aec930b071e49212d96e99af8433784833febec499b3d19dd23d4c5a184
|
7
|
+
data.tar.gz: 005e0dd2af0312b7bb81e29c854c366194f576e4dafca8363b26c4808588e7c686e50532a760bf000740801e12d0f7e4b82dfcfdff35aab4871aac880f0f11d5
|
@@ -7,7 +7,7 @@ window.Dropzone.dictDefaultMessage = "Перетащите сюда файлы
|
|
7
7
|
window.Dropzone.dictFallbackMessage = "Ваш браузер не поддерживает данный способ загрузки файлов!=("
|
8
8
|
window.Dropzone.dictFallbackText = "Используйте стандартные средства загрузки в разделе 'Редактирование'."
|
9
9
|
|
10
|
-
window.Dropzone.dictFileTooBig = "Размер файла слишком большой ({{filesize}} MB).
|
10
|
+
window.Dropzone.dictFileTooBig = "Размер файла слишком большой ({{filesize}} MB). Максимально допустимый размер файла - {{maxFilesize}} MB."
|
11
11
|
window.Dropzone.dictInvalidFileType = "Вы не можете загружать файлы данного типа!"
|
12
12
|
|
13
13
|
window.Dropzone.dictResponseError = "Ошибка загрузки. Код ошибки - {{statusCode}}."
|
@@ -61,8 +61,11 @@
|
|
61
61
|
autoProcessQueue: false,
|
62
62
|
addRemoveLinks: true
|
63
63
|
});
|
64
|
+
$("##{block_id} .dropzone")[0].dropzone.on('success', function(){
|
65
|
+
$("##{button_id}").click();
|
66
|
+
});
|
64
67
|
$("##{button_id}").click(function(e){
|
65
68
|
e.preventDefault();
|
66
|
-
$("##{block_id} .dropzone").dropzone
|
69
|
+
$("##{block_id} .dropzone")[0].dropzone.processQueue();
|
67
70
|
return false
|
68
71
|
})
|
@@ -42,12 +42,14 @@ module RailsAdmin
|
|
42
42
|
|
43
43
|
main_obj = @object
|
44
44
|
embedded = main_obj.send(embedded_field).new
|
45
|
-
embedded.send(embedded_model_upload_field + "=", params[embedded_model_upload_field])
|
46
|
-
embedded.save
|
45
|
+
embedded.send(embedded_model_upload_field + "=", params[embedded_field][embedded_model_upload_field])
|
46
|
+
if embedded.save
|
47
|
+
message = "<strong>#{I18n.t('admin.actions.multiple_file_upload.success')}!</strong>"
|
48
|
+
else
|
49
|
+
message = "<strong>#{I18n.t('admin.actions.multiple_file_upload.error')}</strong>: #{embedded.errors.full_messages}"
|
50
|
+
end
|
47
51
|
|
48
|
-
message = "<strong>#{I18n.t('admin.actions.multiple_file_upload.success')}!</strong>"
|
49
52
|
rescue Exception => e
|
50
|
-
|
51
53
|
message = "<strong>#{I18n.t('admin.actions.multiple_file_upload.error')}</strong>: #{e}"
|
52
54
|
end
|
53
55
|
|
@@ -19,15 +19,15 @@ module RailsAdminMultipleFileUpload
|
|
19
19
|
if multiple_file_upload_paperclip?
|
20
20
|
if ef.send(config[:embedded_model_upload_field] + "_content_type") =~ /\Aimage/
|
21
21
|
file_url = ef.send(config[:embedded_model_upload_field]).url(multiple_file_upload_thumbnail_size)
|
22
|
-
_ret << content_tag(:
|
22
|
+
_ret << content_tag(:span, image_tag(file_url), class: "file_block_load_already")
|
23
23
|
|
24
24
|
else
|
25
|
-
if ef.respond_to(:name)
|
25
|
+
if ef.respond_to?(:name)
|
26
26
|
file_name = ef.name
|
27
27
|
else
|
28
28
|
file_name = ef.send(config[:embedded_model_upload_field] + "_file_name")
|
29
29
|
end
|
30
|
-
_ret << content_tag(:
|
30
|
+
_ret << content_tag(:span, link_to(ef.name), class: "file_block_load_already")
|
31
31
|
end
|
32
32
|
end
|
33
33
|
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
|
+
version: 0.2.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: 2016-02-
|
11
|
+
date: 2016-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|