glebtv-rails-uploader 0.10.0 → 0.10.1
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/controllers/uploader/attachments_controller.rb +10 -10
- data/lib/uploader/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a65fb2766fd2ef01c7cb075ac96549741507a6f3406d83ca6a9bda634c85a4b6
|
4
|
+
data.tar.gz: e03d0977ea91682aed4977bfc3e0deb2b1b36506962826238b7cd790d3071b73
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b879eacb0c7d40e4484d5b8a5e7f7022f0bb00a4113c8c0282a21d93663d707204c3ec3286d53838065e88857603e9368bc3b67e409e4a4e356c81c0ce78599f
|
7
|
+
data.tar.gz: 616d64f4e4d5e8d1283101057681a4fa6d80a50e39cbb8244229506e15f228295fe6dd89d7e377b7b94cbe0c353fd1f26d572b09ead526b38df0d0010fc8ff4f
|
@@ -1,16 +1,16 @@
|
|
1
1
|
module Uploader
|
2
2
|
class AttachmentsController < ActionController::Metal
|
3
3
|
include AbstractController::Callbacks
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
|
5
|
+
before_action :find_klass
|
6
|
+
before_action :find_asset, :only => [:destroy]
|
7
|
+
|
8
8
|
def create
|
9
9
|
@asset = @klass.new(params[:asset])
|
10
10
|
@asset.uploader_create(params, request)
|
11
11
|
render_resourse(@asset, 201)
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
def update
|
15
15
|
@assets = Array.wrap(params[:assets] || [])
|
16
16
|
|
@@ -25,9 +25,9 @@ module Uploader
|
|
25
25
|
@asset.uploader_destroy(params, request)
|
26
26
|
render_json({success: true})
|
27
27
|
end
|
28
|
-
|
28
|
+
|
29
29
|
protected
|
30
|
-
|
30
|
+
|
31
31
|
def find_klass
|
32
32
|
@klass = Uploader.constantize(params[:klass])
|
33
33
|
raise ActionController::RoutingError.new("Class not found #{params[:klass]}") if @klass.nil?
|
@@ -35,9 +35,9 @@ module Uploader
|
|
35
35
|
|
36
36
|
def find_asset
|
37
37
|
@asset = @klass.where(:public_token => params[:id]).first
|
38
|
-
raise ActionController::RoutingError.new("Asset not found by guid #{params[:id]}") if @asset.nil?
|
38
|
+
raise ActionController::RoutingError.new("Asset not found by guid #{params[:id]}") if @asset.nil?
|
39
39
|
end
|
40
|
-
|
40
|
+
|
41
41
|
def render_resourse(record, status = 200)
|
42
42
|
if record.errors.empty?
|
43
43
|
render_json({:files => Array.wrap(record.to_jq_upload)}, status)
|
@@ -45,7 +45,7 @@ module Uploader
|
|
45
45
|
render_json(record.errors, 422)
|
46
46
|
end
|
47
47
|
end
|
48
|
-
|
48
|
+
|
49
49
|
def render_json(hash_or_object, status = 200)
|
50
50
|
ctype = env["HTTP_USER_AGENT"] && env["HTTP_USER_AGENT"].include?("Android") ? "text/plain" : "application/json"
|
51
51
|
|
data/lib/uploader/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glebtv-rails-uploader
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Galeta
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2018-
|
13
|
+
date: 2018-12-24 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: jquery-ui-rails
|