iOS Style Checkboxes for Rails 3.1

This gem provides an easy way of using iOS style checkboxes.

Install

Please be sure to have Rails Assets Pipeline enabled.

Add the following to your Gemfile, preferably inside the assets group:

gem 'ios-checkboxes'
gem 'jquery' # This is required by ios-checkboxes

Then as usually:

$ bundle install

Usage

After installation, all you need to do is to require ios-checkboxes inside JavaScript/CoffeeScript and CSS files.

Usually you would add this to your app/assets/javascripts/application.js file:

//= require ios-checkboxes

This will also automatically require jquery.

And also update your app/assets/javascripts/applications.css to inlude ios-checkboxes

/*
 *= require ios-checkboxes
 *= require_self
*/

That's it. Now you can write stuff like $(".on-off").iphoneStyle().

Development

  • Source hosted at GitHub. See rails directory.
  • Report issues and feature requests to GitHub Issues

To update the gem with the latest files do:

cd rails
rake update
# Now go and update the version manually in lib/ios-checkboxes/version.rb
git add .
git commit -m 'update rails gem'
rake release