2012-10-01 12:29:36 +00:00
# Sisyphus::Rails
A gem to add gmail like form saving through sisyphus.js
## Installation
Add this line to your application's Gemfile:
gem 'sisyphus-rails'
And then execute:
$ bundle
Or install it yourself as:
$ gem install sisyphus-rails
2012-10-01 20:55:36 +00:00
For a basic install include the following in your *app/assets/javascripts/application.js* file
2012-10-01 14:37:28 +00:00
//= require jstorage
//= require sisyphus
2012-10-01 20:42:14 +00:00
## How it Works
2012-10-02 14:13:22 +00:00
Sisyphus uses an aliased form_tag method to automatically put a *<script>...</script>* tag infront of your forms to initialize Sisyphus. It also uses an aliased FormHelper form_for method to read options.
2012-10-01 20:42:14 +00:00
2012-10-01 20:55:36 +00:00
< script > $ ( document ) . ready ( function ( ) { $ ( '#sampleform' ) . sisyphus ( ) ; } ) ; < / script >
< form id = "sampleform" >
2012-10-02 14:13:22 +00:00
...
2012-10-01 20:55:36 +00:00
< / form >
2012-10-01 12:29:36 +00:00
## Usage
2012-10-01 20:42:14 +00:00
Sisyphus automatically works with all your forms, including custom form builders.
### Exclude form
2012-10-01 14:37:28 +00:00
2012-10-02 14:13:22 +00:00
To stop Sisyphus from initializing on a form include the *with_sisyphus* option in your form_for.
< %= form_for User.new, :with_sisyphus=>false do |f| %>
...
< % end %>
2012-10-01 14:37:28 +00:00
## Dependencies
- Rails >= 3.1
- Jquery
2012-10-01 12:29:36 +00:00
## TODO
- Tests
2012-10-02 14:15:47 +00:00
- Move away from form_tag_helper, should be able to do it all from form_helper? Script tag can go at the end anyhow.
- Model/Object based exclusions via config or activerecord extension?
2012-10-02 14:13:22 +00:00
- block based options
< %= form_for User.new do |f| %>
< % :sisyphus => flase %>
...
< % end %>
2012-10-01 12:29:36 +00:00
## 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
## Dependencies
https://github.com/simsalabim/sisyphus
https://github.com/andris9/jStorage