No commit activity in last 3 years
No release in over 3 years
This gem integrates Dropzonejs with the Rails 4.0 asset pipeline.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 1.3
>= 0

Runtime

~> 4.0.0
 Project Readme

Dropzonejs::Rails4

Integrate Matias Meno's Dropzone awesome file upload JS library right into the Asset pipeline of your Rails apps.

Installation and usage

First add dropzonejs-rails4 to your Gemfile and, as you already know, bundle it and then restart your Rails app:

# On your Gemfile
gem 'dropzonejs-rails4'
$ bundle install

After that, you need to make dropzone.js available on your pages. To do that, you can add it to your application.js file, like this:

//= require dropzonejs/dropzone

And if you would like to use one of the styles bundled with Dropzone, add to your application.css:

*= require dropzonejs/dropzone/basic

or

*= require dropzonejs/dropzone/dropzone

And that, add code to view

The typical way of using dropzone is by creating a form element with the class dropzone

<form action="/file-upload" class="dropzone" id="my-awesome-dropzone"></form>

Alternatively you can create dropzones programmaticaly (even on non form elements) by instantiating the Dropzone class

html

<form action="/file-upload" class="dropzone">
  <div class="fallback">
    <input name="file" type="file" multiple />
  </div>
</form>

javascript

// Dropzone class:
var myDropzone = new Dropzone("div#myId", { url: "/file/post"});

or if you use jQuery, you can use the jQuery plugin Dropzone ships with:

// jQuery
$("div#myId").dropzone({ url: "/file/post" });

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request