bootstrap-helper
bootstrap-helper copied to clipboard
Can't add dividers or dropdowns to render_list
Can't add dividers or dropdowns to render_list, probably because adding a css class to an 'li' tag is not possible, e.g.
I had the same problem like you before and after I read the source code at lib/bootstrap_helper/helper.rb it can be done with like this:
- create variable to save you dropdown list
- my_dropdown = '<a class="dropdown-toggle" data-toggle="dropdown" href="#">Dropdown <b class="caret"></b></a>'
- my_dropdown += render_list class: 'dropdown-menu' do |li|
- li << link_to('Action', '#')
- li << link_to('Another action', '#')
- li << link_to('Something else here', '#')
- li << ['', class: 'divider']
- li << link_to('Separated link', '#')
- call it in navbar
= render_list class: "nav-bar" do |li|
- li << [ my_dropdown , class: 'dropdown']
:)