filestack-rails 5.2.0 → 5.4.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b8d4b048a84d95da691409af0cddb0fed8b84742f4727882959cc97ea1e4ffee
|
4
|
+
data.tar.gz: 24b8b3bdfd42fe57585c9a07d07e55b41f6bd8595a9b9947e81c8970ddd9788a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32cf6fcbe623af0eed119d818eea4a916dd957612d315646ce44f5c4439e1a6de9c092131ac6d403d607180ed1ab8aba98bc435708e829c1bd06e5523f045376
|
7
|
+
data.tar.gz: be03c90191b725bdbc500cb6a246e4925b6d3fead3e4ef1fbed7ee2bf3070cf44ddcd256317b32ec189041e19fad7919831040cf391fd01dd7f18a9b0e21ed92
|
data/README.md
CHANGED
@@ -119,7 +119,7 @@ You can also generate a new security object at any time, although this will only
|
|
119
119
|
This is a generic button that can be added anywhere in your application and opens an instance of the File Picker. Once a user has chosen a file(s) and submitted, a callback will be executed, passing in the results. You can also pass in any options for the File Picker using the `pickerOptions` symbol:
|
120
120
|
|
121
121
|
```erb
|
122
|
-
<%= filestack_picker_element 'button test', 'callbackForButton', id: 'someuniqueid', input_id: 'someuniqueinputid', pickerOptions: { 'fromSources'
|
122
|
+
<%= filestack_picker_element 'button test', 'callbackForButton', id: 'someuniqueid', input_id: 'someuniqueinputid', pickerOptions: { 'fromSources': 'facebook', 'maxFiles': 50 } %>
|
123
123
|
```
|
124
124
|
File Picker options are exactly the same as in the Javscript SDK and can be found in the aforementioned documentation.
|
125
125
|
|
@@ -182,6 +182,19 @@ Filestack::Rails now has access to the full list of image transforms through our
|
|
182
182
|
```erb
|
183
183
|
<%= filestack_image @user.filepicker_url, transform: filestack_transform.resize(width:100, height:100).flip.enhance %>
|
184
184
|
```
|
185
|
+
|
186
|
+
You can also add attributes to `image_tag`, for instance:
|
187
|
+
```erb
|
188
|
+
<%= filestack_image @user.filepicker_url, size: "160x100", alt: "Picture" %>
|
189
|
+
```
|
190
|
+
|
191
|
+
### Fetching a converted Filestack image URL with Filestack Transformations:
|
192
|
+
The `filestack_image_url` method accepts the original Filestack image URL and an optional `filestack_transform` chain:
|
193
|
+
|
194
|
+
```erb
|
195
|
+
<%= image_tag @user.filepicker_url, data: { transformed_image_url: filestack_image_url(@user.filepicker_url, filestack_transform.resize(width: 100, height: 100).flip.enhance) } %>
|
196
|
+
```
|
197
|
+
|
185
198
|
## Migrating from 2.x to 3.x
|
186
199
|
Filestack::Rails 3.x is a significant and breaking change. Users wishing to upgrade will need to change their current implementation in order to use the plugin correctly.
|
187
200
|
|
@@ -201,6 +214,7 @@ The `filestack_image` tag wraps the generic Rails `image_tag` and generates a ne
|
|
201
214
|
```erb
|
202
215
|
<%= @user.filestack_url, transform: filestack_transform.resize(width:100, height:100).enhance %>
|
203
216
|
```
|
217
|
+
For a list of valid transformations, please see [here](https://www.filestack.com/docs/api/processing/).
|
204
218
|
|
205
219
|
### Ruby SDK
|
206
220
|
Filestack::Rails injects the Filestack Ruby SDK into your application for use anywhere. You can use it to access the rest of the Filestack API and find its documentation [here](https://github.com/filestack/filestack-ruby).
|
@@ -29,14 +29,15 @@ module FilestackRails
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def filestack_image(url, options = {})
|
32
|
-
transform_object = options
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
32
|
+
transform_object = options.delete(:transform)
|
33
|
+
|
34
|
+
image_tag(filestack_image_url(url, transform_object), options)
|
35
|
+
end
|
36
|
+
|
37
|
+
def filestack_image_url(url, transform_object = nil)
|
38
|
+
return url unless transform_object
|
39
|
+
transform_object.add_external_url(url)
|
40
|
+
transform_object.fs_url
|
40
41
|
end
|
41
42
|
|
42
43
|
private
|
@@ -78,11 +79,11 @@ module FilestackRails
|
|
78
79
|
signature = security.signature
|
79
80
|
policy = security.policy
|
80
81
|
end
|
81
|
-
[
|
82
|
+
[policy, signature]
|
82
83
|
end
|
83
84
|
|
84
85
|
def get_policy_and_signature_string
|
85
|
-
|
86
|
+
policy, signature = get_policy_and_signature
|
86
87
|
|
87
88
|
if policy && signature
|
88
89
|
get_filestack_js.security(signature, policy)
|
@@ -17,7 +17,7 @@ module FilestackRails
|
|
17
17
|
|
18
18
|
form_field_callback_guts = 'const filestack_input_field' \
|
19
19
|
"= document.getElementById('#{input_options[:id]}');" \
|
20
|
-
'filestack_input_field.value = data.filesUploaded
|
20
|
+
'filestack_input_field.value = data.filesUploaded.map(e => e.url);'
|
21
21
|
|
22
22
|
unless user_callback.nil?
|
23
23
|
form_field_callback_guts = "#{form_field_callback_guts}#{user_callback}(data)"
|
data/lib/filestack-rails.rb
CHANGED
@@ -3,6 +3,8 @@ require "filestack_rails/transform"
|
|
3
3
|
require "filestack_rails/engine"
|
4
4
|
require "filestack_rails/version"
|
5
5
|
require "filestack_rails/filestack_js"
|
6
|
+
require_relative "../app/helpers/filestack_rails/application_helper"
|
7
|
+
require_relative "../app/helpers/filestack_rails/form_helper"
|
6
8
|
|
7
9
|
module FilestackRails
|
8
10
|
# Your code goes here...
|
@@ -6,13 +6,17 @@ class Picker
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def filestack_js_url
|
9
|
-
"https://static
|
9
|
+
"https://static.#{domain}/filestack-js/#{version}/filestack.min.js"
|
10
10
|
end
|
11
11
|
|
12
12
|
def version
|
13
13
|
::Rails.application.config.filestack_rails.version
|
14
14
|
end
|
15
15
|
|
16
|
+
def domain
|
17
|
+
::Rails.application.config.filestack_rails.cname || 'filestackapi.com'
|
18
|
+
end
|
19
|
+
|
16
20
|
def picker(client_name, api_key, options, callback, other_callbacks = nil)
|
17
21
|
options_string = options[1..-2] # removed curly brackets help to generate pickerOptions in js
|
18
22
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: filestack-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- filestack
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-10-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 2.
|
33
|
+
version: 2.8.1
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 2.
|
40
|
+
version: 2.8.1
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: coveralls
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -57,6 +57,9 @@ dependencies:
|
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.3'
|
62
|
+
- - ">="
|
60
63
|
- !ruby/object:Gem::Version
|
61
64
|
version: 1.3.6
|
62
65
|
type: :development
|
@@ -64,6 +67,9 @@ dependencies:
|
|
64
67
|
version_requirements: !ruby/object:Gem::Requirement
|
65
68
|
requirements:
|
66
69
|
- - "~>"
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '1.3'
|
72
|
+
- - ">="
|
67
73
|
- !ruby/object:Gem::Version
|
68
74
|
version: 1.3.6
|
69
75
|
- !ruby/object:Gem::Dependency
|
@@ -117,7 +123,7 @@ homepage: https://www.filestack.com
|
|
117
123
|
licenses:
|
118
124
|
- MIT
|
119
125
|
metadata: {}
|
120
|
-
post_install_message:
|
126
|
+
post_install_message:
|
121
127
|
rdoc_options: []
|
122
128
|
require_paths:
|
123
129
|
- lib
|
@@ -132,9 +138,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
132
138
|
- !ruby/object:Gem::Version
|
133
139
|
version: '0'
|
134
140
|
requirements: []
|
135
|
-
|
136
|
-
|
137
|
-
signing_key:
|
141
|
+
rubygems_version: 3.0.8
|
142
|
+
signing_key:
|
138
143
|
specification_version: 4
|
139
144
|
summary: Filestack plugin for Rails 4+
|
140
145
|
test_files: []
|