我刚刚将gem rails-bootstrap-navbar添加到我的rails项目中,我希望能够在我的下拉菜单中添加一个glyphicon,使用菜单项进行下载没有问题但是对于下拉菜单本身,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 :-)
答案 0 :(得分:1)
你试着这样做,在
下面= navbar_item "<span class='glyphicon glyphicon-user'></span> Users".html_safe, '/admin/users'
我想你会帮忙