Skip to content

askehansen/rails_filemanager

Repository files navigation

RailsFilemanager

This is a filemanager for ruby on rails. It works right away with CKEditor.

See demo at: filemanager-demo.herokuapp.com

Getting Started

  1. Add this to your gemfile:

    gem "rails_filemanager"
    
  2. Run the generator:

    rails generate rails_filemanager:install
    rake db:migrate
    
  3. Now mount the filemanager in your routes:

    # config/routes.rb
    
    mount RailsFilemanager::Engine => "/filemanager"
    

You can now find the filemanager at /filemanager

Configuration

Authorization

Use the method check_authorization to ensure that a user is logged in:

# config/initializers/rails_filemanager.rb

def check_authorization
    raise "unauthorized" unless session[:admin]
end

Storage

The filemanager uses paperclip for storing the files. You can use your own storage options, if you want to use amazon s3 for instance:

# config/initializers/rails_filemanager.rb

RailsFilemanager::Engine.config.paperclip_storage_options = {
    storage: :s3,
    bucket: "static.example.com",
    s3_host_alias: "static.example.com",
    url: ":s3_alias_url",
    path: ":attachment/:id/:style/:basename.:extension",
    s3_credentials: {
        access_key_id: "ACCESSKEY",
        secret_access_key: "SECRET"
    }
}

Translation

The default translation is:

rails_filemanager:
  upload: "Upload files"
  delete: "Delete %{filename}?"

Say, if your app speaks spanish, you could use this example:

# config/locales/es.yml

rails_filemanager:
  upload: "Upload archivos"
  delete: "¿Eliminar %{filename}?"

Roadmap

  • Organize in folders

  • Custom javascript callback

  • Adding unit tests

License

This project rocks and uses MIT-LICENSE. <<<<<<< HEAD

Uploadify: www.uploadify.com/mit-license/

Paperclip: github.com/thoughtbot/paperclip#license

>>>>>>> baf16fe1f2677143989f07591bd3b265dcd2b844

About

This is a filemanager made for integration with CKEeditor

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published