Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bootstrap-toggle-rails

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bootstrap-toggle-rails

  • 2.2.1.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Gem Version

Bootstrap Toggle Rails

Bootstrap Toggle is a highly flexible Bootstrap plugin that converts checkboxes into toggles.

bootstrap-toggle-rails is an unofficial gem which integrates this Bootstrap plugin with the Rails asset pipeline.

Installation

Add this line to your application's Gemfile:

gem 'bootstrap-toggle-rails'

And then execute:

$ bundle

Or install it yourself as:

$ gem install bootstrap-toggle-rails

Usage

To load the required assets in your application add the appropriate line to your application.js/application.css (depending on whether you use Bootstrap in version 3 or 2):

app/assets/javascripts/application.js:

//= require bootstrap-toggle

or in case of Bootstrap 2:

//= require bootstrap2-toggle

app/assets/stylesheets/application.css:

*= require bootstrap-toggle

or in case of Bootstrap 2:

*= require bootstrap2-toggle

Initialization

To replace a checkbox with toggles just add the data-toggle="toggle" attribute to the checkbox, e.g.:

<input type="checkbox" checked data-toggle="toggle">

Remember: this kind of initialization does not seem to be compatible to Turbolinks. If you use Turbolinks you should manually initialize with JavaScript and also attach the page:change event fired by Turbolinks, e.g.:

$(document).on('ready page:change', function() {
  $('input[type="checkbox"].toggle').bootstrapToggle(); // assumes the checkboxes have the class "toggle"
});

For more documentation see bootstraptoggle.com or their Github project.

Development

After checking out the repo, run bin/setup to install dependencies. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/rkallensee/bootstrap-toggle-rails. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License, just as the "Bootstrap Toggle" plugin itself.

FAQs

Package last updated on 11 Jan 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc