Code Monkey home page Code Monkey logo

plupload-rails's Introduction

Rails Integration for Plupload

This gem integrates Plupload with Rails. It's been tested with Rails 3.1, 3.2 and 4.0.

Install

Just add it got your Gemfile:

gem 'plupload-rails'

Quick Start

Add to your application.js:

//= require moxie
//= require plupload.dev

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

// optional, but recommended. it sets generic settings like flash url, etc.
//= require plupload.settings

// optional, only if you want to use the jquery integration
//= require jquery.plupload.queue

Add to your application stylesheet:

//= require 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}',
        '#{Rails.application.config.session_options[:key]}': '#{request.session_options[:id]}'
      }
    });
  });

And the same in ERB:

<script>
  $(function(){
    $("#uploader").pluploadQueue({
      runtimes: 'html5,flash,silverlight',
      url: '<%= sink_hole_path %>',
      multipart_params: {
        '<%= request_forgery_protection_token %>': '<%= form_authenticity_token %>',
        '<%= Rails.application.config.session_options[:key] %>': '<%= request.session_options[:id] %>'
      }
    });
  });
</script>

Updating

When new versions of Plupload are released, simply update the gem to the latest version. When you notice that there's no gem for the latest plupload, please contact me (or even better, create an issue/ pull request).

License

Dual licensed under the GPLv2 license and the MIT license. Plupload itself (including the JS, CSS, images, the Silverlight and Flash components) is licensed under GPLv2, unless you have acquired a commercial license.

Copyright © 2011-2013 Corin Langosch and contributors

plupload-rails's People

Contributors

cmer avatar gucki avatar gunn avatar holli avatar kirs avatar layerssss avatar lucasrenan avatar marekstachura avatar matiaskorhonen avatar sutherland avatar whitehat101 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.