No commit activity in last 3 years
No release in over 3 years
Rails wrapper for the jQuery OnOff plugin
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

< 5.0, >= 3.2
 Project Readme

jQuery OnOff Rails Gem VersionBuild Status

Rails wrapper for the jQuery OnOff plugin, transform checkboxes into toggle switches.

demo

From original jQuery OnOff repository:

Toggle switches made for the web are often solely constructed to change when clicked or tapped, animating side-to-side as they toggle. That's a good start, but some people like to slide toggle switches. Javascript is used for creation and for adding the sliding functionality, but the toggle is purely CSS.

Customize the look of your toggle switch using proto.io's generator.

Installation

Add this line to your application's Gemfile:

gem 'jquery-onoff-rails', '~> 0.4.0'

and run bundle install.

Or install it yourself as:

gem install jquery-onoff-rails

Usage

In your application.css, include ONE of the css file:

/*
 * English version
 *= require jquery.onoff-en
 */
/*
 * Spanish version
 *= require jquery.onoff-es
 */

In your application.js, include the js file:

//= require jquery.onoff

In you view, use the onoff helper. It will create the input checkbox and all other tags required to create the Onoff switch:

<%= onoff target: "myTarget" %>

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request