Spin Loader
This is a Gem based on Spin.js to create a big semi-transparent full screen loader with a spinner in the center.
Installation
Add this line to your application's Gemfile:
gem 'spin_loader'
And then execute:
$ bundle
Or install it yourself as:
$ gem install spin_loader
Usage
Importing the files
In your app/assets/javascripts/application.js file, add the following line:
//= require spin_loader
In your app/assets/stylesheets/application.css file, add the following line:
*= require spin_loader
Start and Stop the loader
In your coffeescript files, add the following:
root = exports ? this
Now, you have 2 commands, one to start the loader e other to stop the loader.
// This starts the loader
root.start_loading()
// This stops the loader
root.stop_loading()
Configure the Spinner
Run the generator:
$ rails g spin_loader:install
This will generate the file config/spin_loader_config.yml. Edit this file according to Spin.js.
For changes on the config file to happen, you need to run rake tmp:clear.
Contributing
- Fork it ( http://github.com/arielschvartz/spin_loader/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request