No release in over 3 years
Low commit activity in last 3 years
Advanced combo-box using Twitter-Bootstrap
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

TwitterBootstrapCombo

Advanced combo-box using Twitter-Bootstrap

Installation

Add this line to your application's Gemfile:

gem 'twitter_bootstrap_combo'

And then execute:

$ bundle

Or install it yourself as:

$ gem install twitter_bootstrap_combo

Usage

Add this line to app/assets/javascripts/application.js:

//= twitter_bootstrap_combo

Then in your views, use:

<%= combo_box(:calendar, :parent_id, Calendar.all.collect { |c| [ (content_tag(:i, "", :class => "fa fa-angle-right fa-fw") * c.level + c.name).html_safe, c.id ] }, :include_blank => true) %>

to produce:

<input id="calendar_parent_id" name="calendar[parent_id]" type="hidden" value="6" /><div class="btn-group"><a href="#" class="btn dropdown-toggle" data-toggle="dropdown"><span class="combo_box_text">Child 1</span> <i class="fa fa-caret-down"></i></a><ul class="dropdown-menu" data-for="calendar_parent_id"><li class=""><a href="#" class="combo_box_item">(None)</a></li><li class=""><a href="#" class="combo_box_item" data-value="5">Root</a></li><li class="active"><a href="#" class="combo_box_item" data-value="6"><i class="fa fa-angle-right fa-fw"></i>Child 1</a></li><li class=""><a href="#" class="combo_box_item" data-value="8"><i class="fa fa-angle-right fa-fw"></i><i class="fa fa-angle-right fa-fw"></i>SubChild 1</a></li><li class=""><a href="#" class="combo_box_item" data-value="9"><i class="fa fa-angle-right fa-fw"></i><i class="fa fa-angle-right fa-fw"></i>SubChild 2</a></li><li class=""><a href="#" class="combo_box_item" data-value="7"><i class="fa fa-angle-right fa-fw"></i>Child 2</a></li></ul></div>

which render like this:

combo-closed

combo-opened

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