0.0
No commit activity in last 3 years
No release in over 3 years
This gem integrates Plupload 1.5.7 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
 Dependencies

Development

~> 1.3
>= 0

Runtime

~> 4.0.0
 Project Readme

Rails 4.0 Integration for Plupload

This gem integrates Plupload with the Rails 4.0 asset pipeline.

Install

Just add it got your Gemfile:

gem 'plupload-rails4'

Quick Start

Add to your application.js:

//= require jquery_plupload/plupload
// optional, only needed if you'd like to use plupload localized
//= require jquery_plupload/i18n/de

// optional, only if you want to use the jquery integration
//= require jquery_plupload/jquery.plupload.queue
// optional, choose the ones you'd like to use
//= require jquery_plupload/plupload.flash
//= require jquery_plupload/plupload.silverlight
//= require jquery_plupload/plupload.html4
//= require jquery_plupload/plupload.html5
//= require jquery_plupload/plupload.gears
//= require jquery_plupload/plupload.browserplus

Add to your application.scss:

/*
 *= require jquery_plupload/jquery.plupload.queue
 */

Simple example haml for your views:

  div#uploader
  javascript:
    $(function(){
      $("#uploader").pluploadQueue({
        runtimes: 'gears,flash,silverlight,browserplus,html5',
        url: '#{images_path}',
        multipart_params: {
          '#{request_forgery_protection_token}': '#{form_authenticity_token}',
          '#{request.session_options[:key]}': '#{request.session_options[:id]}'
        }
      });
    });

ERB example

<script>
  <% session_key_name = Rails.application.config.session_options[:key] %>
  $(function() {
    $("#uploader").pluploadQueue({
      runtimes: 'html5,flash,silverlight',
      url: "<%= attachments_path %>",
      max_file_size: '20mb',
      multiple_queues: true,
      flash_swf_url: "/assets/jquery_plupload/plupload.flash.swf",
      silverlight_xap_url: "/assets/jquery_plupload/plupload.silverlight.xap",
      multipart: true,
      multipart_params: {
        '_http_accept': 'application/javascript',
        'authenticity_token' : "<%= form_authenticity_token %>",
        "<%= session_key_name %>" : encodeURIComponent("<%= u cookies[session_key_name] %>")
      },

      init: {
        FileUploaded: function(up, file, info) {
          eval(info["response"]);
        }
      }
    });
  });
</script>

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