filepicker-rails 1.4.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b84369b54427063911d87d865e6e982912b6536
|
4
|
+
data.tar.gz: 1735e9671044f54eaf076b358c5397b41a14e4be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b18582c1c14ba2cbb2f4674d9ca26e12b65f29fe432d743790f486875265a5a6cdcd6e8744de26f82e28f896e874a4f1486ae8972d1dbae48d8deb5c7595b01e
|
7
|
+
data.tar.gz: f199fd9c056a9c30203ce25f81cfba3687b4b1261949af4af56e7b95e35b5624f5a8063d53bf4658c6f9299f21056503ac8e17d6d08d0a6e412db1d4a14b07e9
|
@@ -10,7 +10,7 @@ module FilepickerRails
|
|
10
10
|
# filepicker_js_include_tag
|
11
11
|
# # => <script src="//api.filepicker.io/v1/filepicker.js"></script>
|
12
12
|
def filepicker_js_include_tag
|
13
|
-
javascript_include_tag "//api.filepicker.io/
|
13
|
+
javascript_include_tag "//api.filepicker.io/v2/filepicker.js", type: "text/javascript"
|
14
14
|
end
|
15
15
|
|
16
16
|
# Creates a filepicker field tag, accepts optional `options` hash for configuration.
|
@@ -179,22 +179,17 @@ module FilepickerRails
|
|
179
179
|
end
|
180
180
|
|
181
181
|
def execute
|
182
|
-
|
183
|
-
|
184
|
-
else
|
185
|
-
cdn_url
|
186
|
-
end
|
187
|
-
|
188
|
-
query_params = all_options.merge(policy_config).to_query
|
182
|
+
base_url = url_with_path.split('?').first
|
183
|
+
query_params = all_options.to_query
|
189
184
|
|
190
|
-
[
|
185
|
+
[base_url, query_params.presence].compact.join('?')
|
191
186
|
end
|
192
187
|
|
193
188
|
private
|
194
189
|
|
195
190
|
attr_reader :url, :options
|
196
191
|
|
197
|
-
def
|
192
|
+
def valid_options
|
198
193
|
options.select { |option| VALID_OPTIONS.include?(option) }
|
199
194
|
end
|
200
195
|
|
@@ -202,8 +197,22 @@ module FilepickerRails
|
|
202
197
|
options.select { |option| CONVERT_OPTIONS.include?(option) }
|
203
198
|
end
|
204
199
|
|
200
|
+
def all_options
|
201
|
+
[original_url_options, valid_options, policy_config].inject(&:merge)
|
202
|
+
end
|
203
|
+
|
204
|
+
def original_url_options
|
205
|
+
query_string = url_with_path.split('?')[1]
|
206
|
+
|
207
|
+
if query_string
|
208
|
+
Rack::Utils.parse_nested_query(query_string)
|
209
|
+
else
|
210
|
+
{}
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
205
214
|
def cdn_host
|
206
|
-
::Rails.application.config.filepicker_rails.cdn_host
|
215
|
+
@cdn_host ||= ::Rails.application.config.filepicker_rails.cdn_host
|
207
216
|
end
|
208
217
|
|
209
218
|
def cdn_url
|
@@ -218,6 +227,18 @@ module FilepickerRails
|
|
218
227
|
def policy_config
|
219
228
|
Policy.apply
|
220
229
|
end
|
230
|
+
|
231
|
+
def url_with_path
|
232
|
+
@url_with_path ||= if append_convert_on_url_path?
|
233
|
+
"#{cdn_url}/convert"
|
234
|
+
else
|
235
|
+
cdn_url
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
239
|
+
def append_convert_on_url_path?
|
240
|
+
convert_options.any? && !cdn_url.match('/convert')
|
241
|
+
end
|
221
242
|
end
|
222
243
|
private_constant :FilepickerImageUrl
|
223
244
|
|
data/lib/filepicker_rails/tag.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: filepicker-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Max Tilford
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -174,7 +174,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
174
174
|
version: '0'
|
175
175
|
requirements: []
|
176
176
|
rubyforge_project:
|
177
|
-
rubygems_version: 2.
|
177
|
+
rubygems_version: 2.2.2
|
178
178
|
signing_key:
|
179
179
|
specification_version: 4
|
180
180
|
summary: Makes integrating filepicker.io with rails 4 easy
|