Giter VIP home page Giter VIP logo

rails_admin_multiple_file_upload's Introduction

RailsAdminMultipleFileUpload

rails_admin + dropzone.js + mongoid(embedded)

Installation

Add this line to your application's Gemfile:

gem 'rails_admin_multiple_file_upload', '~> 0.4.3'

And then execute:

$ bundle

Usage with rails_admin

Add the sort_embedded action for each model or only for models you need

    RailsAdmin.config do |config|
      config.actions do
        ......
        multiple_file_upload do
          visible do
            %w(Page).include? bindings[:abstract_model].model_name
          end
        end
      end
    end

In embedded model:

    has_mongoid_attached_file :image, styles: {main: "1000x1000>"}

In rails_admin block for parent model:

    multiple_file_upload(
        {
            fields: [:my_news_images],
            thumbnail_size: :main #default :thumb
        }
    )

In config/locales/* :

I18n:

    ru:
      rails_admin:
        multiple_file_upload:
          my_news:
            my_news_images: Фотогалерея

    # or with specified fields
    ru:
      rails_admin:
        multiple_file_upload:
          my_news:
            my_news_images:
              image: Фотогалерея
              image2: Фотогалерея вторая

Copy and paste support

After clicking on grey area around dropzone block You can use clipboard. You can paste screenshots (or any images if clipboard) and URL. System add it to dropzone as image (if it`s a really image)

TODO

  • Documentation fixes
  • Carrierwave support
  • More configs
  • Style
  • Find and fix bugs. I am sure, bugs are here

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

Credits

Some ideas and code for this gem are taken from:

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.