Code Monkey home page Code Monkey logo

rails_admin_dropzone's Introduction

Custom Action to RailsAdmin with Dropzone.js Multiple File Upload

Gem Version

Easy to use integration of drag&drop files upload via dropzone.js for rails_admin

Screenshot

Dropzone

Imgur

Upload images

Imgur

How to use

Add in Gemfile

gem 'rails_admin_dropzone'

IMPORTANT:

  • Test with rails < 5 and TurboLink < 5
class Album < ActiveRecord::Base
  has_many :photos
end

class Photo < ActiveRecord::Base
  belongs_to :album
end

Add this method create_associated_image in your model, example Album, that will contain the upload images and change the associations and attributes

class Album < ActiveRecord::Base
  has_many :photos

  # Method
  def create_associated_image(image)
    photos.create(image: image)
  end
end

Add in config/initialisers/rails_admin.rb

RailsAdmin.config do |config|
  config.actions do
    dashboard
    index
    new

    dropzone do
      only YOUR_MODEL # Example Album
    end

    show
    edit
    delete
  end
end

and "Voalá"

TODO

  • Adjustments to work with Turbolinks 5

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/luizpicolo/rails_admin_dropzone. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

rails_admin_dropzone's People

Contributors

andreeaene avatar ankit123rudra avatar barmidrol avatar bryanjhv avatar bszala avatar dasio avatar divayprakash avatar dosten avatar fortrieb avatar hamdi777 avatar i-am-me avatar itaisteinherz avatar ivanorsolic avatar justthegame avatar luizpicolo avatar lyxnx avatar martijnpold avatar mrancys avatar natetheriver avatar nemfoz avatar omeryagmurlu avatar p0v1n0m avatar pish4 avatar robiathin avatar rossiza avatar sacret avatar sarkkisjuha avatar

Watchers

 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.