Bootstrap 导航栏 rails gem glypicon
Bootstrap navbar rails gem glypicon
我刚刚添加了 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。由于下拉列表已经是一个块,我不知道如何向其添加跨度。
= 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'
我想要更改的确切部分
= navbar_dropdown "I want an icon too :-(" do
= navbar_item '/contact' do
%span.glyphicon.glyphicon-hand-right
I can easily have an icon :-)
你试着像下面那样做
= navbar_item "<span class='glyphicon glyphicon-user'></span> Users".html_safe, '/admin/users'
我想你会帮忙
我刚刚添加了 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。由于下拉列表已经是一个块,我不知道如何向其添加跨度。
= 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'
我想要更改的确切部分
= navbar_dropdown "I want an icon too :-(" do
= navbar_item '/contact' do
%span.glyphicon.glyphicon-hand-right
I can easily have an icon :-)
你试着像下面那样做
= navbar_item "<span class='glyphicon glyphicon-user'></span> Users".html_safe, '/admin/users'
我想你会帮忙