bootstrap-helper icon indicating copy to clipboard operation
bootstrap-helper copied to clipboard

Can't add dividers or dropdowns to render_list

Open yossi-shasho opened this issue 13 years ago • 1 comments

Can't add dividers or dropdowns to render_list, probably because adding a css class to an 'li' tag is not possible, e.g.

  • yossi-shasho avatar Oct 14 '12 15:10 yossi-shasho
  • 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']
    

    :)

    saiqulhaq avatar Jul 09 '13 05:07 saiqulhaq