I just added the gem rails-bootstrap-navbar to my rails project and I would like to be able to add a glyphicon in front of my dropdown menu, there is no problem to do it with a menu-item but for the dropdown itself, there is no example in the documentation. Since the dropdown is already a block, I have no idea how to add a span to it.
= navbar fixed: :top do
= navbar_header brand: 'My great app', brand_link: '/home'
= navbar_collapse do
= navbar_group class: 'foo', id: 'menu' do
= navbar_text 'Pick an option:'
= navbar_item "Home", '/'
= navbar_item "About Us", '/about-us'
= navbar_item '/contact' do
%span.glyphicon.glyphicon-hand-right
Contact Us!
= navbar_dropdown "I want an icon too :-(" do
= navbar_item '/contact' do
%span.glyphicon.glyphicon-hand-right
I can easily have an icon :-)
- if true # check if user is admin, maybe like "if current_user.try(:admin?)"
= navbar_dropdown_divider
= navbar_item "Admin Dashboard", '/admin'
= navbar_item "Users", '/admin/users'
= navbar_group align: 'right' do
- if true # check if user is logged in, maybe like "if current_user.present?"
= navbar_item "Log Out", '/logout'
- else
= navbar_item "Log In", '/login'
The exact part I'd like to change
= navbar_dropdown "I want an icon too :-(" do
= navbar_item '/contact' do
%span.glyphicon.glyphicon-hand-right
I can easily have an icon :-)
You try to do that like, below
= navbar_item "<span class='glyphicon glyphicon-user'></span> Users".html_safe, '/admin/users'
I think you will help