Home部分是导航栏,但它没有显示出它的假设。它曾经工作,但我不知道我做了什么,它停止工作
您可以看到boostrap.min.js和boostrap.min.css已加载
我在vendor文件夹中有bootstrap.min.js,还有boostrap.min.css。
我已将它们包含在application.css和application.js中。
我有
config.assets.enabled = true
,因为如果我将其设置为false,则不会加载css或js。我确信它与资产管道有关,但我一直在寻找和尝试新事物,但它们似乎都没有用
我没有使用gem我安装了bootstrap我下载了文件并将它们放在vendor文件夹中。我还是铁杆上的红宝石
下面是我的_nabar.html.haml文件,但之前它确实有效。所以我不会想到它的任何一个。
%nav.navbar.navbar-default{role: "navigation"}
/ Brand and toggle get grouped for better mobile display
.navbar-header
%button.navbar-toggle{"data-target" => ".navbar-collapse", "data-toggle" => "collapse", type: "button"}
%span.sr-only Toggle navigation
%span.icon-bar
%span.icon-bar
%span.icon-bar
=link_to "Home", root_path, :class => "navbar-brand"
/ Collect the nav links, forms, and other content for toggling
.navbar-collapse.collapse
%ul.nav.navbar-nav
- if current_user.admin?
%li{:class => (current_page?(users_path)? "active" : "")}
=link_to "Users", users_path
%li{:class => (current_page?(member_emails_path)? "active" : "")}
=link_to "Member Emails", member_emails_path
%li{:class => (current_page?(class_names_path)? "active" : "")}
=link_to "Classes", class_names_path
%li{:class => (current_page?(class_test_names_path)? "active" : "")}
=link_to "Test Categories", class_test_names_path
%li{:class => (current_page?(test_entries_path)? "active" : "")}
=link_to "Test Entry", test_entries_path
%ul.nav.navbar-nav.navbar-right
%li
=link_to "Sign Out", destroy_user_session_path, :method => :delete
答案 0 :(得分:0)
因为你的桌子以BS格式出现,所以不会丢失CSS。
它绝对是缩进。
请参阅:
%ul.nav.navbar-nav
- if current_user.admin?
%li{:class => (current_page?(users_path)? "active" : "")}
=link_to "Users", users_path
%li{:class => (current_page?(member_emails_path)? "active" : "")}
=link_to "Member Emails", member_emails_path
%li{:class => (current_page?(class_names_path)? "active" : "")}
=link_to "Classes", class_names_path
%li{:class => (current_page?(class_test_names_path)? "active" : "")}
=link_to "Test Categories", class_test_names_path
%li{:class => (current_page?(test_entries_path)? "active" : "")}
=link_to "Test Entry", test_entries_path
应该是:
%ul.nav.navbar-nav
- if current_user.admin?
%li{:class => (current_page?(users_path)? "active" : "")}
=link_to "Users", users_path
%li{:class => (current_page?(member_emails_path)? "active" : "")}
=link_to "Member Emails", member_emails_path
%li{:class => (current_page?(class_names_path)? "active" : "")}
=link_to "Classes", class_names_path
%li{:class => (current_page?(class_test_names_path)? "active" : "")}
=link_to "Test Categories", class_test_names_path
%li{:class => (current_page?(test_entries_path)? "active" : "")}
=link_to "Test Entry", test_entries_path
缺少的缩进导致HTML像
一样出现ul
li
而不是
ul
li
在您的网页上查看来源,您应该会看到问题。
希望有所帮助!