filestack-rails 5.2.2 → 5.5.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
- SHA1:
3
- metadata.gz: 03deb768c0ee4f31c0a11781d56d0dadb0090da1
4
- data.tar.gz: 9265247c1324245bd47c4125e073559cdd868916
2
+ SHA256:
3
+ metadata.gz: 7ca741bc092f71bd5c934ba46687776c0374da34fb8e9e70621ee06ff55f8ab6
4
+ data.tar.gz: c0dae7dd0c040c8d112b5396d3a3d727aeb36699331800a142eed76325ca8c03
5
5
  SHA512:
6
- metadata.gz: 97689af0a9f6784f8f3e1cc580333da3f7109d3ab21fb0db6213b6bb4306dd098421592d1d0d877a982350a2567817224735d578079de9b3e8f0b734da2b6d19
7
- data.tar.gz: 0ddb1a9cd797f27ff48b14a3e9ce7d076e853c102c1b6bcc4e37bf3c63968b2119f429c24f2ddbf97bada706d29438b2f75a88c40c8113117f0ac19e8de6ec33
6
+ metadata.gz: 378bb6f90dc02a6fcb3f331bdc77acf67ae6e3832607604e815f21e0a4d13930cb54ee66f48d8828622ae33c01be2f0d193f9d3e11d16138d1b41340b6cac88e
7
+ data.tar.gz: 737d7021864a2b5dd96f94643c3fa8f0a14de042501392254e8afeaa5c432b028590e0449cc32a8379dc18a6d41906883f1ab427dc3540c9f13a73cc91237f8e
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' => 'facebook' } %>
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
 
@@ -188,6 +188,13 @@ You can also add attributes to `image_tag`, for instance:
188
188
  <%= filestack_image @user.filepicker_url, size: "160x100", alt: "Picture" %>
189
189
  ```
190
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
+
191
198
  ## Migrating from 2.x to 3.x
192
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.
193
200
 
@@ -29,14 +29,15 @@ module FilestackRails
29
29
  end
30
30
 
31
31
  def filestack_image(url, options = {})
32
- transform_object = options[:transform]
33
- options.delete(:transform)
34
- if transform_object
35
- transform_object.add_external_url url
36
- image_tag transform_object.fs_url, options
37
- else
38
- image_tag url, options
39
- end
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
- [signature, policy]
82
+ [policy, signature]
82
83
  end
83
84
 
84
85
  def get_policy_and_signature_string
85
- signature, policy = get_policy_and_signature
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[0].url;'
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)"
@@ -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...
@@ -1,3 +1,3 @@
1
1
  module FilestackRails
2
- VERSION = '5.2.2'
2
+ VERSION = '5.5.0'
3
3
  end
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.2.2
4
+ version: 5.5.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: 2020-02-06 00:00:00.000000000 Z
11
+ date: 2021-03-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -30,14 +30,20 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 2.6.5
33
+ version: '2.9'
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: 2.9.1
34
37
  type: :runtime
35
38
  prerelease: false
36
39
  version_requirements: !ruby/object:Gem::Requirement
37
40
  requirements:
38
41
  - - "~>"
39
42
  - !ruby/object:Gem::Version
40
- version: 2.6.5
43
+ version: '2.9'
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 2.9.1
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: coveralls
43
49
  requirement: !ruby/object:Gem::Requirement
@@ -123,7 +129,7 @@ homepage: https://www.filestack.com
123
129
  licenses:
124
130
  - MIT
125
131
  metadata: {}
126
- post_install_message:
132
+ post_install_message:
127
133
  rdoc_options: []
128
134
  require_paths:
129
135
  - lib
@@ -138,9 +144,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
138
144
  - !ruby/object:Gem::Version
139
145
  version: '0'
140
146
  requirements: []
141
- rubyforge_project:
142
- rubygems_version: 2.6.14
143
- signing_key:
147
+ rubygems_version: 3.0.8
148
+ signing_key:
144
149
  specification_version: 4
145
150
  summary: Filestack plugin for Rails 4+
146
151
  test_files: []