filepickerio_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 CHANGED
@@ -1,40 +1,55 @@
1
1
  filepickerio_rails
2
2
  ==================
3
3
 
4
+ [Filepicker.io](http://www.filepicker.io) is an easy way to upload files to web applications. Not only does it allow you to upload
5
+ from your local file system, but also from your connected cloud services. Services like Dropbox, Facebook, Flickr, Box.net, etc.
6
+
7
+ This gem makes for easier integration into the Rails environment, as is the basis of a CarrierWave gem, `carrierwave-filepickerio`.
8
+
4
9
  Installation
5
10
  ------------
6
11
 
7
12
  Add your Filepicker.io API Key to an initialiser (`config/initializer/filepickerio_rails.rb`):
8
13
 
9
- FilepickerioRails.configure do |config|
10
- config.api_key = '[YOUR API KEY FROM FILEPICKER.IO]'
11
- end
14
+ ```ruby
15
+ FilepickerioRails.configure do |config|
16
+ config.api_key = '[YOUR API KEY FROM FILEPICKER.IO]'
17
+ end
18
+ ```
12
19
 
13
20
  Include the filepicker.io JavaScript library in your page (such as your application.html.erb layout):
14
21
 
15
- <%= javascript_include_tag "//api.filepicker.io/v0/filepicker.js" %>
22
+ ```erb
23
+ <%= javascript_include_tag "//api.filepicker.io/v0/filepicker.js" %>
24
+ ```
16
25
 
17
26
  ... or, if you're not using the asset pipeline, you can use the expansion:
18
27
 
19
- <%= javascript_include_tag :filepickerio %>
28
+ ```erb
29
+ <%= javascript_include_tag :filepickerio %>
30
+ ```
20
31
 
21
- Render a Filepicker.io file upload and save fields using the form tag helper:
32
+ Render Filepicker.io file upload and save fields using the form tag helper:
22
33
 
23
- <%= fp_file_field_tag :image_url, 'Pick file', 'http://example.com/existing-upload.jpg' %>
24
- <%= fp_file_field_tag :image_url, 'Pick file', 'http://example.com/existing-upload.jpg', 'image/jpg' %>
25
- <%= fp_file_field_tag :image_url, 'Pick file', 'http://example.com/existing-upload.jpg', 'image/jpg', { class: 'primary btn' } %>
34
+ ```erb
35
+ <%= fp_file_field_tag :image_url, 'Pick file', 'http://example.com/existing-upload.jpg' %>
36
+ <%= fp_file_field_tag :image_url, 'Pick file', 'http://example.com/existing-upload.jpg', 'image/jpg' %>
37
+ <%= fp_file_field_tag :image_url, 'Pick file', 'http://example.com/existing-upload.jpg', 'image/jpg', { class: 'primary btn' } %>
26
38
 
27
- <%= fp_save_button 'Save to Dropbox', 'http://www.filepicker.io/static/img/success.png', 'image/jpg' %>
28
- <%= fp_save_button 'Save to Dropbox', 'http://www.filepicker.io/static/img/success.png', 'image/jpg', data: { 'fp-option-services' => 'DROPBOX' } %>
39
+ <%= fp_save_button 'Save to Dropbox', 'http://www.filepicker.io/static/img/success.png', 'image/jpg' %>
40
+ <%= fp_save_button 'Save to Dropbox', 'http://www.filepicker.io/static/img/success.png', 'image/jpg', data: { 'fp-option-services' => 'DROPBOX' } %>
41
+ ```
29
42
 
30
43
  Or use the data-bound form builder methods, fp_file_field, fp_save_button:
31
44
 
32
- <%= form_for @entry do |f| %>
33
- <%= f.fp_file_field :image_url %>
34
- <%= f.fp_file_field :lolcat_image_url, "Upload lolcat" %>
45
+ ```erb
46
+ <%= form_for @entry do |f| %>
47
+ <%= f.fp_file_field :image_url %>
48
+ <%= f.fp_file_field :lolcat_image_url, "Upload lolcat" %>
35
49
 
36
- <%= f.fp_save_button :image_url, "Save existing image to cloud", 'image/jpg' %>
37
- <%- end %>
50
+ <%= f.fp_save_button :image_url, "Save existing image to cloud", 'image/jpg' %>
51
+ <%- end %>
52
+ ```
38
53
 
39
54
  Filepicker.io Data Params
40
55
  -------------------------
@@ -34,7 +34,14 @@ module FilepickerioRails
34
34
  fp_file_field(object_name, nil, text, options)
35
35
  end
36
36
 
37
- def fp_file_field(object_name, method, text, options)
37
+ def fp_file_field(object_name, method, text_or_options, options)
38
+ if text_or_options.is_a? Hash
39
+ text = nil
40
+ options = text_or_options
41
+ else
42
+ text = text_or_options
43
+ end
44
+
38
45
  dragdrop = options[:dragdrop] && options[:dragdrop] == true
39
46
 
40
47
  input_type = if dragdrop
@@ -100,7 +107,7 @@ module FilepickerioRails
100
107
  private
101
108
 
102
109
  def fp_api_key
103
- raise "Filepicker.io API Key not set. Check config/initializer/filepickerio_rails.rb" if !FilepickerioRails.config.api_key
110
+ raise "Filepicker.io API Key not set" if !FilepickerioRails.config.api_key
104
111
  FilepickerioRails.config.api_key
105
112
  end
106
113
 
@@ -1,3 +1,3 @@
1
1
  module FilepickerioRails
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -5,14 +5,6 @@ rescue LoadError
5
5
  #do nothing
6
6
  end
7
7
 
8
- $stderr.puts <<-EOC if !defined?(Rails)
9
- warning: no framework detected.
10
- would you check out if your Gemfile appropriately configured?
11
- ---- e.g. ----
12
- when Rails:
13
- gem 'filepickerio_rails'
14
- EOC
15
-
16
8
  require "filepickerio_rails/version"
17
9
  require 'filepickerio_rails/configuration'
18
10
  require 'filepickerio_rails/railtie' if defined?(Rails)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: filepickerio_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-15 00:00:00.000000000 Z
12
+ date: 2012-09-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70225434735840 !ruby/object:Gem::Requirement
16
+ requirement: &70276161113600 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70225434735840
24
+ version_requirements: *70276161113600
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec-rails
27
- requirement: &70225434735260 !ruby/object:Gem::Requirement
27
+ requirement: &70276161113040 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70225434735260
35
+ version_requirements: *70276161113040
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rails
38
- requirement: &70225434734180 !ruby/object:Gem::Requirement
38
+ requirement: &70276161112420 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70225434734180
46
+ version_requirements: *70276161112420
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: railties
49
- requirement: &70225434732980 !ruby/object:Gem::Requirement
49
+ requirement: &70276161111760 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '3.1'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70225434732980
57
+ version_requirements: *70276161111760
58
58
  description: Rails view helpers for Filepicker.io widgets
59
59
  email:
60
60
  - adam.burmister@gmail.com
@@ -91,7 +91,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
91
91
  version: '0'
92
92
  segments:
93
93
  - 0
94
- hash: -1270750157206818046
94
+ hash: -4076320744515293650
95
95
  required_rubygems_version: !ruby/object:Gem::Requirement
96
96
  none: false
97
97
  requirements:
@@ -100,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
100
  version: '0'
101
101
  segments:
102
102
  - 0
103
- hash: -1270750157206818046
103
+ hash: -4076320744515293650
104
104
  requirements: []
105
105
  rubyforge_project: filepickerio_rails
106
106
  rubygems_version: 1.8.15