Skip to content
This repository has been archived by the owner on Oct 23, 2020. It is now read-only.

makkrnic/rails-filemanager-ajax

Repository files navigation

RailsFilemanager

RailsFilemanager ajax is a mountable engine aiming to provide simple integration with existing application needing a file manager.

Currently it supports file owners and owners' maximum storage space. The files are organized in a tree-like structure.

NOTE: As this gem is in active development, this readme is given primarily as a reminder for myself since most of the stuff described will change daily.

Instalation

Add this line to your Gemfile

gem 'rails_filemanager_ajax', git: "https://github.com/makkrnic/rails-filemanager-ajax.git"

Mount the engine

mount RailsFilemanager::Engine => "/rails_filemanager"

Run the migrations

bundle exec rake rails_filemanager:install:migrations
bundle exec rake db:migrate

In the ApplicationController define the method current_owner. This will change in the future.

An example of such method is:

def current_owner
    Owner.find_by params[:owner_id]
end

In the model you want to be owner of files add the following snippet:

include RailsFilemanager::ActsAsFilemanagerOwner

acts_as_filemanager_owner storage_limit_method: :my_method

And, of course, define the method you want to use.

User authorization

If you want to allow or deny file managing, you should implement the method user_can_manage_files? in your application controller.

In the future, that will be changed to something smarter.

TODO

  • tests

About

Advanced file manager for rails

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published