filepicker-rails 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +6 -1
- data/lib/filepicker/rails/form_builder.rb +6 -0
- data/lib/filepicker/rails/version.rb +1 -1
- data/lib/filepicker/rails/view_helpers.rb +8 -11
- metadata +57 -35
data/README.md
CHANGED
@@ -38,17 +38,22 @@ Set your API Key in config/application.rb:
|
|
38
38
|
<% end %>
|
39
39
|
|
40
40
|
Full options list:
|
41
|
+
|
41
42
|
* button_text - The text of the upload button.
|
42
43
|
* button_class - The class of the upload button.
|
43
44
|
* mimetypes - The file types you want to support for this upload. Ex: "image/png,text/*"
|
44
45
|
* container - Where to show the file picker dialog can be "modal", "window" or the
|
45
46
|
of an iframe on the page.
|
46
47
|
* services - What services your users can upload to. Ex: "BOX, COMPUTER, FACEBOOK".
|
48
|
+
* dragdrop - (true or false) Whether or not to all drag-and-drop uploads
|
49
|
+
* drag_text - The text of the dragdrop pane.
|
50
|
+
* drag_class - The class of the dragdrop pane.
|
51
|
+
* onchange - The onchange event
|
47
52
|
|
48
53
|
|
49
54
|
### Displaying an image:
|
50
55
|
|
51
|
-
<%= filepicker_image_tag @user.avatar_url, w: 160, h: 160, fit: 'clip'
|
56
|
+
<%= filepicker_image_tag @user.avatar_url, w: 160, h: 160, fit: 'clip' %>
|
52
57
|
|
53
58
|
See [the filepicker.io documentation](https://developers.filepicker.io/docs/web/#fpurl-images) for the full options list.
|
54
59
|
|
@@ -18,6 +18,12 @@ module Filepicker
|
|
18
18
|
'data-fp-option-multiple' => false,
|
19
19
|
|
20
20
|
'data-fp-option-services' => Array(options[:services]).join(","),
|
21
|
+
|
22
|
+
'data-fp-drag-text' => options.fetch(:drag_text, "Or drop files here"),
|
23
|
+
|
24
|
+
'data-fp-drag-class' => options[:drag_class],
|
25
|
+
|
26
|
+
'onchange' => options[:onchange]
|
21
27
|
}
|
22
28
|
|
23
29
|
type = options[:dragdrop] ? 'filepicker-dragdrop' : 'filepicker'
|
@@ -3,7 +3,7 @@ module Filepicker
|
|
3
3
|
|
4
4
|
module ViewHelpers
|
5
5
|
def filepicker_js_include_tag
|
6
|
-
javascript_include_tag "//api.filepicker.io/
|
6
|
+
javascript_include_tag "//api.filepicker.io/v1/filepicker.js"
|
7
7
|
end
|
8
8
|
|
9
9
|
def filepicker_save_button(text, url, mimetype, options = {})
|
@@ -21,18 +21,15 @@ module Filepicker
|
|
21
21
|
button_tag(text, options)
|
22
22
|
end
|
23
23
|
|
24
|
-
|
24
|
+
# Allows options to be passed to filepicker_image_url and then falls back to normal Rails options for image_tag
|
25
|
+
# If specifying html width, height, pass it down to filepicker for optimization
|
25
26
|
def filepicker_image_tag(url, options={})
|
26
|
-
image_tag(filepicker_image_url(url, options),
|
27
|
-
width: options[:w],
|
28
|
-
height: options[:h],
|
29
|
-
|
30
|
-
alt: options[:alt])
|
27
|
+
image_tag(filepicker_image_url(url, options), options)
|
31
28
|
end
|
32
29
|
|
33
|
-
#
|
30
|
+
# width - Resize the image to this width.
|
34
31
|
#
|
35
|
-
#
|
32
|
+
# height - Resize the image to this height.
|
36
33
|
#
|
37
34
|
# fit - Specifies how to resize the image. Possible values are:
|
38
35
|
# clip: Resizes the image to fit within the specified parameters without
|
@@ -42,6 +39,7 @@ module Filepicker
|
|
42
39
|
# scales: Resizes the image to fit the specified parameters exactly by
|
43
40
|
# scaling the image to the desired size
|
44
41
|
# Defaults to "clip".
|
42
|
+
# align - Determines how the image is aligned when resizing and using the "fit" parameter. Check API for details.
|
45
43
|
#
|
46
44
|
# crop - Crops the image to a specified rectangle. The input to this parameter
|
47
45
|
# should be 4 numbers for 'x,y,width,height' - for example,
|
@@ -68,8 +66,7 @@ module Filepicker
|
|
68
66
|
# and horizontal with a comma. The default behavior
|
69
67
|
# is bottom,right
|
70
68
|
def filepicker_image_url(url, options = {})
|
71
|
-
query_params = options.slice(:
|
72
|
-
:watermark,:watersize,:waterposition).to_query
|
69
|
+
query_params = options.slice(:width, :height, :fit, :align, :crop, :format, :quality, :watermark, :watersize, :waterposition).to_query
|
73
70
|
[url, "/convert?", query_params].join
|
74
71
|
end
|
75
72
|
|
metadata
CHANGED
@@ -1,45 +1,55 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: filepicker-rails
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- Max Tilford
|
9
14
|
autorequire:
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
17
|
+
|
18
|
+
date: 2012-12-01 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
15
21
|
name: railties
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ! '>='
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: 3.1.0
|
22
|
-
- - <
|
23
|
-
- !ruby/object:Gem::Version
|
24
|
-
version: '5.0'
|
25
|
-
type: :runtime
|
26
22
|
prerelease: false
|
27
|
-
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
28
24
|
none: false
|
29
|
-
requirements:
|
30
|
-
- -
|
31
|
-
- !ruby/object:Gem::Version
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 3
|
29
|
+
segments:
|
30
|
+
- 3
|
31
|
+
- 1
|
32
|
+
- 0
|
32
33
|
version: 3.1.0
|
33
34
|
- - <
|
34
|
-
- !ruby/object:Gem::Version
|
35
|
-
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
hash: 31
|
37
|
+
segments:
|
38
|
+
- 5
|
39
|
+
- 0
|
40
|
+
version: "5.0"
|
41
|
+
type: :runtime
|
42
|
+
version_requirements: *id001
|
36
43
|
description: Makes integrating filepicker.io with rails easy
|
37
|
-
email:
|
44
|
+
email:
|
38
45
|
- maxtilford@gmail.com
|
39
46
|
executables: []
|
47
|
+
|
40
48
|
extensions: []
|
49
|
+
|
41
50
|
extra_rdoc_files: []
|
42
|
-
|
51
|
+
|
52
|
+
files:
|
43
53
|
- .gitignore
|
44
54
|
- Gemfile
|
45
55
|
- LICENSE
|
@@ -54,26 +64,38 @@ files:
|
|
54
64
|
- lib/filepicker/rails/view_helpers.rb
|
55
65
|
homepage: https://github.com/maxtilford/filepicker-rails
|
56
66
|
licenses: []
|
67
|
+
|
57
68
|
post_install_message:
|
58
69
|
rdoc_options: []
|
59
|
-
|
70
|
+
|
71
|
+
require_paths:
|
60
72
|
- lib
|
61
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
73
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
62
74
|
none: false
|
63
|
-
requirements:
|
64
|
-
- -
|
65
|
-
- !ruby/object:Gem::Version
|
66
|
-
|
67
|
-
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
hash: 3
|
79
|
+
segments:
|
80
|
+
- 0
|
81
|
+
version: "0"
|
82
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
83
|
none: false
|
69
|
-
requirements:
|
70
|
-
- -
|
71
|
-
- !ruby/object:Gem::Version
|
84
|
+
requirements:
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
hash: 23
|
88
|
+
segments:
|
89
|
+
- 1
|
90
|
+
- 3
|
91
|
+
- 6
|
72
92
|
version: 1.3.6
|
73
93
|
requirements: []
|
94
|
+
|
74
95
|
rubyforge_project:
|
75
96
|
rubygems_version: 1.8.24
|
76
97
|
signing_key:
|
77
98
|
specification_version: 3
|
78
99
|
summary: Makes integrating filepicker.io with rails easy
|
79
100
|
test_files: []
|
101
|
+
|