Project

fs_browser

0.0
No commit activity in last 3 years
No release in over 3 years
rails 3 engine to create a modal window to browse the server file system
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

~> 3.2.13
 Project Readme

Filesystem Browser

This is a rails 3 engine that allows your to browse the filesystem via a modal window on the browser, simulating the operative system file open window. It relies on twitter bootstrap modal javascript.

modal example

Demo

You can view a demo of the modal window by starting the rails app in spec/dummy.

Usage

Add the gem to your rails app Gemfile:

gem 'fs_browser'

and run the bundle command:

bundle

Add the gem asset manifests: in your rails app application.js add:

//= require fs_browser/application

same goes in your rails app application.css:

*= require fs_browser/application

Include the modal html in any view of your application:

<%= render 'fs_browser/modal' %>

To start the modal window use the following javascript code:

FsBrowser.Modal.init();

Event Callbacks

There are a few builtin callbacks available when interacting with the modal window:

  • single click on a filesystem entry triggers FsBrowser.Callbacks.entryClick(event, entry)
  • double click on a filesystem entry triggers FsBrowser.Callbacks.entryDblClick(event, entry)
  • click on the submit button triggers FsBrowser.Callbacks.modalSubmit(event)

There are simple defaults for these callbacks that just log in the browser console. Customize them by overriding methods in app/assets/fs_browser/callbacks.js.coffee

Configuration

The default starting path for the modal window is the root path of the filesystem ("/"). You can customise the behaviour adding an initializer in your app config directory with the following code:

FsBrowser::Path.root = '/some/other/path'

TODO

  • Check workings on windows