<commit_before>filepickerio_rails
==================

[Filepicker.io](http://www.filepicker.io) is an easy way to upload files to web applications. Not only does it allow you to upload
from your local file system, but also from your connected cloud services. Services like Dropbox, Facebook, Flickr, Box.net, etc.

This gem makes for easier integration into the Rails environment, as is the basis of a CarrierWave gem, `carrierwave-filepickerio`.

Installation
------------

Add your Filepicker.io API Key to an initialiser (`config/initializer/filepickerio_rails.rb`):

```ruby
FilepickerioRails.configure do |config|
  config.api_key = '[YOUR API KEY FROM FILEPICKER.IO]'
end
```

Include the filepicker.io JavaScript library in your page (such as your application.html.erb layout):

```erb
    <%= javascript_include_tag "//api.filepicker.io/v0/filepicker.js" %>
```

... or, if you're not using the asset pipeline, you can use the expansion:

```erb
    <%= javascript_include_tag :filepickerio %>
```

Render Filepicker.io file upload and save fields using the form tag helper:

```erb
    <%= fp_file_field_tag :image_url, 'Pick file', 'http://example.com/existing-upload.jpg' %>
    <%= fp_file_field_tag :image_url, 'Pick file', 'http://example.com/existing-upload.jpg', 'image/jpg' %>
    <%= fp_file_field_tag :image_url, 'Pick file', 'http://example.com/existing-upload.jpg', 'image/jpg', { class: 'primary btn' } %>

    <%= fp_save_button 'Save to Dropbox', 'http://www.filepicker.io/static/img/success.png', 'image/jpg' %>
    <%= fp_save_button 'Save to Dropbox', 'http://www.filepicker.io/static/img/success.png', 'image/jpg', data: { 'fp-option-services' => 'DROPBOX' } %>
```

Or use the data-bound form builder methods, fp_file_field, fp_save_button:

```erb
    <%= form_for @entry do |f| %>
      <%= f.fp_file_field :image_url %>
      <%= f.fp_file_field :lolcat_image_url, "Upload lolcat" %>

      <%= f.fp_save_button :image_url, "Save existing image to cloud", 'image/jpg' %>
    <%- end %>
```

Filepicker.io Data Params
-------------------------

Pass a data hash as the last parameter to the helper methods to control the Filepicker.io widget.

See the documentation at [https://developers.filepicker.io/docs/web/](https://developers.filepicker.io/docs/web/)<commit_msg>Fixing bad spacing in README<commit_after>filepickerio_rails
==================

[Filepicker.io](http://www.filepicker.io) is an easy way to upload files to web applications. Not only does it allow you to upload
from your local file system, but also from your connected cloud services. Services like Dropbox, Facebook, Flickr, Box.net, etc.

This gem makes for easier integration into the Rails environment, as is the basis of a CarrierWave gem, `carrierwave-filepickerio`.

Installation
------------

Add your Filepicker.io API Key to an initialiser (`config/initializer/filepickerio_rails.rb`):

```ruby
FilepickerioRails.configure do |config|
  config.api_key = '[YOUR API KEY FROM FILEPICKER.IO]'
end
```

Include the filepicker.io JavaScript library in your page (such as your application.html.erb layout):

```erb
<%= javascript_include_tag "//api.filepicker.io/v0/filepicker.js" %>
```

... or, if you're not using the asset pipeline, you can use the expansion:

```erb
<%= javascript_include_tag :filepickerio %>
```

Render Filepicker.io file upload and save fields using the form tag helper:

```erb
<%= fp_file_field_tag :image_url, 'Pick file', 'http://example.com/existing-upload.jpg' %>
<%= fp_file_field_tag :image_url, 'Pick file', 'http://example.com/existing-upload.jpg', 'image/jpg' %>
<%= fp_file_field_tag :image_url, 'Pick file', 'http://example.com/existing-upload.jpg', 'image/jpg', { class: 'primary btn' } %>

<%= fp_save_button 'Save to Dropbox', 'http://www.filepicker.io/static/img/success.png', 'image/jpg' %>
<%= fp_save_button 'Save to Dropbox', 'http://www.filepicker.io/static/img/success.png', 'image/jpg', data: { 'fp-option-services' => 'DROPBOX' } %>
```

Or use the data-bound form builder methods, fp_file_field, fp_save_button:

```erb
<%= form_for @entry do |f| %>
  <%= f.fp_file_field :image_url %>
  <%= f.fp_file_field :lolcat_image_url, "Upload lolcat" %>

  <%= f.fp_save_button :image_url, "Save existing image to cloud", 'image/jpg' %>
<%- end %>
```

Filepicker.io Data Params
-------------------------

Pass a data hash as the last parameter to the helper methods to control the Filepicker.io widget.

See the documentation at [https://developers.filepicker.io/docs/web/](https://developers.filepicker.io/docs/web/)
{'fraction_non_alphanumeric': 0.1607181957521349, 'fraction_numerical': 0.0004379242391066346, 'mean_word_length': 4.244546498277842, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 29, 'https://': 4, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4055107', 'n_tokens_mistral': 1553, 'n_tokens_neox': 1440, 'n_words': 429}