active_admin_multi_upload 0.0.5 → 0.1.0
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 +4 -4
- data/app/models/concerns/active_admin_multi_upload/uploadable.rb +6 -4
- data/app/views/active_admin_multi_upload/_upload_form.html.erb +2 -0
- data/lib/active_admin_multi_upload/dsl.rb +1 -1
- data/lib/active_admin_multi_upload/version.rb +1 -1
- data/lib/generators/active_admin_multi_upload/resource/resource_generator.rb +0 -11
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20e603c7f2a6efb401d26ff5f93f60871b370b87
|
4
|
+
data.tar.gz: 278cdad1ef25ca5642395243d04887142e456ea8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69458d4e437c53c8fcbd52f0aee6103f076831117b358146c9de2dda447bb7aa43037caa9acbe7f621e93636e9baf5320b73b77eb72e8c5a0481d40f7766512b
|
7
|
+
data.tar.gz: 81bc2b24f3bdf5e223d892c01abcb0c98c592e99ae444f337537a03faf072517222aaf1121af2b0e3bfcbdc1f381cb311f7341a23f60d59f0ed37b374db29495
|
@@ -9,11 +9,13 @@ module ActiveAdminMultiUpload::Uploadable
|
|
9
9
|
def allows_upload(name)
|
10
10
|
code = <<-eoruby
|
11
11
|
def to_jq_upload
|
12
|
+
uploader = send("#{name}")
|
13
|
+
thumb_url = uploader.respond_to?(:thumb) ? uploader.thumb.url : ""
|
12
14
|
{
|
13
|
-
"name" =>
|
14
|
-
"size" =>
|
15
|
-
"url" =>
|
16
|
-
"thumbnail_url" =>
|
15
|
+
"name" => uploader.filename,
|
16
|
+
"size" => uploader.size,
|
17
|
+
"url" => uploader.url,
|
18
|
+
"thumbnail_url" => thumb_url,
|
17
19
|
"delete_url" => destroy_upload_admin_#{self.name.underscore}_url(self, only_path: true),
|
18
20
|
"id" => id,
|
19
21
|
"delete_type" => "DELETE"
|
@@ -89,6 +89,7 @@
|
|
89
89
|
<tr class="template-download fade">
|
90
90
|
{% if (file.error) { %}
|
91
91
|
<td></td>
|
92
|
+
<td class="url"><span>{%=file.url%}</span></td>
|
92
93
|
<td class="name"><span>{%=file.name%}</span></td>
|
93
94
|
<td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td>
|
94
95
|
<td class="error" colspan="2"><span class="label label-important">{%=locale.fileupload.error%}</span> {%=locale.fileupload.errors[file.error] || file.error%}</td>
|
@@ -99,6 +100,7 @@
|
|
99
100
|
<td class="name" id="upload_{%=file.id%}" data-id="{%=file.id%}">
|
100
101
|
<a href="{%=file.url%}" title="{%=file.name%}" rel="{%=file.thumbnail_url&&'gallery'%}" download="{%=file.name%}">{%=file.name%}</a>
|
101
102
|
</td>
|
103
|
+
<td class="url"><span>{%=file.url%}</span></td>
|
102
104
|
<td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td>
|
103
105
|
<td colspan="2"></td>
|
104
106
|
{% } %}
|
@@ -4,7 +4,7 @@ module ActiveAdminMultiUpload
|
|
4
4
|
def allows_multi_upload(options={})
|
5
5
|
|
6
6
|
config.resource_class.send(:include, ::ActiveAdminMultiUpload::Uploadable)
|
7
|
-
uploader = options[:mounted_uploader]
|
7
|
+
uploader = options[:mounted_uploader] || :image
|
8
8
|
config.resource_class.send(:allows_upload, uploader)
|
9
9
|
|
10
10
|
collection_action :create_upload, method: :post do
|
@@ -1,16 +1,5 @@
|
|
1
1
|
module ActiveAdminMultiUpload
|
2
2
|
class ResourceGenerator < Rails::Generators::NamedBase
|
3
3
|
source_root File.expand_path('../templates', __FILE__)
|
4
|
-
|
5
|
-
def add_js_assets
|
6
|
-
append_file "app/assets/javascripts/active_admin.js.coffee", "#= require jquery-fileupload\n"
|
7
|
-
append_file "app/assets/javascripts/active_admin.js.coffee", "#= require jquery-fileupload/vendor/tmpl\n"
|
8
|
-
end
|
9
|
-
|
10
|
-
def add_css_assets
|
11
|
-
append_file "app/assets/stylesheets/active_admin.css.scss", '@import "jquery.fileupload-ui";'
|
12
|
-
end
|
13
|
-
|
14
|
-
private
|
15
4
|
end
|
16
5
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_admin_multi_upload
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Isaac Norman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-05-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -111,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
111
111
|
version: '0'
|
112
112
|
requirements: []
|
113
113
|
rubyforge_project:
|
114
|
-
rubygems_version: 2.
|
114
|
+
rubygems_version: 2.4.6
|
115
115
|
signing_key:
|
116
116
|
specification_version: 4
|
117
117
|
summary: Allows for the upload of multiple files at once to ActiveAdmin
|
@@ -149,3 +149,4 @@ test_files:
|
|
149
149
|
- test/dummy/README.rdoc
|
150
150
|
- test/integration/navigation_test.rb
|
151
151
|
- test/test_helper.rb
|
152
|
+
has_rdoc:
|