Accordion Rails helper for Twitter Bootstrap
Like many, I’m living the Twitter Bootstrap craze in full these days. It’s applied to several applications I’m currently working on and two of them needed an accordion.
The Twitter Bootstrap accordion is great but requires quite a bit of infrastructure (divs, classes, hrefs and data attributes) so I set on writing a helper to clean up my views. I ended up with a 40 line helper module that I wanted to use in two different projects.
In your Gemfile :
gem 'bootstrap-components-helpers', :git => 'git://gist.github.com/2117187.git'
In your views :
= accordion do |accordion| = accordion.pane 'My first pane' do = render partial: 'my_first_pane' = accordion.pane 'My second pane' do = render partial: 'my_second_pane'
Update: it now does tabs as well.
- dbinsights posted this