Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't add dividers or dropdowns to render_list #17

Open
yossi-shasho opened this issue Oct 14, 2012 · 1 comment
Open

Can't add dividers or dropdowns to render_list #17

yossi-shasho opened this issue Oct 14, 2012 · 1 comment

Comments

@yossi-shasho
Copy link

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

  • @saiqulhaq
    Copy link

    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']

    :)

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    None yet
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants